cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Nedko_Chulev
New Member

Channel/Teams mention in Adaptive Cards

I've set up a MS Flow Bot to send an Adaptive Card to a Teams channel. However, I've only managed to get an @mention work with singular persons and I would like to mention the entire channel or team.

 

I'd be fine with a solution that adds a comment to the Adaptive Card post with the team/channel mention, if that exists.

 

I'm feeling kind of lost after several hours of experimenting.

15 REPLIES 15
ChristianAbata
Community Champion
Community Champion

hi @Nedko_Chulev  please see this post maeby could help you

 

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



Did I answer your question? Please consider to Mark
my post as a solution! to guide others :winking_face:

Proud to be a Flownaut!


If you want you can follow me at www.christianabata.com Quieres contenido en español? Síguenos en Power Automate LA

Thank you for your answer, @ChristianAbata !

 

Unfortunately the question you're referring to only describes a way to mention individuals. Granted, I used exactly the method described in that post and it works flawlessly for individuals.

 

Maybe I'm misunderstanding something but using the same method hasn't been working for me when I try to mention an entire team or a channel. Which ID am I supposed to use in place of the 8:orgid of a person, when trying to reference a team/channel?

 

Cheers

I am still trying to figure this out as well. Have you had any luck? I can only mention individuals right now.

Nope, unfortunately, I couldn't find any official solution.

 

The closest I've gotten to a solution was this post: http://www.expiscornovus.com/2019/05/29/mention-a-channel-with-flow/

 

Unfortunately I do not have the rights in my company to execute it. But maybe it will help you.

fishmangal011
Frequent Visitor

Hi all,

 

Any progress on this?  I’m trying to send an adaptive card to a team group (@general). 

please help?? 

riebecj
New Member

I figured out how to do it, granted I'm doing it through AWS Lambda as SNS drives the notifications for CodeCommit Pull request updates, but it might still work for your purposes.

 

I set up an Incoming Webhook to my team's channel that is specifically used for developers and am using this JSON payload in the POST request:

 

{
        "type": "message",
        "attachments": [
            {
                "contentType": "application/vnd.microsoft.card.adaptive",
                "content": {
                    "type": "AdaptiveCard",
                    "body": [
                        {
                            "type": "TextBlock",
                            "text": "Hi <at>General</at>"
                        }
                    ],
                    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
                    "version": "1.0",
                    "msteams": {
                        "entities": [
                            {
                                "type": "mention",
                                "text": "<at>General</at>",
                                "mentioned": {
                                    "id": "CHANNEL_ID",
                                    "conversationIdentityType": "channel",
                                    "conversationIdentityType@odata.type": "#Microsoft.Teams.GraphSvc.conversationIdentityType",
                                }
                            }
                        ]
                    }
                }
            }]
    }

 

 

The CHANNEL_ID is the URL decoded ID of the channel. I found this by going to the channel you want to send the notifications to in MS Teams, click on the three dots in the upper right corner, and select "Get link to channel". The way the URL is formatted is:

 

https://teams.microsoft.com/l/channel/CHANNEL_ID/Notifications?groupId=UUID&tenantId=UUID

and the CHANNEL_ID will be in the format of "<some numbers>:<some more numbers>@thread.tacv2". Others have a similar format, but the ending is "@thread.skype".

 

Hope this helps! It sure as hell helped me.

How would I go about mentioning the Team?

awesome, thank you! I have not tried this yet, but have been searching for this answer all day and tried many other failed approaches and this look like a winner. I would like to do this same type of notification using the "tag" and I am guessing it is defined somewhere, but where are the msteams/entities object types defined?

I have been struggling to find them. I tried looking in the adaptive card schema but that was a dead end? So far, I have just been working off of examples and trying them out, but you seem to have found the holy grail.

I mean, if you mention General in a Teams channel, it's basically like mentioning the Team.

koetsia
Frequent Visitor

I've tried exactly the same, also same code as above, but still no channel-mention, just getting channel name as flat text.

 

CHANNEL_ID is "19:XXXXXXXXXXXXXXXXXXXXX@thread.tacv2"

Above code as connectorCard:

 

$ curl -H 'Content-type: application/json' -d "${connectorCard}" ${WEBHOOK_URL} 

 

 

Change the

 

"team" instead of "channel" 

koetsia
Frequent Visitor

Thx for your response!

I've tried with ("text": "Hi <at>CHANNEL_DISPLAYNAME</at>")

"conversationIdentityType": "team"

and also with ("text": "Hi <at>TEAM_DISPLAYNAME</at>")

                           {
                                "type": "mention",
                                "text": "<at>TEAM_DISPLAYNAME</at>",
                                "mentioned": {
                                    "id": "TEAM_ID",
                                    "conversationIdentityType": "team",
                                    "conversationIdentityType@odata.type": "#Microsoft.Teams.GraphSvc.conversationIdentityType",
                                }

both are not working

Appears this cannot be done through adaptive cards but I was able to do it in microsoft flow using the graph api

Great youtube below of Microsoft MVP showing what happens when you try to do this in an adaptive card. 

Basically it doesn't work as you would expect. 

https://www.youtube.com/watch?v=tKldDRS7csM

The only way I have accomplished this is by using the graph api

 

{
"subject":"@{body('Get_item')?['Status']?['Value']}: @{triggerBody()?['Title']}",
"importance":"normal",
"body": {
"contentType": "html",
"content": "<at id=\"0\">General</at><p>@{body('Convert_time_zone')}- @{body('Get_item')?['Status']?['Value']}<br>\n<strong>What's &nbsp;Happening?</strong>
<br>\n@{variables('Whatshappening')}<br>\n<br>\n<strong>What are the impacts?</strong>
<br>\n@{variables('Whataretheimpacts')}<br>\n<br>\n<strong>Where do I go for help?</strong>
<br>\nIf you have questions related to this communication, please leave a
comment below or submit a ticket to the <a
href=\"someurl\">T&amp;ES Data Office Jira Service Desk </a>&nbsp;<br>\n<br>\n@{variables('Additional Info')}</p>"
},
"mentions": [
{
"id": 0,
"mentionText": "General",
"mentioned": {
"conversation": {
"id": "@{outputs('ChannelId')}",
"displayName": "Data Alert",
"@odata.type": "microsoft.graph.teamworkConversationIdentity",
"conversationIdentityType": "channel"
}
}
}
]
}:

 

 

koetsia
Frequent Visitor

Thx, great youtube indeed!

Via the Ms Graph Explorer I get every time new "Missing Scope permissions" errors.

Via Power Automate, channel and team mention works fine under my user name, but not via a bot.

koetsia_1-1657893221831.png

koetsia_2-1657893232987.png

koetsia_3-1657893242079.png

 

 

Didn't work for me. It still posts the channel (e.g. @General) as plain text. In fact, this post from MSFT in April 2022 states that @channel mention is not ready yet, so I have no idea how you got it to work:

 

Are Channel Mentions supported via Incoming Webhook Connectors? - Microsoft Q&A

 

BTW, for anyone else wanting to get the Channel_ID, you'll need to take the URL and decode it here:

https://meyerweb.com/eric/tools/dencoder/

 

 

 
 
 
 
 
 

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (2,930)