如何使用Graph API在1:1聊天中发送消息作为回复?

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

How to send messages as replies in 1:1 chat using graph API?

问题

https://graph.microsoft.com/v1.0/teams/{group_id}/channels/{channel_id}/messages/{message_id}/replies

https://graph.microsoft.com/v1.0/chats/{user_id}/messages/{message_id}/replies

response got is given below:

{'error': {'code': 'UnknownError', 'message': '', 'innerError': {'date': '2023-07-12T14:44:27', 'request-id': '4420e38b-29f3-452c-8d2b-d1cb541f6a87', 'client-request-id': '4420e38b-29f3-452c-8d2b-d1cb541f6a87'}}}

I am using delegated access token for these API's and required permissions are added. I am able to send messages in chats, but my requirement is to add messages as replies to previous messages using the message id.

Is there any way to do this using graph API?

英文:

I was trying to send messages as replies in teams using graph API's. In teams channels I was able to send messages using below endpoint.

https://graph.microsoft.com/v1.0/teams/{group_id}/channels/{channel_id}/messages/{message_id}/replies

But in case of 1:1 chats I used below endpoint, and it didn't work.

https://graph.microsoft.com/v1.0/chats/{user_id}/messages/{message_id}/replies

response got is given below:

{'error': {'code': 'UnknownError', 'message': '', 'innerError': {'date': '2023-07-12T14:44:27', 'request-id': '4420e38b-29f3-452c-8d2b-d1cb541f6a87', 'client-request-id': '4420e38b-29f3-452c-8d2b-d1cb541f6a87'}}}

I am using delegated access token for these API's and required permissions are added. I am able to send messages in chats, but my requirement is to add messages as replies to previous messages using the message id.

Is there any way to do this using graph API?

答案1

得分: 0

Teams实际上不支持在一对一聊天中进行“线程化”,这本质上就是对特定消息进行“回复”。当你在个人聊天中点击“回复”按钮时,它只是在主要聊天中创建一种“引用”的文本。这就是为什么你无法访问“/replies”端点,因为它不存在。然而,在频道中是存在的(因此存在线程化对话),这就是为什么该端点对你有效的原因。

英文:

Teams doesn't actually support "threading" in 1-1 chat, which would essentially be "replying" to a specific message. When you click the "reply" button in a personal chat, all it's doing is creating a kind of "quoted" text in the main chat. That's why you can't access the "/replies" endpoint, it doesn't exist. It -does- exist in Channels though (hence threaded conversations), which is why that endpoint is working fine for you.

huangapple
  • 本文由 发表于 2023年7月12日 22:56:00
  • 转载请务必保留本文链接:https://go.coder-hub.com/76671931.html
匿名

发表评论

匿名网友

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

确定