@ mentioning people in Microsoft Teams with Power Automate

Introduction

Users have long been able to use the ‘send a message in Teams’ action but, unless people checked every channel of every team they wouldn’t know about the post.

Now though, the Team bot can post a message AND notify the tagged user, so they know there is a message to read.

In this post, I’m going to show you how to assign a task to a user and then notify the assignee, through the ‘Post a message as the Flow bot to a channel’ action (currently in preview).

Prerequisites

I’m going to assume that you have a basic working knowledge of Flow, SharePoint and Teams.

Before we start, you’ll need a SharePoint list (using the modern experience), with the following columns:

  • Title
  • Description
  • Assigned to
  • Due date
  • Status

And, of course, you’ll need an account for Microsoft Flow and a Microsoft Team to post to.

Building the Flow

1. Log into SharePoint and access your list and select Flow > Create a flow.

2. From the dialog, select ‘Post message to Microsoft Teams for a selected item’.

3. Select more and then select ‘Complete a custom action for the selected item’.

4. Flow will open in a new tab (you may need to connect Flow to SharePoint and there is more information here).

5. Select ‘Continue’.

6. Give the flow a name and select save.

7. Delete the text input

8. Next, add a new action by selecting the new step button.

9. Enter ‘Teams’ in the search box and select the Microsoft Teams icon.

10. Select the Post a message as the Flow bot to a channel (preview) 

11. Select the Team and Channel that you want to post to and then it’s time to create your message.

Creating the message

To get @mention to work, you only need to use a simple line of code, but I’m going to add a little bit of detail so that the mentioned user has something to read.

1. In the message field, type <at></at> and place your cursor between the > and the <.

2. In the dynamic content search box, select ‘Assigned to Email’.

3. The assignee’s email address will be placed between the opening and closing tags

4. Now the flow is configured to notify a user that they have a new message to read but, as I said, I’ll add more task information for context.

Note: I’ve also used some basic HTML to format the message to make it more readable. You can read more about HTML here

5. Now, you can return to your list and test your flow.

6. If you haven’t already done so, create a task and assign to yourself.

7. Select the task > Flow > your flow (in my case it’s ‘Post to Teams with @’).

8. Select ‘Run flow’.

9. You’ll receive a desktop notification.

10. Open the Teams channel and view your message.

Conclusion

In this article, we have looked at how to use the Post to Microsoft Teams as the team bot action to post a message in Teams and alert a user. We did this by creating a manually triggered flow on a list, notifying the assignee of the task.

No Responses

Leave a Reply

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