Send a Message When a New Post is added in Microsoft Teams Team Channel in Power Automate

In this tutorial, I will explain how to send a message when a new post is added in Microsoft Teams team channel in Power Automate.

Here, I will cover a couple of scenarios like:

  1. Power Automate send an email to the team owner
  2. Post a message in the chat of all the Channel members, excluding the author of the post in Power Automate

Dive in to know more!

Send a Message When a New Post is added in Microsoft Teams Team Channel in Power Automate

To send a notification to Microsoft Teams team owners when a post is added to the team channel, follow the example below:

Example:

RequirementAction
When a new message is added to the Microsoft Teams team Channel.Send an email to all the team owners.

Follow the below-mentioned steps:

1. Open the Power Automate Home page, click + Create, and select ‘Automated cloud flow‘. In the next window, select the ‘When a new channel message is added‘ trigger, provide a flow name, and click the Create button.

Inside the trigger, add the below-mentioned parameters:

  • Team: Choose a team from the drop-down.
  • Channel: Select a specific channel under the team from the drop-down.
Power Automate Send a notification when a new channel Message is added

2. To get the details of the Microsoft Teams channel message, add a ‘Get message details‘ flow action.

Configure the below parameters:

  • Message: Select Message id from the dynamic content.
  • Message Type: Choose type as Channel from the drop-down options.
  • Team: Select a particular team.
  • Channel: Choose the specific channel from the drop-down.
Send a notification when a new channel Message is added with Power Automate

In Power Automate, you can easily get the team members with the flow actions, but there is no action for owners.

See also  Create Login Page in PowerApps using SharePoint List

To get the Microsoft team owners, we should call the Graph API.

3. Here, add the ‘Send an HTTP request V2‘ flow action from the Office 365 groups connector.

Provide the below details:

URI: https://graph.microsoft.com/v1.0/groups/@{body('Get_message_details')?['teamId']}/owners
Method: GET

In the URI, select the team id from Get message details of dynamic content.

Power Automate send an email when a teams channel post is added

4. To extract the owners from the previous action, take a ‘Select’ flow action.

Ensure to provide the below details:

From: @{body('Send_an_HTTP_request_V2')?['value']}
Map: @{item()?['mail']}

This will give an array of the email addresses of the owners of this specific Microsoft Teams team group.

Power Automate send notification when posting to a team channel

4. Then, take a ‘Send an email(V2)‘ flow action. Fill in the required parameters:

  • To: Provide the below-given expression.
  • Subject: Enter a subject line for a mail.
  • Body: Provide a detailed description of the mail.
Expression: join(body('Select'), ';')
Send a Message When a New Post is added in Microsoft Teams Team Channel in Power Automate

5. Now the Power Automate flow is ready, save and run the flow manually.

6. Go back to the Microsoft Teams team channel and post a message in the channel as shown below:

Power Automate send an email when a new post is done in Microsoft Teams Channel

7. If there is no error, the flow runs successfully and sends an email to all the team owners about the details of the post.

How to send a notification when a new message is added in Microsoft Teams Channel

This way, we can create a Power Automate flow to send a notification when a new message is added to the Microsoft Teams team channel.

Power Automate Post message in a Chat When a Channel message is Added

Now, I will explain how to use Power Automate to notify all the team channel members in Microsoft Teams, excluding the message author.

Go through the below-mentioned steps:

1. Create a Power Automate ‘Automated cloud flow’ with ‘When a new channel message is added trigger.

See also  Contact your admin to enable embed code creation in Power BI

2. In the next step, get the message details from the ‘Get message details‘ flow action.

3. To get the members of a Microsoft Teams team, use the ‘List group members’ flow action.

Provide the below parameter:

Group ID: Take team ID from the dynamic content to get message details.

Power Automate Post a message in Chat When a new message is added in Teams Channel

The List group members flow action will retrieve all the members of a team. So, we wanted to extract the members, excluding the message author who is posting in the team channel of Microsoft Teams.

4. Here, take a ‘Filter array‘ flow action and provide the below-given parameters in it.

  • From: Take dynamic content of body/ value from the list of group members.
  • Filter Query: Insert the expression placed in the below code.
@not(equals(@{item()?['id']},@{outputs('Get_message_details')?['body/from/user/id']}))

This expression will filter out the members, excluding who is adding a message in team channel of Microsoft Teams.

Power Automate notify in chat When a new channel message is added in MS Teams

5. Finally, add the ‘Post a message in chat or channel‘ flow action. Ensure to give the below parameters:

  • Post as: Choose according to your requirement from the drop-down.
  • Post In: Select the Chat with Flow bot option from the options drop-down.
  • Recipient: Take ‘Mail’ from the dynamic content of the filter array. Make sure to place the semicolon(;).
  • Message: Type the message body that you need to send.

For each loop will be added automatically, taking Body as an output from the filter array flow action.

Power Automate post message in a chat when a channel post is added

6. Now, save the flow and run it manually.

7. To test the flow, post a message in the team channel of Microsoft Teams as shown below:

Post message in a chat when a channel message is added using Power Automate

8. When the flow runs successfully, it will send a chat message to all the channel members, excluding the message author who is posting in the team channel.

Power Automate send Microsoft team channel notifications for all team members
Power Automate how to notify all team members when a new message is added to team channel

This is how to send a notification to all the team channel members of the Microsoft team using Power Automate

See also  How to Create a Canvas App in Power Apps From a SharePoint List?

Conclusion

I trust this Power Automate tutorial gave you the idea of how to notify when a new post is added to the Microsoft Teams team channel. It will be helpful and understanding.

Here, I have covered the following topics with Power Automate:

  • How to notify the team owner whenever someone sends a post in the Microsoft Teams team channel using Power Automate
  • Power Automate send a notification to all the team members when a post is done in the team channel of Microsoft Teams

Also, you may like:

>