iT邦幫忙

0

使用incoming webhook在Teams上@某人問題

  • 分享至 

  • xImage

各位大大好
最近在研究使用incoming webhook將訊息推到teams上
目前推一些圖文跟模板都沒有問題
但在@人時都無法成功,使用官方或是其他論壇的作法都有說@人時,
後面的id可以接teams上的信箱,
但我自己在填上信箱後卻無法正確的tag到其他人,
請問有人有遇過相同狀況嗎?

範例
假設有成員的信箱在teams上叫test@gmail.com
param = {
"type": "message",
"attachments": [
{
"contentType": "application/vnd.microsoft.card.adaptive",
"content": {
"type": "AdaptiveCard",
"body": [
{
"type": "TextBlock",
"size": "Medium",
"weight": "Bolder",
"text": "Sample Adaptive Card with User Mention"
},
{
"type": "TextBlock",
"text": "try to at me"
}
],
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.0",
"msteams": {
"entities": [
{
"type": "mention",
"text": "me",
"mentioned": {
"id": "test@gmail.com",
"name": "me"
}
},
]
}
}
}]
}

我這樣送出訊息後,在teams上會反藍,
但在teams上並無正確標示到某人qqhttps://ithelp.ithome.com.tw/upload/images/20221202/20138804WYbop8rSWy.jpg

圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

1 個回答

0
JamesDoge
iT邦高手 1 級 ‧ 2023-01-09 03:57:21

在你的範例中,你使用的是 me,而不是成員的名字或電子郵件地址。
建議你使用成員的名字或電子郵件地址來 @ 他們,看看能不能正常工作。

param = {
"type": "message",
"attachments": [
{
"contentType": "application/vnd.microsoft.card.adaptive",
"content": {
"type": "AdaptiveCard",
"body": [
{
"type": "TextBlock",
"size": "Medium",
"weight": "Bolder",
"text": "Sample Adaptive Card with User Mention"
},
{
"type": "TextBlock",
"text": "try to at me"
}
],
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.0",
"msteams": {
"entities": [
{
"type": "mention",
"text": "@test@gmail.com",
"mentioned": {
"id": "test@gmail.com",
"name": "test@gmail.com"
}
},
]
}
}
}]
}

我要發表回答

立即登入回答