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.

19 REPLIES 19
ChristianAbata
Most Valuable Professional
Most Valuable Professional

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:
Youtube: Christian Abata
Facebook: Power Automate LA
Website Tutorials: Christian Abata

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
Helper I
Helper I

Hi all,

 

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

please help?? 

Anonymous
Not applicable

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.

Anonymous
Not applicable

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

Anonymous
Not applicable

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" 

Anonymous
Not applicable

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

 

 

Anonymous
Not applicable

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

 

 

Anonymous
Not applicable

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/

 

 

 
 
 
 
 
 
Anonymous
Not applicable

@Anonymous it looks like the JSON is not complete (there is an extra comma). I tried all kinds of iterations.

If anyone gets this working, please post your sample JSON.

This solution via send an http request worked fine for me. Thanks a lot!!

jcastelo
Regular Visitor

{
"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=\"https://forge.lmig.com/issues/servicedesk/customer/portal/1759\">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": "General",
"@odata.type": "microsoft.graph.teamworkConversationIdentity",
"conversationIdentityType": "channel"
}
}
}
]
}:

CamFromStar
New Member

Apologies for necroing an old thread, but this is still the top one that pulls through when searching anything related to channel mentions, adaptive cards and incoming webhooks.

 

I have managed to get this to work; slightly modifying the solution by @Anonymous. The only change I made was to the id.  Rather than use the channel id from the "Get link to channel" method.  I have used the last id in the incoming webhook URL.  

 

"msteams":
                        {
                            "entities": [
                                {
                                    "type": "mention",
                                    "text": "<at>General</at>",
                                    "mentioned": {
                                        "id": "12345678-xxxx-yyyy-zzzz-0123456789ab",
                                        "name": "General",
                                        "conversationIdentityType": "channel",
                                        "conversationIdentityType@odata.type": "#Microsoft.Teams.GraphSvc.conversationIdentityType"
                                    }
                                }
                            ]
                        }

 Apologies for the source formatting.  As mentioned earlier, the id can be obtained from the incoming webhook url.  The incoming webhook url should be of the format:

"https://somename.webhook.office.com/webhookb2/<some-id-1>@<tennant-id>/IncomingWebhook/<some-id-2>/<some-id-3">
<some-id-3> is the id you are looking for.

Helpful resources

Announcements

Check out the Copilot Studio Cookbook today!

We are excited to announce our new Copilot Cookbook Gallery in the Copilot Studio Community. We can't wait for you to share your expertise and your experience!    Join us for an amazing opportunity where you'll be one of the first to contribute to the Copilot Cookbook—your ultimate guide to mastering Microsoft Copilot. Whether you're seeking inspiration or grappling with a challenge while crafting apps, you probably already know that Copilot Cookbook is your reliable assistant, offering a wealth of tips and tricks at your fingertips--and we want you to add your expertise. What can you "cook" up?   Click this link to get started: https://aka.ms/CS_Copilot_Cookbook_Gallery   Don't miss out on this exclusive opportunity to be one of the first in the Community to share your app creation journey with Copilot. We'll be announcing a Cookbook Challenge very soon and want to make sure you one of the first "cooks" in the kitchen.   Don't miss your moment--start submitting in the Copilot Cookbook Gallery today!     Thank you,  Engagement Team

Announcing Power Apps Copilot Cookbook Gallery

We are excited to share that the all-new Copilot Cookbook Gallery for Power Apps is now available in the Power Apps Community, full of tips and tricks on how to best use Microsoft Copilot as you develop and create in Power Apps. The new Copilot Cookbook is your go-to resource when you need inspiration--or when you're stuck--and aren't sure how to best partner with Copilot while creating apps.   Whether you're looking for the best prompts or just want to know about responsible AI use, visit Copilot Cookbook for regular updates you can rely on--while also serving up some of your greatest tips and tricks for the Community. Check Out the new Copilot Cookbook for Power Apps today: Copilot Cookbook - Power Platform Community.  We can't wait to see what you "cook" up!    

Welcome to the Power Automate Community

You are now a part of a fast-growing vibrant group of peers and industry experts who are here to network, share knowledge, and even have a little fun.   Now that you are a member, you can enjoy the following resources:   Welcome to the Community   News & Announcements: The is your place to get all the latest news around community events and announcements. This is where we share with the community what is going on and how to participate.  Be sure to subscribe to this board and not miss an announcement.   Get Help with Power Automate Forums: If you're looking for support with any part of Power Automate, our forums are the place to go. From General Power Automate forums to Using Connectors, Building Flows and Using Flows.  You will find thousands of technical professionals, and Super Users with years of experience who are ready and eager to answer your questions. You now have the ability to post, reply and give "kudos" on the Power Automate community forums. Make sure you conduct a quick search before creating a new post because your question may have already been asked and answered. Galleries: The galleries are full of content and can assist you with information on creating a flow in our Webinars and Video Gallery, and the ability to share the flows you have created in the Power Automate Cookbook.  Stay connected with the Community Connections & How-To Videos from the Microsoft Community Team. Check out the awesome content being shared there today.   Power Automate Community Blog: Over the years, more than 700 Power Automate Community Blog articles have been written and published by our thriving community. Our community members have learned some excellent tips and have keen insights on the future of process automation. In the Power Automate Community Blog, you can read the latest Power Automate-related posts from our community blog authors around the world. Let us know if you'd like to become an author and contribute your own writing — everything Power Automate-related is welcome.   Community Support: Check out and learn more about Using the Community for tips & tricks. Let us know in the Community Feedback  board if you have any questions or comments about your community experience. Again, we are so excited to welcome you to the Microsoft Power Automate community family. Whether you are brand new to the world of process automation or you are a seasoned Power Automate veteran - our goal is to shape the community to be your 'go to' for support, networking, education, inspiration and encouragement as we enjoy this adventure together.     Power Automate Community Team

Hear what's next for the Power Up Program

Hear from Principal Program Manager, Dimpi Gandhi, to discover the latest enhancements to the Microsoft #PowerUpProgram, including a new accelerated video-based curriculum crafted with the expertise of Microsoft MVPs, Rory Neary and Charlie Phipps-Bennett. If you’d like to hear what’s coming next, click the link below to sign up today! https://aka.ms/PowerUp  

Tuesday Tip | How to Report Spam in Our Community

It's time for another TUESDAY TIPS, your weekly connection with the most insightful tips and tricks that empower both newcomers and veterans in the Power Platform Community! Every Tuesday, we bring you a curated selection of the finest advice, distilled from the resources and tools in the Community. Whether you’re a seasoned member or just getting started, Tuesday Tips are the perfect compass guiding you across the dynamic landscape of the Power Platform Community.   As our community family expands each week, we revisit our essential tools, tips, and tricks to ensure you’re well-versed in the community’s pulse. Keep an eye on the News & Announcements for your weekly Tuesday Tips—you never know what you may learn!   Today's Tip: How to Report Spam in Our Community We strive to maintain a professional and helpful community, and part of that effort involves keeping our platform free of spam. If you encounter a post that you believe is spam, please follow these steps to report it: Locate the Post: Find the post in question within the community.Kebab Menu: Click on the "Kebab" menu | 3 Dots, on the top right of the post.Report Inappropriate Content: Select "Report Inappropriate Content" from the menu.Submit Report: Fill out any necessary details on the form and submit your report.   Our community team will review the report and take appropriate action to ensure our community remains a valuable resource for everyone.   Thank you for helping us keep the community clean and useful!

Users online (4,855)