Microsoft Graph API - 使用团队标记在频道中发送消息
Microsoft Graph API - send message in channel by using team tagging
这个图API在频道里发个消息
POST
https://graph.microsoft.com/v1.0/teams/{team-id}/channels/{channel-id}/messages
{
"body": {
"content": "Hello world"
}
}
此外,根据 https://docs.microsoft.com/en-us/graph/api/resources/chatmessagemention?view=graph-rest-1.0 的文档,我可以提及 用户、频道或团队
但我正在寻找如何在频道中发送消息时提及 标签。
经过一番研究,想出了一个解决方案,在这里发帖给其他人:
图表API
POST
https://graph.microsoft.com/v1.0/teams/{team-id}/channels/{channel-id}/messages
Body这里很关键
{
"subject": "This is very urgent!",
"importance": "urgent",
"body": {
"contentType": "html",
"content": "Programatically mentioning of Tagged users <at id=\"0\">String_1234</at>"
},
"mentions": [
{
"id": 0,
"mentionText": "String_1234",
"mentioned": {
"tag": {
"@odata.type": "#microsoft.graph.teamworkTagIdentity",
"id": "", //tag id
"displayName": "" //tag name
}
}
}
]
}
这个图API在频道里发个消息
POST
https://graph.microsoft.com/v1.0/teams/{team-id}/channels/{channel-id}/messages
{
"body": {
"content": "Hello world"
}
}
此外,根据 https://docs.microsoft.com/en-us/graph/api/resources/chatmessagemention?view=graph-rest-1.0 的文档,我可以提及 用户、频道或团队
但我正在寻找如何在频道中发送消息时提及 标签。
经过一番研究,想出了一个解决方案,在这里发帖给其他人:
图表API
POST
https://graph.microsoft.com/v1.0/teams/{team-id}/channels/{channel-id}/messages
Body这里很关键
{
"subject": "This is very urgent!",
"importance": "urgent",
"body": {
"contentType": "html",
"content": "Programatically mentioning of Tagged users <at id=\"0\">String_1234</at>"
},
"mentions": [
{
"id": 0,
"mentionText": "String_1234",
"mentioned": {
"tag": {
"@odata.type": "#microsoft.graph.teamworkTagIdentity",
"id": "", //tag id
"displayName": "" //tag name
}
}
}
]
}