How can we "like" or add other reactions to someone else's channel message or comment via the Graph API?
2 Answers
I've not done this myself, but it certainly looks possible. You need to reply to the message, as per https://learn.microsoft.com/en-us/graph/api/channel-post-messagereply?view=graph-rest-1.0&tabs=http and notice that it has a "reactions" collection. That would be populated with a chatMessageReaction
type, as per https://learn.microsoft.com/en-us/graph/api/resources/chatmessagereaction?view=graph-rest-beta
Note of warning: chatMessageReaction
is a beta type though, so just be aware you need to call the beta endpoint, and it has a risk to use in production code as things might change.

- 9,809
- 2
- 10
- 24
-
I have reviewed (but not tested) this endpoint. From the documentation it seems that this posts a new reply (i.e. comment). It says the "body" attribute is required, which implies a message is required. I don't see a `reactions` collections in the request, only in the response. In the Teams GUI I can just add a reaction to an existing post or comment, without creating a new comment. That is the functionality that I'm looking for, not posting a new comment. – restfulhead Jan 15 '21 at 16:05
-
@restfulhead: Could you please test the endpoint suggested by Hilton and let us know.. – Rama-MSFT Jan 18 '21 at 06:33
-
@Rama-MSFT @hilton-giesenow Sorry for the delay. Tested a few things now and non of them were successful. Without sending a body, the error message is `Missing body content`. With sending a body and `reactions` the error message is `'reactions' cannot be set in POST` – restfulhead Mar 30 '21 at 16:05
-
At present we don't have any direct API for this, but could you please try to edit reactions sections in the given [example-1](https://learn.microsoft.com/en-us/graph/api/channel-post-messagereply?view=graph-rest-1.0). You can update the reactions instead of body section in the given example-1. – Rama-MSFT Apr 01 '21 at 09:13
-
This is what I tried and unfortunately it does not work. – restfulhead Apr 01 '21 at 12:56
Update: We reached out to MS Support and received the following info: "The API to reply to a message using a POST /replies request is solemnly for issuing a reply to a message, and not to edit the status of the parent message itself. Moreover, the "update chatMessage" API which is a PATCH /messages and which is the only API to edit a parent message only supports updating the policyViolation property of a chatMessage. Essentially, there is currently no documented API / already-present API examples on how to add a reaction, making this purely unsupported."

- 252
- 2
- 11