SOLVED

Sending a Teams Message from Power Automate with Mention is failing

Occasional Contributor

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
We are looking into this. We will update you

@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"
}
}
]
}
}

 

 

@Meghana-MSFT 

 

not working for me :(

 

tried with my (primary) email, my default email (onmicrosoft.com) and your original json....

 

cschuster_1-1646226021895.png

 

 

but a simple json is working fine:

{
    "type": "AdaptiveCard",
    "body": [
      {
        "type": "TextBlock",
        "text": "Hello new test"
      }
    ],
    "$schema": "https://adaptivecards.io/schemas/adaptive-card.json",
    "version": "1.4"
}

 

Can you please share your flow package zip?

@Meghana-MSFT 

unfortunately no, i get an error every time i try to export the flow (even for a fresh created flow):

cschuster_0-1646229839750.png

 

best response confirmed by cschuster (Occasional Contributor)
Solution

@cschuster - We are sharing our flow package zip. Please check and confirm if this works at your end? 

@Meghana-MSFT 

i get an exception when exporting or importing a flow.

I opened a support ticket....

Thank you for the zip file, i got it imported (i had to allow third party cookies in my edge browser :( )
Now i found the issue:
1) We were using "Teams Nachricht als User" which should be "Teams Message as User"
and you are using "Post Adaptive Card to Channel"
2) We were posting as "User", and you are using "Flow-Bot".
this 2 changes made our flow working :)

Thank you very much and best regards
Christoph
You MUST allow 3rd Party Cookies in your browser to use export/import
www.000webhost.com