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).


Posted

in

by

Tags:

Comments

4 responses to “How to @ mention people in Teams using Flow bot?”

  1. Chris Manning Avatar
    Chris Manning

    But how do you determine a user’s ID?

    1. Chris Manning Avatar
      Chris Manning

      For example, can I use an at mention from Power Automate (not a bot) to send an adaptive card and at mention one or more users?

  2. Sid Avatar

    The response from Azure DevOps query should contain the ID of user.

    Let me work on a better end to end sample and share.

    1. Chris Manning Avatar
      Chris Manning

      Thank you for your quick response. I do have an Azure account and my company’s AD info is there. What is a simple way to query the AD to retrieve a user’s ID?

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 )

Facebook photo

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

Connecting to %s

%d bloggers like this: