How to mention user, tag, channel or team in Microsoft Teams using Power Automate and Adaptive Cards

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello my name is smashboxtec and in this video i will show you how you can mention whatever is mentionable within microsoft teams when speaking about sending this information from cloudflows using adaptive cards so i will show you how you can mention tags how you can mention users how you can measure channels and how you can mention teams and basically how can even mention all these things together in just one uh one message one adaptive card so um i will be showing different approaches different techniques because not everything is feasible straightforward or the way we think it should be feasible however uh in most of the cases you will be able to achieve what you need following my steps and then if you need to find some more details then look for them in my blog because i will as well publish a blog post uh with all the details around these uh these techniques alright so ready let's go now first uh i want just to simply explain what is a tag because tax are not something that was in microsoft teams ever since the the the microsoft things was created i actually realized it is present uh just like a month ago um so a tag is like a subgroup it's like a cross group of microsoft teams uh members so imagine that you have your all team members you know grouped within like a team and then you can group them into channels however if you'd like to mention uh members of different channels in a single way you know with a single mean then this is the tag that comes to help because attack is simply like a subgroup it's like um it's like a cross cross group cross channels uh so that you can create a tag you can name it you can put a description and then you can associate different members from different channels uh within that team to this stack so that whenever you use that tag in a communication in a conversation in a in a message then all these members all these you know team members associated with this stack are going to be notified not every team member or not every channel member so this will help you when you would like to simply notify a specific subgroup of team members not everyone that is present in the team wow that was uh long so let's go now and see the cloudflow and ways you can actually mention all these things so the glove flow seems to be quite long because i put in a one cloud flow all the methods i will be talking about and also i made a dynamic so now you can see here that the flow is actually first obtaining the team information uh then it's listing channels because there is no get a channel action so it has to list channels and then i'm using the filter array to only leave this channel that i really want to perform all the operations in and as well which i want to mention uh so i'm filtering this uh list of written channels to leave just cards test um then i'm obtaining two information or two two user profiles and then i'm doing the same operation as i've done for uh for the channels for tags so i'm listing all the tags and then leaving only the tag that is called adaptive cards next what i'm doing in this cloudflow is i wanted to show you as well that we can use these already uh those actions which are already um within the microsoft team stack of action for a couple of months and i think that get at mention token for user is present for over a year if not two years already uh no idea how long that get admission for attack is present nevertheless um you don't necessarily need to uh to create a sophisticated code to to mention user you can simply use these actions which are generating this automation code and then you can easily just put this automation code into your adaptive card or into your message and this will simply do all the work for you uh you can find as well information how do how to use it on my on my blog um all right so anyways i'm getting information for all these users and as well i'm getting information for uh for this adaptive cards token and then the first action uh because you can see there is at least at least there is as well some more actions to be executed however as for now they're all turned off using the static results so the first action i'm using is to post this tag mention using a user so posting this stack mention as a user because what they wrote in documentation and was simply upset me a little bit and actually i confirmed this while i was testing all these steps uh before the recording is that you are unable or at least uh i wasn't able maybe i've done something wrong or or i still i'm still convinced it's just not feasible to simply post a mention for attack using a flowbot so the only way you can post this mention to uh to mention attack is to use the user context and so for that purpose i used this very simple action to first show you how this uh mentioned for attack looks like in microsoft teams all right so this is the this is going to be the first test uh let's uh let's simply see how this mansion attack looks like and as you saw i'm simply using an outcome of this get automation token for attack action right so i'm not using any kind of of code calls or whatever it's just everything now based on the on the actions all right so um right now the post the message has been posted and i can see that attack is mentioned i can see that i has been i have been as well mentioned um and when i hover this tag i see all this information about the tags so i can see the description and as well i can see members who are associated to this stack so uh yep the first test it worked so let's navigate back and this time i will switch the static results for the for the first action for this first method so i will turn off this action all right and i will now open or enable the second action so to mention through flowbot uh with mention actions so uh here i need to disable or enable the disable static results so you can see that again here the action is posting as a flowbot and it is posting its adaptive card to the channel and it as well has three text blocks so the first text block is mentioning the users i mean two first mentioning are measuring users and the third one is mentioning the tag so let's see if it works now it's going to be the second test now right okay and then i'll just navigate here and nothing shows up because as you can see there is this error message that is saying that mentioning currently supported only uh when posting as a user so what i have to do is to simply change the scope in this action here i just need to copy the code from the flowbot into the user so that this uh adaptive card is going to be posted as a user right so let's test it again all right and this time everything should worked and should work as expected right so um oh there is some kind of a mixed uh mixer because uh there should be like once once figure should be general research to the other one should be me however the attack is mentioned as well and dimension for the tag works just fine so with that i just showed you that you are able to mention user you are able to mention attack using the uh the post to uh the person that you've got as a into a chat or channel as the user now when speaking about uh mentioning channels and teams as you so there is no action called get an ad mentioned tag for a channel or get at mention tag for a team therefore it is not really feasible to mention neither channel or team directly from the ui that we have in cloudflares however what you can try to do is to create your custom adaptive card with your custom mentions so what i've built here is again the same that we've got as you saw however this time instead of using the outcomes of automation actions it is um using the construct called at so it's simply having those stacks add to uh to wrap first display names then the tag name and then the channel name um and what i'm using here is as well this ms teams uh ms teams object that is being added to adaptive cards sent to teams and it can contain different uh different properties one of them is entities and entities are mentioned and it is contains mentions so as i went through the documentation i was able to find out i mean documentation and lots of blog posts and lots of uh chats on on forums i was able to figure out that if you'd like to mention a user this way you actually need to use this um construct of entities then then build objects with dimension types and then dimension uh has to have the id static starting from 8 and then origin and then the id of the user i tried as well to do the same for the team sorry for the tag so here is the mention for the tag and i saw someone on the forum that it should be feasible to mention a channel using this kind of of an object to put in the msteams object within this adaptive card so let's see if it's going to work [Music] now this action is posting as a flowbot right so it will certainly not allow me to display uh tax but maybe i will be surprised so now it's being saved and it should be running in just a second right now so now it's running right so i've been already mentioned as you can see the action has been executed uh but what was actually mentioned let's see so um first um first the user was mentioned the general researcher because this time i didn't make a mistake so user was mentioned i was mentioned the attack wasn't mentioned so with this approach because i was sending as a flowbot i wasn't able to mention attack and in the channel well it is displayed as a hyperlink however when i'm hovering it uh it doesn't really uh it doesn't really display any information about that channel so i believe that it doesn't really work right so the channel has been mentioned however i i doubt it really was mentioned but let's see it for now and let's go back for a moment here and what i'm going to do is to simply copy this action that contains that is being executed by the user and i'll put it here i'll rename it now to i'll rename it to um mention well through user and i'll post i'll put here all the code that this action contains okay so instead of that code which is using add mentions i'll put this code of course i'll enable disable the static results for this action i will enable the results for this action uh and let's see so right now i'm going to do the same test so uh to send adaptive card with manually defined attemptions here however this time this is sent this is being sent is going to be sent now in the context of the user so in the context of my account so let's see uh if a channel is going to be mentioned this time successfully or still with some kind of an issue because well maybe maybe this uh this structure to mention a channel is a little bit different and i am using it wrong and was an error or something right uh message mentioned text needs to be specified message mention oh that's something new to me uh so i unfortunately don't know what this error means uh what message text should be mentioned because everything here is mentioned so um honestly no idea what is wrong in here so that's something i will possibly need to debug in a moment or after i'm done with the video and hopefully i'll post the results in the blog post that you will find all these details and all the code that i'm using uh as well so anyway um i wasn't able to send this uh structure as a user so i was able to do that as a flowbot so right now i'll disable this action and the another approach you can use is to send adaptive card through a web hook that you can create to send context to a specific team uh or a channel basically to create a web hook you can you have to navigate to your microsoft teams and then go into the web hook uh sorry into the channel uh channel connectors connectors right so here you have uh under the menu of a channel you can find connectors and straight from here you can create a new connector or to see what have you configured already and one of the connectors you can we can create is the web hook so you can configure the connector and create a new one you have to just name it and once you create it here you have the url display that you can simply copy and then you can post whatever you want to this channel so in this case i have already uh created like three web hooks so you can see that i'm going i'm using this web which is called now the cards test and that is the one that is saved and here is the url that you have to copy to post messages to the webhook all right so now let me show you what you can do with the webhook so with the webhook i have used a slightly different approach that is described as fault in the documentation that tells how that maybe describes how an adaptive card should be sent using the webhook approach so you can see it is not like a pure adaptive card it is an lpf card uh wrapped in the json that is called the message so it simply is a message it contains attachments and this time as well dimensions are let's say listed below as the part of the code so there is all the information that i should possibly use and again this is the information i found in the recommendation so uh well if they write this way if they describe it this way then it should work okay um everything is set so i can simply now trigger this test to see how this is going to work oh lots of talking right so now it is running and end and end and done so let's navigate back to microsoft teams all right so here i can see that actually the adaptive card has been sent it is it is being sent by the incoming web hook and there is the tag there is a user there is second user there is even a channel however uh they all behave the same way as in that first example where i was sending this mansion using the flowbot so i think that this is not really working because i wasn't like the message isn't marked that that i've been mentioned here uh even though that these um let's say labels are displayed like hyperlinks but it doesn't work so through webhook i was able to accomplish what i wanted so i can assume that these admissions are really the admissions however however they are not working as expected so i can't hover them and i can't see any details being and i can't see any details being expanded so i really doubt this is working if you have different uh experience around this approach please reach out to me because i'd love to learn more i think it doesn't work um moreover um if you use the web hook approach and you send adaptive card you are unable to get any kind of response from this other card so even though you would be able to send a form uh like the user would be able to fill in information then you are not going to be able to send information from this adaptive card back to anything else so using web hooks you are only able to send adaptive cards like an informative informative ones so that they only displace information they can contain hyperlinks of course and buttons that opens that open urls however you are not able to perform any submit actions all right so that was another test let's navigate back to uh to the process and now i'll turn off this action and let's navigate to the two last ones so the two uh the two latest actions they're actually doing the same thing so they're both sending information to an end point in graph microsoft com that is used to send a message to a channel however the difference between them is that if you'd like to use the invoke and http request you need to have the premium license if you'd like to use the http action from the groups group groups365 set stack of actions then this action is actually uh in a standard license so for this one you don't really need a subscription so i just put the second action to to test if the second approach would work yes it does so by invoking an http request you can accomplish the same thing as by using this action from the office groups stack of actions and now what this action is meant to do is again to send an adaptive card to uh microsoft teams however this time it is using the graph api endpoint and so here you can see that the structure of the message is way more different than anything else we had seen before i've been using before so first of all it contains subject contains body and then body is defining the content so the content here is html the content contains attachment now the attachment is defined as a separate object the attachment actually uh is this adaptive card so the content type of that of that attachment is application v and d microsoft card adaptive and the content of this attachment has to be escaped so uh you can't simply buy by paste json of the adaptive card before you do that you have to escape it plus what you can see here is that the mentions are not just simple add tags but every add tag now contains a different identifier right so this one contains zero the second one is one the third one is two then third and is fourth so here i'm mentioning two users i am mentioning the channel i am mentioning the team as well and i am mentioning attack so i'm mentioning everything that i can mention uh using this approach and then every mansion has its own unique id and uh because everything here is escaped as you can see uh the new lines are escaped by this uh backslash airbag slash n uh and quotes are escaped by the singles single backs backslashes plus um because the id has to be escaped in the first place uh therefore it is being like double escaped so um you can select three backs back slashes before every quote inside the id and then what is the most important in that approach is this section called mentions so apart from attachments this uh this code contains as well a piece that is called dimensions and here in mentions there is uh the definition of every mansion being used in adaptive card or this mention can be actually used here in the body sorry so you can as well put in the content the ad id whatever and use the mesh as well so the point is that uh either in adaptive cart or in the content there has to be a mentioned for that id so it has to be resolvable anyways the way you are mentioning different uh different entities is different obviously so for the user you have to provide their id display name and this user identity type called a i mean with the value id user and as well the mentioned has to be uh containing the object called user now speaking about the tag and sorry the channel uh you need to mention it using the object called conversation and uh it contains id display name and the conversation identity type called channel speaking about the team it is the same for the as for the conversation however this time the conversation identity type is having the value team and then lastly i put this uh mention for the tag because you can information tag this way and mentioning tags does not contain any identity types it only has to contain this object called tag and then id of attack and its display name so that's it i mean that's it and it's a lot so to prepare this kind of structure dynamically you'll really have to uh think hard on how to construct it in your cloud for but well it's all doable right so it's just json now so anything you have to do you can you can just do it now you can just do within a cloud though all right so let's save it and send so here again the process is being executed and in a moment it should execute dimension with graph test so let's jump over here and here we are so that is the last execution last test so here the message has been sent of course by myself because uh that action is using my personal my personal context and this time mentioning of myself world because i can see that there is this at mention some symbol here in the message uh furthermore when i hover it i can see all the information about myself um the channel mentioned works as well fine so this is what i didn't see here this is why i think it's not working for the team it works as well so i see all the information about the team and speaking about adaptive cart about attack it works as well so by sending this information to the graph endpoint you are able to mention anything any any anything however this type of card looks slightly different so um it has this padding from the top and you're just unable to do actually anything with that now this is because there is this um section for like the ribbon or the header um reserved and it has it has this small menu plus the second downside of this approach is the same as with the web hook so you are able to send a form with this adaptive card within this adaptive card however you are unable to grab any post any submit requests or responses from these adaptive cards so the only interaction that the user can perform with is that you've got is to press buttons they're opening urls but you're unable to ask them to fill in the form and then grab the response from this phone so the only way you can use this additive card i mean this approach is to simply send a notification with maybe some call to action buttons but unfortunately without any any interactivity with the user or with the team members or with whoever all right and that is it so let me do just a small wrap up so first uh there are several ways to send to to mention users to mention tax to mention channels and commercial teams however uh all of them are having their plus and i mean pros and cons and this is really up to you which approach you need to use or which approach you will use to compete or to fulfill your business requirements as you saw you're unable to mention channel or a team using the simple approach uh with a post an adaptive card to a chat or channel either as um as a user or as a bot that is a downside of course because you're unable to mention a large group of people however if you want still to be able to use this kind of functionality and on the other hand to be able to send us a form where the users are able to you know write some data and then submit it back to cloudflow then uh the workaround is to use attack and then to associate a larger number of uh of employees with attack so this way you simply be able to notify still this large number of employees on the other hand you're able to post an adaptive card using the graph api endpoint and this way you can mention anything quite easily however you are unable to grab any submit responses so the decision which way to go is actually up to you and uh up to your business requirements thank you very much for watching if you have any questions please put them down write them down in the comments below the video and as always please subscribe and like the video and until the next time bye
Info
Channel: Tomasz Poszytek
Views: 6,541
Rating: undefined out of 5
Keywords: Microsoft, Office 365, Microsoft 365, Power Platform, mentioning in Microsoft Teams, mention user in adaptive card in microsoft teams, mention channel in teams using power automate, mention tag using power automate, mention channel using adaptive cards
Id: tKldDRS7csM
Channel Id: undefined
Length: 28min 37sec (1717 seconds)
Published: Fri Jun 24 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.