Forum Discussion

cschuster's avatar
cschuster
Brass Contributor
Mar 01, 2022
Solved

Sending a Teams Message from Power Automate with Mention is failing

Hi,

 

we are using a Power Automate Flow to send Teams Messages.

This Flow is activated from a http call.

But we are getting constant errors "Message mention text needs to be specified."

 

This is the json for the adaptive card:

 

{
  "contentType": "application/vnd.microsoft.card.adaptive",
  "content": {
    "type": "AdaptiveCard",
    "body": [
      {
        "type": "TextBlock",
        "text": "Hi <at>John</at>"
      }
    ],
    "$schema": "https://adaptivecards.io/schemas/adaptive-card.json",
    "version": "1.4",
    "msteams": {
      "entities": [
        {
          "type": "mention",
          "text": "<at>John</at>",
          "mentioned": {
            "id": "{Office365 User GUID}",
            "name": "John Doe"
          }
        }
      ]
    }
  }
}

 

Any Ideas how to solve this?

for the User Id i tried my email and also the guid from the Graph Api Explorer...

 

10 Replies

    • cschuster's avatar
      cschuster
      Brass Contributor
      the sample is taken from the Microsoft Documentation:
      https://docs.microsoft.com/en-us/microsoftteams/platform/task-modules-and-cards/cards/cards-format?tabs=adaptive-md%2Cconnector-html#sample-adaptive-card-with-a-mention

      i tried several formats for the UserID:
      8:guid
      8:origd:guid
      21:guid
      21:orgid:guid
      email

      but i also found some answers which didnt work...
      https://docs.microsoft.com/en-us/answers/questions/496290/-41.html
      https://docs.microsoft.com/en-us/answers/questions/195557/how-do-i-mention-a-team-member-in-an-adaptive-card.html
      • Meghana-MSFT's avatar
        Meghana-MSFT
        Former Employee

        cschuster - I ran a flow manually with the following JSONs and it worked. I tried with both email ID and User ID. Please try with the below JSON and it should work.

         

        ID can be fetched from the activity as follows

        from: {
        id: '29:15fREhoUuf6vVCOuaJYVH-AB6QXXX',
        name: 'MOD Administrator',
        aadObjectId: 'XXXX'
        }

         

         

         

        {
            "type": "AdaptiveCard",
            "body": [
              {
                "type": "TextBlock",
                "text": "Hello new test <at>Mod</at>"
              }
            ],
            "$schema": "https://adaptivecards.io/schemas/adaptive-card.json",
            "version": "1.0",
            "msteams": {
              "entities": [
                {
                  "type": "mention",
                  "text": "<at>Mod</at>",
                  "mentioned": {
                    "id": "admin@m365x654992.onmicrosoft.com",
                    "name": "Mod"
                  }
                }
              ]
            }
        }
        {
        "type": "AdaptiveCard",
        "body": [
        {
        "type": "TextBlock",
        "text": "Hi <at>Mod</at>"
        }
        ],
        "$schema": "https://adaptivecards.io/schemas/adaptive-card.json",
        "version": "1.0",
        "msteams": {
        "entities": [
        {
        "type": "mention",
        "text": "<at>Mod</at>",
        "mentioned": {
        "id": "4exxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx8",
        "name": "Mod"
        }
        }
        ]
        }
        }

         

         

Resources