0

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: teams_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

Russ
  • 1,385
  • 5
  • 17

1 Answers1

2

Currently there is no direct API available for Set a reaction.

There are beta version API's available for Set a reaction to a single message or a message reply in a channel or a chat.

APIs under the /beta version in Microsoft Graph are subject to change. Use of these APIs in production applications is not supported.

Nivedipa-MSFT
  • 1,237
  • 1
  • 2
  • 8