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.
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
Proud to be a Flownaut!
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.
Hi all,
Any progress on this? I’m trying to send an adaptive card to a team group (@general).
please help??
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.
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"
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 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&ES Data Office Jira Service Desk </a> <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"
}
}
}
]
}:
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.
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/
@riebecj 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!!
{
"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 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&ES Data Office Jira Service Desk </a> <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"
}
}
}
]
}:
User | Count |
---|---|
87 | |
37 | |
25 | |
13 | |
12 |
User | Count |
---|---|
117 | |
55 | |
36 | |
23 | |
21 |