Microsoft Flow: @mention action not working for Teams reply

Brass Contributor

Hi,

I'm currently working on a Flow which should be automatically called when a new mail arrives in a teams channel. This mail is from a facility information service an provides info regarding packages and guests.

As there is no specific notification for this mail and so guest could be overseen, I want to add a mention notification to this mail in the channel.

I tried with an automatic flow, with the trigger "when a new post is added to a channel" and then a condition with "if the sender from name is "SENDERNAME" is true" then call a "get mention token for a user" action and add this token to the "reply to message in teams" action.

 

But as soon as I add the mention token action my flow ends in errors saying that I "should correct invalid inputs for the condition" and "correct invalid inputs for my reply to message" action.

 

I have no clue why these errors exist, I have access to the team and channel, logged into a teams session in flow and so on.

 

Can anyone help me in there?

If infos are needed to solve this, just ask ;)

Thanks and Regards!

9 Replies

Hey @Julian12 ,

 

Couple of places you could have gone wrong, here is a working screenshot reference:

First off the end result; note that message posted in teams says "Via email" when someone posts email to channel :

 

TeamsFlowResponse3.JPG

So, Instead of using the condition "if the sender from name is" a better option would be "Message from display name contains" like:

TeamsFlowResponse1.JPG

 

Next make sure the flow is replying to the right message, Use "Message ID" (unique for every message) for this :

TeamsFlowResponse2.JPG

and that should do the trick.

 

Thanks

 

Hi @harveer singh,

 

thanks for your detailed explanation!

 

I rebuilt my flow with the exact same objects and values to your example but still I'm getting these nasty errors. I even tried other channels and other users with which I built the flow, still no luck.

 

Following is a screenshot of my current flow, though in german but should be same elements:

Julian12_0-1597774795924.png

Maybe you notice something.

 

The errors occur as soon as I add the  mention Token action to the flow, first for the condition and as as soon as I add the last reply to message action, the 2nd error is popping up^^

 

Best Regards

Hey @Julian12 ,

 

Can you try nullifying the other condition, the one where there is no match, also can you try to use mention for some other user.

 

Thanks

What do you mena with nullifying the False condition? Simply leaving it empty?
I tried that too, but no change.
I tried with moving the get-mention token action to differentplaces but it produces everywhere even when I remove the condition and only the trigger -> mention -> reply message actions are left^^
It's always saying that the Inputparameters for the following action after the mention token action has an invalid expression?

Are there any logs or deeper error descriptions available in Flow?
Your logic looks correct, am thinking the reason it works for me and not for you with the same logic could be that the feature is still in preview, this feature has been a long standing ask from flow community and finally MS put it into action to some extent, here is another article from Pieter who was able to achieve it with the same logic : https://sharepains.com/2020/07/07/mention-microsoft-teams-power-automate/

Try using @mention with a single brach as shown in the above article and if it still doesn't work am thinking you might just have to wait for it, if it is workable for the time being, you can go with the older approach to achieve this by citing the flow bot to post a response, doesn't look neat but that's all we had back then :
https://powerusers.microsoft.com/t5/Building-Flows/Can-you-Mention-anyone-in-Teams-from-a-flow/m-p/2...

Thanks
I know this article, curiously in his example the User is evaluated as real account and not just a string value. This doesn't seem to work at the moment at all.
I tried even with a manuall trigger but as soon as I want to add the mention token to any following action similar which action, the flow goes to error state^^
Just checked while answering, it fails even if I include a manual trigger and set as User the dynamic userid who triggers the flow.

So this seems pretty bugged atm, I will have a look at the flow bot cards now..

@harveer singh 

I'm currently testing without the mention token action and I simply added in the code <at>USERMAIL</at> which is working for single users now at least :)

 

Do you have an idea with which method or string I can mention a whole channel?

I tried with its name, channel-ID and the channel mailadress, without success.

 

Best Regards

Hello @Julian12 ,

 

Sorry for a delayed response, were you able to get it working ? I have not tested 'mention channel' with flow but it should be achievable using Graph beta. Hopefully you have already found Denis' blog, if not here is a reference: http://www.expiscornovus.com/2019/05/29/mention-a-channel-with-flow/

 

To use the logic mentioned in the blog, you will have to setup graph access to the environment first, basically just navigate to graph explorer: https://developer.microsoft.com/en-us/graph/graph-explorer set the mode to beta, play around with adding the right permissions to allow an http POST possible to a teams channel, permissions reference for graph: https://docs.microsoft.com/en-us/graph/permissions-reference

 

Once you have graph setup properly you should be able to post a message from within graph explorer, use the navigation pane on left to choose "post in channel" the query should look like this: https://graph.microsoft.com/beta/teams/%7Bteam-id%7D/channels/%7Bchannel-id%7D/messages

 

If you are able to post via graph explorer like this, then you have to just simply use the same query https://graph.microsoft.com/beta/teams/%7Bteam-id%7D/channels/%7Bchannel-id%7D/messages in a http post message as per the blog.

 

This is still in Beta and i have not tested it, so cant assure that it would work great, but surely it looks possible and this is all we have for now.

 

Thanks

Hi @harveer singh,

currently it's only working for a single user.

 

I already tried this method with a HTTP request but it seems that I need a premium flow license to use this action, which I don't have. So this is stuck again.

Connecting to graph API and doing things is no problem, I already tested a few things with it and they working fine.

I will have a look later again, currently enjoying my holidays :)

Have a nice week!