如何使用webhook更新或回复Microsoft Teams消息



我已经搜索了文档,似乎找不到解决方案。我创建了一个进入微软团队频道的网络挂钩,并使用此指南在频道中发布了一条消息:

https://learn.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/how-to/connectors-using#post-a-message-to-the-webhook-sing-curl-

这工作得很好,但我也想发出另一个cURL请求来更新消息。这可能吗?我有什么选择?

我认为";correlationId"-字段将是为我的消息创建唯一标识符的解决方案,但它似乎不起作用:

https://learn.microsoft.com/en-us/outlook/actionable-messages/message-card-reference#card-字段

也许它已经在后续版本中添加,因为只要相关id保持不变,我就可以更新消息

{ "@context": "http://schema.org/extensions",
"@type": "MessageCard",
"summary": "OMG Teams Integration",
"correlationId": "407ac8ee-b3d4-4c3d-9af9-0908566fedf7",
"sections": [
{
"activityTitle": "**Alerts**",
"activityImage": "https://xxx/_Icon_Color.png",
"activityText": "Some text"
}
]
}

要替换文本,请调用具有相同相关性和新文本的相同端点。

{ "@context": "http://schema.org/extensions",
"@type": "MessageCard",
"summary": "OMG Teams Integration",
"correlationId": "407ac8ee-b3d4-4c3d-9af9-0908566fedf7",
"sections": [
{
"activityTitle": "**Alerts**",
"activityImage": "https://xxx/_Icon_Color.png",
"activityText": "Updated text"
}
]
}

更新webhook发送的消息没有直接的方法,您可以尝试使用list Channel messages API获取消息列表,然后记下要更新的特定消息的id,然后使用update message Graph API进行更新。

最新更新