Let's POWER Automate

From no-code to low-code

Menu
  • Expressions
  • Filters
  • General
  • Application specific solutions
    • Dataverse
    • Excel
    • Forms
    • Planner
    • Outlook
    • SharePoint
    • Teams
  • Triggers
  • Resources
  • ABOUT ME
  • Get help with your flow
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.

10 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
  5. Tommy says:
    October 26, 2022 at 1:43 pm

    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)

    Reply
    1. Tom says:
      November 6, 2022 at 8:01 pm

      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…

      Reply

Leave a Reply Cancel reply

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

Do you know what to do, but not how to do it?

Get The Ultimate Power Automate expressions cheat sheet and translate your thoughts into flows with ease!


There's also the HTTP requests to SharePoint cheat sheet to help you overcome limitations of some standard actions!

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.

  • How to find Excel rows missing in SharePoint list (Power Automate)March 29, 2023
  • Check whether user exists in AAD with Power AutomateMarch 26, 2023
  • How to highlight whole SharePoint row based on calculated dateMarch 22, 2023
  • Why is your Power Automate flow running so slow?March 19, 2023
  • How to add multiple links to the Power Automate approval taskMarch 15, 2023

Power Automate blogs worth visiting

Damien Bird
Dennis (Expiscornovus)
Paul Murana

©2023 Let's POWER Automate | Theme by SuperbThemes