Post recognition shout-outs to a channel on Teams
Post recognition shout-outs to a channel on Teams and tag the user who has been nominated in the shout-out
Knowledge Level: Advanced
Purpose
In this tutorial, we will utilize The Bot Platform to record an employee recognition, using a webhook trigger, we will trigger a Power Automate flow to post the nomination to a channel on Microsoft Teams.
Prerequisite
- A bot. The bot should collect the name of the employee and their email address in custom variables. This is so that we can use the email address to tag the employee in our post on a Teams channel.
- A Power Automate account
- Your favorite beverage/snack (I had a classic Americano along with some m&m's)
Setting up the bot
You can utilize any existing bots that fit this use case. Some great examples would be:
- Onboarding and new staff announcement
- Employee recognition bots
You can find templates for these use cases when you are creating a new bot on our platform. You can find a guide about our template library by clicking here
Here's a demo of one such bot in action:
Setting up the webhook
For our first step in the Power Automate flow, please follow this guide -> How To Set Up And Use Webhooks in Power Automate (Microsoft Flow)
Paste webhook url to your bot
After creating the webhook module. Please make sure to copy and paste the url into your bot as a 'Webhook' message part.
Add 'Get @mention token for a user' to your flow
After setting up the webhook, which can now receive the dynamic attributes such as name, email of the employee as well as the recognition message from the nominator, we can now find their Teams ID to be able to tag them in our message on a Teams channel.
Once you've added the step, configure it using the dynamic values available from your webhook step. We want to input the email address of the nominated employee here, use the relevant custom attribute value here. The output will provide us the user's Teams ID so we can tag them in our post.
Add 'Post message in a Chat or Channel'
This is the final part of our flow. Using this step, we will be able to post our recognition message to a channel of our choice on Teams, using the name of the employee as well as the recognition message which the nominator has submitted about them. There is also the option to be able to add an image to our post.
After choosing the appropriate Team and Channel instance, we can configure our actual message. Use the dynamic values from the previous step to tag the user who is given the shoutout, followed by your custom message and the dynamic values from the webhook message part to include the message from the nominator. Feel free to copy the template below, which also includes a static image to go along with the message in the Channel. You can adjust the wording and use any other dynamic values you might be collecting in the bot.
<p>@{outputs('Get_an_@mention_token_for_a_user')?['body/atMention']} has demonstrated the value @{triggerBody()?['user']?['state']?['vars']?['$Value']} by @{triggerBody()?['user']?['state']?['vars']?['$How']}<br>
<br>
<img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQg9Aa0FrR5rSefS6jH3xK-Rigu_MB3ywF-nMFIK6enoA&s"/>
<br>
</p>
That completes the setup. Make sure to save your flow and turn it on. Perform a test by triggering it based on your configured trigger. If everything was setup correctly, you should see a post appear in the channel, tagging the nominated user and the relevant values.
Happy shouting!
Updated 9 months ago