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 Platform Community / Forums / Power Automate / Collecting Reactions f...
Power Automate
Answered

Collecting Reactions from Teams Messages

(1) ShareShare
ReportReport
Posted on by

Hello!

 

I am not sure if anyone has done this but we are looking to run a flow every day to retrieve the reactions from messages posted 14 days ago. We have allowed the post to be live for 14 days to ensure we allow users time to read and react to a post.

 

From previous flows I can filter the "Get messages" action to only show messages posted 14 days ago however, I am stuck trying to get total the "Message reactions" to show something like the below in a SharePoint list:

 

Message IDlikeheartlaughsurprisedsadangry
486565156156551100
516168464644250300
618468464868160200

 

I believe I need to group the reactions by the "reactionType" then total the amount? Or potentially filter each message to just show where 'like' was used then do a length() to get the number of items and repeat that step for the other 5 reactions.

 

Unsure of the best way to do it so looking for guidance on how best to set this up 🙂

Categories:
I have the same question (0)
  • tom_riha Profile Picture
    10,185 Most Valuable Professional on at

    Hello @Anonymous ,

    I'd do it probably the brute force way. 🙂

    Initialize 6 integer variables for each of the reactions and set them to 0, then loop through the messages and for each message loop through the reactions.

    Inside the reactions loop, a Switch based on the reactionType that would increment the corresponding variable, e.g. reactionType = like -> increment variable with likes.

    At the end of the reactions loop each variable will contain a number that you can update in the SharePoint list for the message ID. Then set the variables back to 0, and repeat with the next message.

  • Verified answer
    Paulie78 Profile Picture
    8,422 Moderator on at

    This would be my approach, at first I thought it would be quite complex, but you can get it done quite easily:

    https://ibb.co/dcsgq3q

    TeamsReactions.jpg

    Explanation:

    1. Get messages
    2. Go into an apply each loop for each message.
    3. The reactions array associated with each message is filtered to match every type of reaction.
    4. A compose action outputs the message ID along with the length of each reaction array (the count of each reaction type).
    5. The final array of results is produced outside of the apply-each loop.

    Results look like this:

    [
     {
     "messageID": "1612948631606",
     "like": "4",
     "heart": "0",
     "laugh": "0",
     "surprised": "2",
     "sad": "0",
     "angry": "1"
     },
     {
     "messageID": "1612948620934",
     "like": "0",
     "heart": "0",
     "laugh": "2",
     "surprised": "1",
     "sad": "0",
     "angry": "0"
     },
     {
     "messageID": "1612948608713",
     "like": "6",
     "heart": "4",
     "laugh": "0",
     "surprised": "0",
     "sad": "0",
     "angry": "0"
     }
    ]

    What is nice about this solution is that because no variables are being used. You can change the concurrency control on the apply-each loop to make it run much faster. 

     

    The code in the messageReaction compose action is:

    {
     "messageID": "@{items('Apply_to_each')?['id']}",
     "like": "@{length(body('filterLike'))}",
     "heart": "@{length(body('filterHeart'))}",
     "laugh": "@{length(body('filterLaugh'))}",
     "surprised": "@{length(body('filterSurprised'))}",
     "sad": "@{length(body('filterSad'))}",
     "angry": "@{length(body('filterAngry'))}"
    }

     

    I've exported the flow and uploaded to my blog so you can download and change to your requirement.

    https://www.tachytelic.net/wp-content/uploads/TeamsReactions_20210210094805.zip

    Hopefully the output should make it easy for you to load directly into your SharePoint list.

     

  • Herokim Profile Picture
    3 on at

    Hi, I see there's way to check reaction counts of members. I'm not professional so let me ask you one thing.

    What app should I use to get your solutions applied?

  • CU-19081228-9 Profile Picture
    on at

    @Paulie78 Can I ask you some questions please?

     

    Here's what I want to do in a flow:

     

    1. Get the total number of messages in a specified Teams channel per day.
    2. Get the total number of messages from the same Teams channel that were liked.
    3. Get the total number of messages from the same channel with at least one reply/response
    4. The message totals should be for the previous seven days

    How can your solution be modified for this?  Do you have any guide/tutorial to help me?

     

    Thanks so much!

  • VictorIvanidze Profile Picture
    13,073 on at

    Have a look at  GetReactionsFromSentEmail flow: https://ivasoft.com/getreactionsfromsentemailflow.shtml

    You can use it as a base and modify according your needs.

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 525 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 324 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard