最近注意到 Microsoft Flow (Power Automate) 已启用向个人聊天发送卡片。这在 2020 年是不可能的,所以我想知道现在是否可以使用 Graph API 向 Teams 聊天/群聊发送自适应卡片?我正在使用 Python 中的“请求”包,并且能够向群聊发送消息,但在发送卡片方面没有运气。
感谢您的回复和建议!
答案 0 :(得分:0)
可以使用graph api发送自适应卡片
POST https://graph.microsoft.com/beta/teams/{id}/channels/{id}/messages
Content-type: application/json
{
"subject": null,
"body": {
"contentType": "html",
"content": "<attachment id=\"74d20c7f34aa4a7fb74e2b30004247c5\"></attachment>"
},
"attachments": [
{
"id": "74d20c7f34aa4a7fb74e2b30004247c5",
"contentType": "application/vnd.microsoft.card.adaptive",
"content": JSON.stringify(card.attachments[0].content)
}
]
}
请查看 documentation 了解更多详情。