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

如何通过Teams Webhook在通知中@指定人员?

Teams入站Webhook@用户不生效问题

我通过Teams入站Webhook推送测试失败通知到指定频道,希望@负责测试的人员,但目前@仅显示纯文本,无法触发用户提醒。当前传入的ID参数为邮箱地址Xhan@gmail.com,name参数为Hu, Xhan,不确定参数配置是否正确,现有发送的JSON数据如下:

{
            "@type": "MessageCard",
            "@context": "http://schema.org/extensions",
            "themeColor": "0076D7",
            "summary": "e2e Failed test",
            "sections": [{
                "activityTitle": "![TestImage](https://47a92947.ngrok.io/Content/Images/default.png)e2e Failed test",
                "activitySubtitle": "FT4 validation",
                "activityImage": "https://teamsnodesample.azurewebsites.net/static/img/image5.png",
                "facts": [{
                    "name": "Assigned to",
                    "value": "@Xhan"
                }, {
                    "name": "Script",
                    "value": "Script name"
                }, {
                    "name": "Scenario",
                    "value": "Scenario name"
                }, {
                    "name": "Step",
                    "value": "Test Step"
                }],
                "markdown": true
            }],
            "potentialAction": [{
                "@type": "ActionCard",
                   "name": "Result Link",
                   "actions": [{
                       "@type": "OpenUri",
                       "name": "Result Link",
                           "targets": [
                               { "os": "default", "uri": "https://dummylinkForNotifications" }
                           ]
                   }]
           }],
    "msteams": {
    "entities": [
      {
        "type": "mention",
        "text": "<at>Xhan</at>",
        "mentioned": {
          "id": "Xhan@gmail.com",
          "name": "Hu, Xhan"
        }
      }
    ]
  }
}

解决方法

  1. 关联mention标记:facts中Assigned to的value需要使用和msteams.entities里一致的<at>Xhan</at>,而非纯文本@Xhan,这样才能和mention实体关联触发提醒。
  2. 确认用户参数正确性:mentioned.id使用用户的UPN(通常就是邮箱地址)是正确的,需确保该邮箱是Teams团队内的有效用户。

修改后的JSON示例:

{
            "@type": "MessageCard",
            "@context": "http://schema.org/extensions",
            "themeColor": "0076D7",
            "summary": "e2e Failed test",
            "sections": [{
                "activityTitle": "![TestImage](https://47a92947.ngrok.io/Content/Images/default.png)e2e Failed test",
                "activitySubtitle": "FT4 validation",
                "activityImage": "https://teamsnodesample.azurewebsites.net/static/img/image5.png",
                "facts": [{
                    "name": "Assigned to",
                    "value": "<at>Xhan</at>"
                }, {
                    "name": "Script",
                    "value": "Script name"
                }, {
                    "name": "Scenario",
                    "value": "Scenario name"
                }, {
                    "name": "Step",
                    "value": "Test Step"
                }],
                "markdown": true
            }],
            "potentialAction": [{
                "@type": "ActionCard",
                   "name": "Result Link",
                   "actions": [{
                       "@type": "OpenUri",
                       "name": "Result Link",
                           "targets": [
                               { "os": "default", "uri": "https://dummylinkForNotifications" }
                           ]
                   }]
           }],
    "msteams": {
    "entities": [
      {
        "type": "mention",
        "text": "<at>Xhan</at>",
        "mentioned": {
          "id": "Xhan@gmail.com",
          "name": "Hu, Xhan"
        }
      }
    ]
  }
}

内容的提问来源于stack exchange,提问作者Nandan N

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.13 21:55:29