'@mention via incoming webhook in MS Teams

I'm trying to mention a user from an incoming webhook.

I tried a few iterations via Postman of

{
"text": "test @user"
}

or

{
"text": "test @[email protected]"
}

but none of these seem to work. Is this simple but very important thing just not possible?

Thanks.



Solution 1:[1]

I'm afraid this isn't possible yet - the only way to do @ mentions is by using the full Bot Framework APIs.

You're not the only one to have asked for this though, so I'll get it on the backlog.

Solution 2:[2]

This is now supported and documented here (https://docs.microsoft.com/en-us/microsoftteams/platform/task-modules-and-cards/cards/cards-format?tabs=adaptive-md%2Cconnector-html#user-mention-in-incoming-webhook-with-adaptive-cards).

Sample:

{
"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": "Hi <at>Adele UPN</at>, <at>Adele AAD</at>"
            }
        ],
        "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
        "version": "1.0",
        "msteams": {
            "entities": [
                {
                    "type": "mention",
                    "text": "<at>Adele UPN</at>",
                    "mentioned": {
                      "id": "[email protected]",
                      "name": "Adele Vance"
                    }
                  },
                  {
                    "type": "mention",
                    "text": "<at>Adele AAD</at>",
                    "mentioned": {
                      "id": "87d349ed-44d7-43e1-9a83-5f2406dee5bd",
                      "name": "Adele Vance"
                    }
                  }
            ]
        }
    }
}]

}

Solution 3:[3]

If it helps anybody, after looking in to this and seeing it couldn't be done (still!?), a workaround for me was to change the channel notification settings to banner + feed for all new posts for relevant users in the channel. This eliminates the need to use the tag (if tagging the team).

Solution 4:[4]

It is supported in Teams now, however the sample code does not work in Microsoft card playground, I didn't know the code actually worked until I tried in Postman.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Bill Bliss - MSFT
Solution 2 Ariel Popovsky
Solution 3 Callum.
Solution 4 Janet W.