“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’.
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.
10 thoughts on “Using Power Automate to reply to Teams message”
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.
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
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
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”.
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)
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…