web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Automate
Suggested Answer

chat

(0) ShareShare
ReportReport
Posted on by 8
 
 
Hello,

I have a question about setting up a flow in Power Automate.

I would like to create a flow that retrieves the latest post from a specific channel in Teams whenever a specific command is used in a particular group chat room and shares it in the same group chat where the command was used.

How should I configure this flow? I am currently subscribed to a standard Office 365 for business.
Categories:
I have the same question (0)
  • Gopala_Krishna Profile Picture
    1,495 on at
    Kindly follow the shared steps to create a flow that meets your requirement.
     
     
    Trigger action "When a new channel message is added" will help in identifying messages posted in the channel, here you can select the team and the channel that you want to look at
     
     
    in the condition you can specify the condition and the keyword that you want to look at
     
     
    If the condition is true flow will go ahead and repost the same message into the channel, you can configure that in the "Post message in a chat or channel action"
     
     
    Overall flow structure and setup will be as follows:
     
    1. Trigger: When a new message is posted in a chat

      • Set this trigger to detect messages in a group chat.
    2. Condition: If the message contains a specific command (e.g., !latestpost)

      • Check if the message contains the command using the expression contains(triggerOutputs()?['body']['content'], '!latestpost').
    3. Action: Get the latest message from the specific channel

      • Add the "Get messages" action and configure it for the specific Team and Channel.
      • Configure it to return messages, sorted by date (newest first), and take the top message if necessary.
    4. Action: Post a message in the same group chat

      • Use the "Post a message in a chat" action to send the latest post back to the same group chat where the command was issued.
      • Include the content of the latest post in the message body.

    Flow Logic Example

    1. Trigger: When a new message is posted in a group chat.
    2. Condition: If the message contains !latestpost.
    3. Action 1: Get messages from the target channel.
      • Filter for the latest post.
    4. Action 2: Post the latest message in the group chat where the command was triggered.

    Final Considerations

    • Permissions: Ensure that the Power Automate app has the necessary permissions to access Microsoft Teams data and to post messages in the appropriate channels and chats.
    • Message Formatting: Consider formatting the output message from the channel in a clear and concise manner so that the latest post from the channel appears cleanly in the group chat.
  • Suggested answer
    korean_pop_man Profile Picture
    8 on at

    Dear Gopala_Krishna,

    Thank you for your valuable response.

    I have one additional question.

    In the initial trigger, "When a new channel message is added," the message I want to detect is a specific message in a Group Chat.

    The detailed flow is as follows:

    1. Detect a specific command in a specific Group Chat (ex) !latestpost).
    2. Check for the latest post in a specific channel.
    3. Post the retrieved message back to the Group Chat where the command was used.

    I sincerely apologize for the additional question, but could I kindly ask for your response to this query?

    Thank you very much.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 501 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard