MS Teams – Chats – Unset Chat Message Reaction
MS Teams – Chats – Unset Chat Message Reaction
Remove a reaction from a chat message.
Action details
| Property | Value |
|---|---|
| Action label | MS Teams – Chats – Unset Chat Message Reaction |
| Category | CloudTools |
| Apex class and method | UnsetMSTeamsChatMessageReaction.unsetReaction |
| Input type | UnsetMSTeamsChatMessageReaction.UnsetMSTeamsChatMessageReactionInput |
| Output type | List<MSGraphUpdateResponse> |
| Authorization | Delegated access; no application permissions declared. |
| Microsoft Graph request | POST /chats/{chatId}/messages/{messageId}/unsetReaction or /teams/{teamId}/channels/{channelId}/messages/{messageId}[/replies/{replyId}]/unsetReaction |
Prerequisites and permissions
Configure a CloudTools Connector with Connector Type set to Microsoft 365. Complete Microsoft sign-in for OAuth Delegated (Authorization Code). For endpoints supporting OAuth Application (Client Credentials), grant application permissions and administrator consent. The identity must have access to the selected resource. See Creating an Entra ID App and Integration Connectors for setup.
The action permission provider declares these alternatives; they are not cumulative requirements and not all are least privileged. Resource-specific permissions require consent for the relevant Teams resource.
| Permission type | Declared alternatives |
|---|---|
| Delegated | ChannelMessage.Send, Chat.ReadWrite, ChatMessage.Send |
| Application | Not declared; check the endpoint reference. |
Endpoints: /teams/{team-id}/channels/{channel-id}/messages/{message-id}/unsetReaction; /teams/{team-id}/channels/{channel-id}/messages/{message-id}/replies/{reply-id}/unsetReaction; /chats/{chat-id}/messages/{message-id}/unsetReaction. Channel messages and replies use ChannelMessage.Send. The shared action also supports private chats, which use Chat.ReadWrite or ChatMessage.Send. Application permissions are not supported.
See the Microsoft operation and permissions reference.
Inputs
| Input | Apex field | Type | Required | Description |
|---|---|---|---|---|
| User Id | userId | String | No | Microsoft user identifier or UPN |
| Chat Id | chatId | String | No | MS Teams chat identifier |
| Team Id | teamId | String | No | MS Teams team identifier for channel message reactions |
| Channel Id | channelId | String | No | MS Teams channel identifier for channel message reactions |
| Message Id | messageId | String | Yes | MS Teams chat or channel message identifier |
| Reply Id | replyId | String | No | Optional Teams channel message reply identifier |
| Reaction Type | reactionType | String | Yes | Reaction type, for example like, heart, laugh, surprised, sad, angry, or a Unicode emoji |
Supply a nonempty list with a non-null first request. This implementation processes only the first request and does not bulk-process Flow interviews. Global inputs do not expose connectorId; Flow and subscriber Apex use CloudTools connector selection. Use Microsoft Graph IDs, not Salesforce IDs or browser links. Resolve dynamic values before invoking this action.
Outputs
Returns one operation result after the request completes. Inspect its documented fields. Failures throw an exception rather than returning a success=false result.
| Output | Apex field | Type | Description |
|---|---|---|---|
| Success | success | Boolean | Whether the update succeeded |
| Message | message | String | Result message |
Behavior and limits
Supply Chat Id for a chat message, or both Team Id and Channel Id for a channel message; the channel target takes precedence. Message Id is always required. Reply Id appends a channel reply path. Named reaction aliases such as like and heart are converted to Unicode; other values are forwarded after trimming.
Use in Flow
Add MS Teams – Chats – Unset Chat Message Reaction where supported. CloudTools Flow automation does not support delegated connections. Use a delegated custom integration for this operation; confirm endpoint restrictions before choosing another action for Flow.
Use in custom Apex
This subscriber-org example uses the Apptigent namespace. Replace example identifiers and values before use. Configure the connector, arrange authorization first, run in a context permitting callouts, and handle exceptions and empty results.
Apptigent.UnsetMSTeamsChatMessageReaction.UnsetMSTeamsChatMessageReactionInput request =
new Apptigent.UnsetMSTeamsChatMessageReaction.UnsetMSTeamsChatMessageReactionInput();
request.messageId = 'REPLACE_WITH_MESSAGE_ID';
request.reactionType = 'REPLACE_WITH_REACTION_TYPE';
List<Apptigent.MSGraphUpdateResponse> results =
Apptigent.UnsetMSTeamsChatMessageReaction.unsetReaction(
new List<Apptigent.UnsetMSTeamsChatMessageReaction.UnsetMSTeamsChatMessageReactionInput>{ request }
);
System.debug(results);
Use in a Lightning Web Component
Use unsetMSTeamsChatMessageReaction from msTeamsConnectorLib through MSTeamsConnectorController. Set request.connectorId to select a configured connector. These c/ imports apply in the same namespace. The controller uses a shared request DTO; its field names differ from the global invocable input.
| Global input | LWC request mapping |
|---|---|
userId | request.userId |
chatId | request.chatId |
teamId | request.teamId |
channelId | request.channelId |
messageId | request.messageId |
replyId | request.replyId |
reactionType | request.reactionType |
teamsActionExample.js
import { LightningElement } from 'lwc';
import { unsetMSTeamsChatMessageReaction } from 'c/msTeamsConnectorLib';
export default class TeamsActionExample extends LightningElement {
result = null;
errorMessage = '';
isRunning = false;
completed = false;
async handleRun() {
if (this.isRunning || this.completed) return;
this.isRunning = true;
this.errorMessage = '';
try {
const request = { connectorId: 'REPLACE_WITH_CONNECTOR_RECORD_ID' };
request.messageId = 'REPLACE_WITH_MESSAGE_ID';
request.reactionType = 'REPLACE_WITH_REACTION_TYPE';
this.result = await unsetMSTeamsChatMessageReaction(request);
this.completed = true;
} catch (error) {
this.errorMessage = error.requiresInteractiveAuthorization
? 'Sign in to Microsoft for the connector, then try again.'
: error.message || 'The Teams action failed.';
} finally {
this.isRunning = false;
}
}
}
teamsActionExample.html
<template>
<lightning-button label="Run action" onclick={handleRun}
disabled={isRunning}></lightning-button>
<p role="alert">{errorMessage}</p>
</template>
The library resolves to one mapped object or null. rawJson serializes the mapped Apex model rather than the untouched Microsoft response. Message body, membership roles, and nested properties can be flattened or serialized in JavaScript DTOs.
Use getMSTeamsAuthorizationState, beginMSTeamsAuthorization, and createMSTeamsOAuthMessageHandler to arrange delegated sign-in. The library normalizes errors but does not automatically sign in or retry. Reset completed for a new deliberate operation. Inspect resource state before retrying a mutation with an uncertain outcome.
Error handling and troubleshooting
| Symptom | What to check |
|---|---|
| Required fields error | Supply a nonempty request list, a non-null first request, and required or conditionally required values. For LWC, check controller mappings. |
| Authorization or access denied | Check selected connector, delegated versus application support, consent, Teams app installation where required, and access to the resource. |
| Resource not found | Check team, channel, chat, message, membership, and app installation IDs; these are distinct identifiers. |
| Missing data | Check pagination, query support, empty-response behavior, and documented model mapping. |
| Operation rejected | Inspect the Microsoft error, endpoint restrictions, supported properties, message authorization limits, and notification configuration. |