How do I mention a team member in an adaptive card that is sent to MS Teams?

Sarah Edwards Kladstrup 6 Reputation points
2020-12-11T17:17:54.207+00:00

How do I mention a team member in an adaptive card that is sent to MS Teams?

I see the syntax in several places, and I am able to send the card to the channel, but the user's name does not notify them, nor does their user information pop-up when I hover over their username.

https://powerusers.microsoft.com/t5/Building-Flows/Ms-Teams-Mentions-in-adaptive-cards/td-p/520520
https://learn.microsoft.com/en-us/microsoftteams/platform/task-modules-and-cards/cards/cards-format?tabs=adaptive-md%2Cconnector-html

{  
    "type":"message",  
    "attachments":[  
        {  
        "contentType":"application/vnd.microsoft.card.adaptive",  
        "contentUrl":null,  
        "content":{  
                "$schema": "https://adaptivecards.io/schemas/adaptive-card.json",  
                "type": "AdaptiveCard",  
                "version": "1.2",                  
                "body": [{  
                        "type": "TextBlock",  
                        "text": "Hi <at>UPN</at>! \nThe latest build of ${currentBuild.fullDisplayName} has failed. \nPlease take a look.",  
                        "wrap": true  
                }],  
                "msteams": {  
                    "entities": [  
                        {  
                            "type": "mention",  
                            "text": "<at>UPN</at>",  
                            "mentioned": {  
                                "id": "8:orgid:flow-get-user-profile-v2-id-output",  
                                "name": "UPN"  
                            }  
                        }  
                    ]  
                }  
            }  
        }  
    ]  
}  

What does the ID actually need to contain? Is there other information lacking in the documentation that I need to include here?

Microsoft Teams
Microsoft Teams
A Microsoft customizable chat-based workspace.
10,462 questions
{count} vote

2 answers

Sort by: Most helpful
  1. JimmyYang-MSFT 54,571 Reputation points Microsoft Vendor
    2020-12-14T02:23:26.717+00:00

    Hi @Sarah Edwards Kladstrup ,

    In my experience, to include a mention in an Adaptive Card your apps to include the following elements:

    1.<at>username</at> in the supported adaptive card elements

    2.The mention object inside of an msteams property in the card content, which includes the Team user id of the user being
    mentioned.

    For more reference here:

    https://powerusers.microsoft.com/t5/Building-Flows/Ms-Teams-Mentions-in-adaptive-cards/td-p/520520


    If the response is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


  2. Sarah Edwards Kladstrup 6 Reputation points
    2021-01-04T14:30:30.88+00:00
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.