Skip to content

Let's POWER Automate

From no-code to low-code

Menu
  • Expressions
  • Filters
  • General
  • Problems
  • Triggers
  • Application specific solutions
    • Excel
    • Forms
    • Planner
    • Outlook
    • SharePoint
    • Teams
  • Resources
Menu

Using Power Automate to reply to Teams message

Posted on December 13, 2020February 7, 2022 by Tom

“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

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.


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 resources like a SharePoint Filter Query cheat sheet or Date expressions cheat sheet.

Zero spam, unsubscribe anytime.

8 thoughts on “Using Power Automate to reply to Teams message”

  1. Kevin K says:
    July 21, 2021 at 8:43 pm

    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.

    Reply
    1. Tom says:
      July 23, 2021 at 2:48 pm

      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
    2. Reply
  2. Amy Matthews says:
    August 12, 2021 at 6:59 pm

    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

    Reply
    1. Tom says:
      August 14, 2021 at 8:54 am

      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.

      Reply
  3. Alex says:
    February 7, 2022 at 3:04 am

    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

    Reply
    1. Tom says:
      February 7, 2022 at 10:21 pm

      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.

      Reply
  4. Scott Earley says:
    February 16, 2022 at 11:30 pm

    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”.

    Reply
    1. Tom says:
      February 19, 2022 at 11:56 am

      Hello Scott,
      I think you can reply only to the initial message in a channel, you can’t reply to a reply.

      Reply

Leave a Reply Cancel reply

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

Now available:

The Ultimate Power Automate expressions cheat sheet
Equip yourself with the tool to translate your thoughts into Power Automate expressions!

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 resources like a SharePoint Filter Query cheat sheet or Date expressions cheat sheet.

Zero spam, unsubscribe anytime.

Hello and welcome!

My name is Tom and I'm a business process automation consultant and Microsoft MVP living in the Czech Republic. I’ve been working with Microsoft technologies for almost 10 years, currently using mainly Power Automate, SharePoint, Teams, and the other M365 tools.

I believe that everyone can automate part of their work with the Power Automate platform. You can achieve a lot by "clicking" the flows in the designer, but you can achieve much more if you add a bit of coding knowledge. And that's what this blog is about.

To make the step from no-code Power Automate flows to low-code flows: using basic coding knowledge to build more complex yet more efficient flows to automate more of your daily tasks.

  • Format results of date calculation in SharePoint columnJune 29, 2022
  • Why is your Power Automate flow creating duplicatesJune 26, 2022
  • How to create a unique identifier in your Power Automate flowJune 22, 2022
  • How to assign custom SharePoint permission level with Power AutomateJune 19, 2022
  • Remove permissions from a specific SharePoint user with Power AutomateJune 15, 2022

Power Automate blogs worth visiting

Damien Bird
Dennis (Expiscornovus)
Paul Murana

© 2022 Let's POWER Automate | Powered by Superbs Personal Blog theme