I want to add a heart reaction to a Microsoft Teams message using the Microsoft365R
R package.
I sent a message to a channel like this:
library(Microsoft365R)
library(magrittr)
# Authenticate to Azure active directory
# This tells microsoft 365R to use the CLI app id globally
options(microsoft365r_use_cli_app_id=TRUE)
# Define a team as a variable
team1 <- list_teams()[[1]]
# Define a channel as a variable
team1_channel1 <- team1$list_channels()[[1]]
# send a message
message1 <- team1_channel1$send_message("This message was sent from R to Teams!")
That works and sends this message:
How do I react to this message from R? I want to add a heart reaction.
When I manually react to the message, I can see that from R like this:
# look for updates/changes
message1$sync_fields()
# pull the reaction type of the first reaction to the message
> message1$properties$reactions[[1]]$reactionType
[1] "heart"
It looks like a feature to react to messages isn't directly implemented in the Microsoft365R
package yet. So instead, I probably want to use either message1$do_operation()
or message1$update()
to pass an API call to the Microsoft Graph API, but I'm not sure about the correct syntax and how the package interacts with API.
Microsoft Graph API Documentation:
Send message
Reply to a message
Microsoft365R Documentation:
Github page
CRAN package page
Edits
As of two years ago it looks like there wasn't an API endpoint to do this, but maybe something has changed since then? Add reaction to existing posts or comments