You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何通过Microsoft Teams传入Webhook在自适应卡片中正确提及标签?

解决Teams Incoming Webhook提及自定义标签无通知的问题

问题场景

通过Incoming Webhook向Microsoft Teams发送包含自定义用户组(标签)提及的Adaptive Card,请求信息如下:

  • Webhook地址:https://xx.webhook.office.com/webhookb2/xx-xx-xx-xx-xx@xx-xx-xx-xx-xx/IncomingWebhook/xx/xx-xx-xx-xx-xx
  • JSON请求体:
{
    "type": "message",
    "attachments": [
        {
        "contentType": "application/vnd.microsoft.card.adaptive",
        "content": {
            "type": "AdaptiveCard",
            "body": [
                {
                    "type": "TextBlock",
                    "text": "Hi <at>TAG NAME</at> Testing Tagging via Incoming Webhook."
                }
            ],
            "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
            "version": "1.0",
            "msteams": {
                "entities": [
                    {
                        "type": "mention",
                        "text": "<at>TAG NAME</at>",
                        "mentioned": {
                          "id": "TAG ID",
                          "name": "TAG NAME"
                        }
                    }
                ]
            }
        }
    }]
}

发送后出现异常:

  • 被标签提及的成员未收到通知
  • 鼠标悬停标签无任何相关信息提示

问题原因

经官方文档相关讨论确认:Incoming Webhook目前不支持提及团队自定义标签。该功能仅在Teams客户端直接发送消息或通过Graph API调用时可用,Incoming Webhook的消息结构和权限限制无法触发标签提及的通知及交互效果。

替代解决方案

方案1:使用Graph API发送消息

调用Teams Graph API(如POST /teams/{team-id}/channels/{channel-id}/messages),在消息实体中正确配置标签提及结构,此方式完全支持标签提及的通知功能。

方案2:逐个提及标签内用户

若标签成员数量较少,可在Adaptive Card中逐个提及用户,每个用户的提及结构示例如下:

{
    "type": "mention",
    "text": "<at>用户名</at>",
    "mentioned": {
        "id": "用户ID",
        "name": "用户名"
    }
}

需确保TextBlock中的<at>文本与实体中的text字段完全一致。


内容的提问来源于stack exchange,提问作者Shivam Singhal

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.28 15:45:04