Using Power Automate to reply to Teams message

“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?

power automate post a reply to a teams message

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.

power automate get teams message ID

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.

power automate reply to teams message

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.


Do you struggle with the various expressions, conditions, filters, or HTTP requests available in Power Automate?

I send one email per week with a summary of the new solutions, designed to help even non IT people to automate some of their repetitive tasks.

All subscribers have also access to a special content like a SharePoint Filter Query cheat sheet.

Zero spam, unsubscribe anytime.

Add a Comment

Your email address will not be published. Required fields are marked *