使用Microsoft365R响应Teams消息

huangapple go评论64阅读模式
英文:

React to a Teams message using Microsoft365R

问题

如何在使用Microsoft365R R包时对Microsoft Teams消息添加心形反应?

手动对消息进行反应后,可以使用以下方式从R中查看:

# 查找更新/更改
message1$sync_fields()

# 获取消息的第一个反应的反应类型
message1$properties$reactions[[1]]$reactionType

似乎Microsoft365R包尚未直接实现对消息进行反应的功能。因此,您可能需要使用message1$do_operation()message1$update()来向Microsoft Graph API发送API调用,但对于正确的语法和包与API的交互方式可能不太确定。

Microsoft Graph API 文档:

Microsoft365R 文档:

请注意,两年前似乎还没有API端点来执行此操作,但也许自那时以来有所改变。这里提到了这个情况。

英文:

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:
使用Microsoft365R响应Teams消息

<strong>How do I react to this message from R? I want to add a heart reaction.</strong>

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

&gt; message1$properties$reactions[[1]]$reactionType
[1] &quot;heart&quot;

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:
&emsp;<a href="https://learn.microsoft.com/en-us/graph/api/chatmessage-post?view=graph-rest-1.0&tabs=http">Send message</a>
&emsp;<a href="https://learn.microsoft.com/en-us/graph/api/chatmessage-post-replies?view=graph-rest-1.0&tabs=http">Reply to a message</a>

Microsoft365R Documentation:
&emsp;<a href="https://github.com/Azure/Microsoft365R">Github page</a>
&emsp;<a href="https://CRAN.R-project.org/package=Microsoft365R">CRAN package page</a>

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? https://stackoverflow.com/questions/65737835/add-reaction-to-existing-posts-or-comments

答案1

得分: 2

目前尚无直接的API可用于设置一种反应。

Microsoft Graph中有用于在单个消息消息回复频道中设置反应的Beta版本API可用。

Microsoft Graph的/beta版本中的API可能会发生更改。不支持在生产应用程序中使用这些API。

英文:

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.

huangapple
  • 本文由 发表于 2023年4月7日 02:55:49
  • 转载请务必保留本文链接:https://go.coder-hub.com/75952867.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定