Instructional Designer

Capturing Praise from Microsoft Teams


We wanted to build out an employee recognition program. It had to:

a. be easy to use -intuitive
b. Integrate with Microsoft Teams
c. Be trackable (who sent what, to whom, when)
d. Easily output metrics for use by management for praise/reward systems.

Someone on my team recommended we use Praise, which is an app build into Microsoft Teams. This is a decent solution, but we need a way to see the praise, and take a look at metrics. If we want to recognize the praise that has been given, or someone who is very good at giving praise, we need to know that data. My research brought me to this post by Dapt.UK.

I love that they built out this tutorial for everyone to see, but it’s a little old, and for a newbie, it wasn’t as intuitive as I wanted it to be, so I’m going to replicate what I did below)

Step 1 : Create a Sharepoint Site with a list. Your list needs 7 columns.

Column NameField TypeColumn Formatting
TitleSingle line of text No formatting
BadgeSingle line of text {
“$schema”: “https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json”, “elmType”:”img”, “style”: {“width”: “100px” }, “attributes”:{ “src”: “@currentField” } }
GiverPeople PickerNo formatting
RecipientPeople PickerNo formatting
Praise TypeSingle line of text No formatting
Date ReceivedSingle line of text No formatting
ReasonSingle line of text No formatting

You can format the badge column by clicking on the column, going to column settings and then format this column. Then type in the json and click save.

Step 2: Next you need to build an automated workflow.
To do this: Log into flow.microsoft.com Then click on Create, Automated cloud Flow

Choose a Name for your new Flow.
Then, in the Choose your Flow’s Trigger, scroll down until you get to the “When a new channel message is added” option. Select it, then click on Create.
The flow window opens with the first step. Choose the Team you want the flow to monitor, and then the channel in that team.
Find the ellipsis (three dots in the upper right corner) and then click on Settings
You need to add some Triggers. Click on +ADD and add these two triggers. Your Trigger conditions should look like this when your done.

Trigger 1:
@contains(first(triggerBody()?[‘attachments’])?[‘content’],’praise’)
Trigger 2:
@contains(first(triggerBody()?[‘attachments’])?[‘content’],’AdaptiveCard’)


Now. Add a new Step in the flow:

Search for “get message details” and then select the Teams Get message details option.
In the Message field, choose Message ID from the dynamic content selection
Then, choose Channel for Message Type. Choose the Team you’d like this flow to monitor, and which Channel in that team you want it to monitor.

Add a New Step.

Add in a Compose (Data Operation) action.
Click in the Input field, then swap to the Expression (fx) field. Type in json(first(triggerBody()?[‘attachments’])?[‘content’]) then click on Ok.

Before you go any further – rename this section to AttachmentsContent !!!


Now,

Now, you need 2 MORE Compose sections. In each one, add in an Expression (same as before)

First Compose expression : outputs(‘AttachmentsContent’)?[‘body’][0]
Second Compose expression: outputs(‘Compose’)?[‘items’][4]

Lets take quick stock of where we are now. You should have 5 steps so far.


Lets keep going. Now we need to add in a variable.

In the Name field – enter in a name. I chose PraiseMessage. Choose String for your Type. Then enter in the following as an expression in the Value field: outputs(‘Compose_2’)?[‘text’]


Add in a new step.

Add in an Apply To Each action
In the Select an output from previous steps – select Message mentions (scroll WAY down to get it)
Next, click the ADD an action button (this adds the next apply to each action) not a new flow action
Add in a Get User Profile (v2) action
Add in an expression here like you’ve done in previous steps:
items(‘Apply_to_each’)?[‘Mentioned’]?[‘user’]?[‘id’]

Click on Add an action again to add a new action to the apply to each function
Now we’re going to add in a Create item Sharepoint action
Use the drop down menus to select your Sharepoint site – you should have created this in Step 1. Then select the list name of the list you created.

Give this a title.

Then, in the Badge field – add in the following expression
first(skip(first(outputs(‘AttachmentsContent’)?[‘body’])?[‘items’],3))?[‘url’]


In the Giver Claims field – scroll to the bottom to Enter Custom Value.
Then choose From User Display Name
In the Recipient Claims field, you will also need to scroll down to Enter Custom Value – then choose Mail in the Dynamic Content area.
In the Praise Type field enter the following expression
first(skip(first(outputs(‘AttachmentsContent’)?[‘body’])?[‘items’],1))?[‘altText’]
In Date Received, choose CreatedDate Time
Finally, choose the Reason as our variable Praise Message

That’s it! Your done! Be sure to Save your flow!

Now that your flow is saved, you can test it ! Click Test in the upper right corner
Do a manual test. Click Manually , then Test

Now, go add a message into your Teams channel!

Wahoo! Your flow worked perfectly!

Now, you need to go to your Sharepoint Site and make sure that the flow ran and updated the sharepoint site the way you wanted it to. You also need to test and make sure that when someone gives praise on the site, that it automatically updates the sharepoint site.

**Note** While my script ran and populated my list on my Sharepoint site, the Badge part isn’t working, and I don’t get the people images in front of the names that the tutorial shows that I should get. So, my next steps are to troubleshoot that part. I’ll update this blog when I have found out the solutions!