0

I am trying to notify the test failures via teams channel.So whenever a test fails, a notification will be sent to a teams channel with the help of teams incoming webhooks. notification snippet

Along with the above details, I would like to tag people who are responsible for the tests.

Below is the data I am sending. But instead of mention, plain text is getting published. Data passed for ID: email ID ["Xhan@gmail.com"] Data passed for name: not sure what has to be passed for this parameter ["Hu, Xhan"]

{
            "@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"
        }
      }
    ]
  }
}
Nandan N
  • 23
  • 4
  • According to the syntax, you need to have another property as shown in below screenshot - https://i.stack.imgur.com/ayIj0.png. This text block will render the @mention. This text block should have the same the name in between tags as in entities property. Please refer this example - https://learn.microsoft.com/en-us/microsoftteams/platform/task-modules-and-cards/cards/cards-format?tabs=adaptive-md%2Cdesktop%2Cconnector-html#user-mention-in-incoming-webhook-with-adaptive-cards – Meghana-MSFT Aug 10 '23 at 17:03
  • I have taken the syntax from the same website. It is not working. Instead of mention, plain text is getting posted. – Nandan N Aug 14 '23 at 09:57
  • Incoming webhooks support user mention in Adaptive Cards. Could you please use adaptive cards instead of a message card. – Meghana-MSFT Aug 14 '23 at 13:23
  • Pasting a screenshot of working JSON - https://i.stack.imgur.com/mmZ0y.png – Meghana-MSFT Aug 14 '23 at 13:55

0 Answers0