Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Namespace: microsoft.graph
Important
APIs under the /beta version in Microsoft Graph are subject to change. Use of these APIs in production applications is not supported. To determine whether an API is available in v1.0, use the Version selector.
Set a reaction to a single chatMessage or a chat message reply in a channel or a chat.
This API is available in the following national cloud deployments.
| Global service | US Government L4 | US Government L5 (DOD) | China operated by 21Vianet |
|---|---|---|---|
| ✅ | ✅ | ✅ | ✅ |
Permissions
One of the following permissions is required to call this API. To learn more, including how to choose permissions, see Permissions.
Permissions for channel
| Permission type | Permissions (from least to most privileged) |
|---|---|
| Delegated (work or school account) | ChannelMessage.Send |
| Delegated (personal Microsoft account) | Not supported. |
| Application | Not supported. |
Permissions for chat
| Permission type | Permissions (from least to most privileged) |
|---|---|
| Delegated (work or school account) | Chat.ReadWrite, ChatMessage.Send |
| Delegated (personal Microsoft account) | Not supported. |
| Application | Not supported. |
HTTP request
To set a reaction to a chatMessage in a channel:
POST /teams/{teamsId}/channels/{channelId}/messages/{chatMessageId}/setReaction
POST /teams/{teamId}/channels/{channelId}/messages/{messageId}/replies/{replyId}/setReaction
To set a reaction to a chatMessage in a chat:
POST /chats/{chatId}/messages/{chatMessageId}/setReaction
Request headers
| Name | Description |
|---|---|
| Authorization | Bearer {token}. Required. Learn more about authentication and authorization. |
| Content-Type | application/json. Required. |
Request body
In the request body, supply a JSON object with the following parameters.
| Parameter | Type | Description |
|---|---|---|
| displayName | String | The display name of the custom emoji. Optional. When reactionType is custom, specify displayName, reactionId, or both. |
| reactionId | String | The service-issued identifier of the custom emoji. Optional. When reactionType is custom, specify displayName, reactionId, or both. |
| reactionType | String | The reaction type. Required. Specify a Unicode character for a standard reaction or custom for a custom emoji reaction. |
If you specify both displayName and reactionId, they must identify the same tenant-scoped custom emoji.
Response
If successful, this action returns a 204 No Content response code.
This action also returns a 400 Bad Request response code if reactionType is custom and neither displayName nor reactionId is supplied, or if the supplied identifiers resolve to different custom emojis. The action returns a 404 Not Found response code if the custom emoji can't be resolved in the tenant.
Examples
Example 1: Set a reaction to a chat message
The following example shows how to set a reaction to a chat message.
Request
The following example shows a request.
POST https://graph.microsoft.com/beta/chats/19:8b1131f7c9e64f7b9b4b3f6d2f6f15a7@thread.v2/messages/1700000000000/setReaction
Content-Type: application/json
{
"reactionType": "💘"
}
Response
The following example shows the response.
HTTP/1.1 204 No Content
Example 2: Set a reaction to a message in a channel
The following example shows how to set a reaction to a message in a channel.
Request
The following example shows a request.
POST https://graph.microsoft.com/beta/teams/57fb72d0-d811-46f4-8947-305e6072eaa5/channels/19:4a95f7d8db4c4e7fae1ec0b28d1d8a52@thread.tacv2/messages/1700000000000/setReaction
Content-Type: application/json
{
"reactionType": "💘"
}
Response
The following example shows the response.
HTTP/1.1 204 No Content
Example 3: Set a reaction to a reply message
The following example shows how to set a reaction to a reply message.
Request
The following example shows a request.
POST https://graph.microsoft.com/beta/teams/57fb72d0-d811-46f4-8947-305e6072eaa5/channels/19:4a95f7d8db4c4e7fae1ec0b28d1d8a52@thread.tacv2/messages/1700000000000/replies/1700000001000/setReaction
Content-Type: application/json
{
"reactionType": "💘"
}
Response
The following example shows the response.
HTTP/1.1 204 No Content
Example 4: Set a custom emoji reaction by display name and reaction ID
The following example shows how to set a custom emoji reaction by display name and reaction ID.
Request
The following example shows a request.
POST https://graph.microsoft.com/beta/chats/19:8b1131f7c9e64f7b9b4b3f6d2f6f15a7@thread.v2/messages/1700000000000/setReaction
Content-Type: application/json
{
"reactionType": "custom",
"displayName": "party-parrot",
"reactionId": "opaque-service-issued-id"
}
Response
The following example shows the response.
HTTP/1.1 204 No Content