“I’m trying to create Power Automate flow that when Planner task gets marked as completed, a reply is posted to the Teams message the task was created from.”
Power Automate has an action ‘Post a reply to a message (V2)’ that you can use to reply to an existing Teams message. The information it needs is the Team ID, Teams channel ID, Teams message ID and the reply itself. You can select the Team and Channel field values from a dropdown, but the message ID needs your input.
It might be tempting to enter there the message you want to reply to (the field is called Message, right?). But it’s not the expected value. The action wants message ID, not the text of the message. The message ID is a unique identifier of the message in the channel, e.g. 1607019904197. So how do you find it?
Get Teams message ID
To get message ID, you must find the message among all the other messages on the channel. Since there’s no direct filter to get only the specific message, it takes 2 actions to find it. ‘Get messages’ to list all of messages in the Channel, and ‘Filter array’ to get only the message you want to reply to.
On the picture above, the ‘Filter array’ action will filter the results from ‘Get messages’. It’ll create a new array of messages that fit the condition. If a message content (text of the message) is equal to ‘Title’, it’ll stay. All other messages will be removed from the array. If there’s only a single message with the ‘Title’, it’ll return array with a single message. And this message ID is the ID you need for the ‘Post a reply to a message’ action.
Note: the ‘Post a reply to a message’ action was replaced by ‘Reply with a message in a channel’.
Summary
Using the solution above you can find any Teams message. In this specific scenario it was searching for a message corresponding to a Planner task. The original trigger was ‘When a task is completed’, which is the only action missing from the image above. If there was a message with the same name as a completed Planner task, it would post a reply.
There’re two limitations though. First, the message content (text) must be unique. If there’re multiple messages with the same text, you must add additional filter. The result of the ‘Filter array’ should be always just a single message, otherwise the flow will reply to all that fit the filter.
The second limitation is related to the Teams connector. Power Automate will use the same connection for all messages. It’s not possible to reply as the author of the original message. It’ll always the same user defined in the flow.
For whatever reason, this is not working for me. Everything I have tried, has not wanted to work. Every time I have tried something, it replies to every message in the channel.
I am just trying to grab that specific message that I have created a post a message automate then I am trying to create the condition to Get that specific message, then filter array then do a post a reply message action to send a specific message with newer information.
Hello Kevin,
I can imagine 2 reason why it would reply to all messages:
it doesn’t filter the right message in the ‘Filter array’ action (check the run history, how many messages the action returns, it should be only one)
you don’t use the output from ‘Filter array’ as the input of ‘Apply to each’ (you don’t loop only through the filtered messages, but through all of them
I want to reply to any new message that someone may post in a channel, but only when a new message comes in. Its running in 3 min intervals rather than when someone sends a neew message. Help
Hello Amy,
that’s unfortunately configuration of the Teams connector, it doesn’t trigger right away but only once every 5 minutes to process all messages since the last run. You can see the interval if you click on the 3 dots on the trigger -> Peek code. I think it’s shorter if you pay for a premium license, but I’m not 100% sure about that.
Hi, at first this flow works for me. Unfortunately, I don’t understand why my reply does not reply to the message I’ve already set up in the channel but it creates a new post. Could you help me explain why this happens? Thank you so much
Hello Alex,
my guess would be that you don’t use the right Message ID. You must find the specific Message ID using the ‘Filter array’ action, if you don’t filter the messages it’ll reply also to invisible system messages and it’ll show such responses as new posts.
I have a flow created that will reply to a message, but the same flow won’t work if the message I’m replying to was a reply to a message. When this runs the error is “Not Found”.
Hello Scott,
I think you can reply only to the initial message in a channel, you can’t reply to a reply.
Why is it not possible to add a title when creating the first message? Advantage of using channel chat is that you can create conversation with title and replies are grouped under the conversation… yet, it is not possible to create a title… strange.
And what I wanted to do is impossible. I actually wanted to post in the conversation linked to the item list. Really, the current features – posting in the channel chat or group chat – is just wild and there is no way to have conversation grouped (unless I use external chat box or I create a group chat for each item list)
Hello Tommy,
I agree, and the sad part is that I think it was possible to do it some time ago, but then they replaced the message posting action…
Still there no way to reply in a chat, even if I know chat message ID.
it is possible to do manually in Teams, you reply to a chat message… and yet in the Graph, I only “reply to message to channel” – https://graph.microsoft.com/v1.0/teams/TEAMSID/channels/CHANNELID/messages/MSGID/replies
I wish the graph to have the same with chats
https://graph.microsoft.com/v1.0/chats/CHATID/messages/MSGID/replies
I want to reply to all new messages in all channels inside a Team.
I could create for a specific Channel, but I want it to All. And I don’t want to create several flows.. Need help.
Hello VT,
I have no idea how to do it in a single flow, not sure whether it’s even possible to run flow for all messages everywhere.
thank you for the article