How to @ mention people in Teams using Flow bot?

TLDR; Steal the card JSON below and create your Flow such that it provides the Name and AAD ID of the user to be mentioned at the highlighted spot and you are good to go!

Problem
Let’s say you decided to automate some workflow in your team using Flow so that it posts a message in a certain channel whenever some items satisfying some condition are detected.

In a software engineering team, for example, this could be a Flow for alerting the team about bugs that are older than XX days.

Well you set this Flow up but now you find that folks miss the messages from Flow bot in the channel and don’t take action, so you wish there was a way to @ mention the person that the bug is assigned to and get their attention.

Solution
Well now you can do just that: use Flow bot to @ mention the person that the bug/item needing attention is assigned to.

Use the following sample Adaptive Card JSON and make the following tweaks:

  1. Make sure to provide the name you want shown in the mention.
  2. Make sure to provide the ID of the user to be mentioned in the card in the following format “8:orgid:<AAD_ID_OF_USER>“.
{
    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
    "type": "AdaptiveCard",
    "version": "1.0",
    "body": [

        {
            "type": "Container",
            "items": [{
                "type": "TextBlock",
                "text": "Stale bug alert!",
                "weight": "bolder",
                "size": "medium"
            }, {
                "type": "ColumnSet",
                "columns": [{
                    "type": "Column",
                    "width": "stretch",
                    "items": [{
                        "type": "TextBlock",
                        "text": "<at>Sid Uppal</at>",
                        "weight": "bolder",
                        "wrap": true
                    }]
                }]
            }]
        }
    ],
    "actions": [{
        "type": "Action.OpenUrl",
        "title": "View bug",
        "url": "https://www.youtube.com/watch?v=eFVi-j-yIr0"
    }],
    "msteams": {
        "entities": [{
            "type": "mention",
            "text": "<at>Sid Uppal</at>",
            "mentioned": {
                "id": "8:orgid:6b7b3b2a2c4b4175858241c9e685c1b5",
                "name": "Sid Uppal"
            }
        }]
    }
}

Note that the ability to @ mention users in Adaptive Cards is available in Public Developer Preview at this point (ref).

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Blog at WordPress.com.

Up ↑

%d bloggers like this: