Moderation with Yammer.
Always a hot topic to discuss. When I was in sales I found myself in that discussion multiple times with customers and always tried to articulate the moderation requirement versus the nature of the social network… which is freedom to create unstructured content and collaborate.
Anyways. The requirement still exists and cannot be a blocker for customers to realize the value of the Microsoft 365 platform. I don’t want to see customers looking into competitor solutions and spending more just because of that!!
Thinking about the problem with the perspective of the whole M365 platform I immediate thought about using Power Automate (former Flow) to intercept Yammer posts and moderate. The issue with that approach is due to how the new post trigger in Power Automate fires up. The message needs to be posted into the group first to have the flow started… but we need to control if it can be posted or not, just after the approval process…
Ok, then what if we can support a light moderation approach? That is, users will post to Yammer and a moderator will receive an approval message in Teams. If message is approved, then nothing needs to be done. If it is rejected then the flow can call Yammer APIs and simply erase the message from the community/group.
Definitely not the ideal solution as the post will stay there until the moderator reject it, but this is definitely good enough for the vast majority of scenarios I’ve seen so far.
Well. With the contribution of my colleague Marcos Zanré we figured out how to implement the scenario. Details below.
By the way, stay tuned for the part 2 of this article. I’ll document how to implement a more elaborate approach to deal with the post staying in Yammer until its rejection issue.
Create a token to authorize calls to Yammer APIs from Power Automate
Open Yammer as admin and select the Apps settings page.
Click on My Apps and then Register New App.
Fill the Register New App form with the name of your application, organization, support e-mail, website and Redirect URI. We don’t need specific values for the website and redirect URI at this moment, so you just need to fill those with any valid URLs.
Select the checkbox after read the Yammer API Terms of Service and then click Continue.
Click on “Generate a developer token for this application”, copy and save the token value. We will need it for the following steps.
Create the Power Automate flow
Open https://powerautomate.microsoft.com and authenticate using an administrator credential.
Click My Flows, and then New. Select Automated – from blank option.
Give a name for the Flow and select the Yammer “When there is a new message in a group” trigger.
Update the trigger object with appropriate values for Group ID and Network ID according to your needs. In the case below I’m using the Leadership group in the Contoso Yammer network.
Click on the + New Step button below the Yammer trigger and search for Teams related actions. You may choose other options here, I’m using the “Post a choice of options as the Flow bot to a user” but you can choose the best options for you, depending on your needs.
In Options Item, include Approve and Reject options.
In the Headline, include the text “Please approve or reject the post to Yammer Leadership group”. Update Recipient with the e-mail address of the moderator. Note that Power Automate will resolve the address to the user object.
In Message, use the “Message List Message Body Text” value that you can find on the Dynamic Content window.
Now you will need to include a condition to take actions depending on the user response in the card sent using Teams. That is pretty straightforward with Power Automate.
Click New Step and selection Condition. In the Condition box, use the Dynamic Content window to select the selectedOption value for the box on the left, choose “is equal to” and type “Approve” in the text box on the right.
Now you will implement an action to delete the message from Yammer if the moderator rejects it. We will use the HTTP Power Automate action to perform that.
Important! Please note that the HTTP action is part of the premium connector set. You will need appropriate licenses assigned to your user to have access to those premium actions when using Power Automate.
More information about how to license Power Automate is available at Microsoft Power Apps and Power Automate Licensing Guide.
Click Add an Action in the red box and search for HTTP. Select the HTTP action.
In Method, select DELETE. In URI use the Dynamic Content window to select the Yammer “Message List Message Url” value.
In Headers, include the key Authorization and the value “Bearer “ combined with the Token ID you generated in the Yammer console before. Very important that you concatenate Bearer, the space, and the token value in a single line.
Leave the other fields blank and click Save.
Go ahead and post a message in the Yammer group you are moderating. The user you included in the Teams action will receive a card to approve/reject the post and the post will be kept or removed from Yammer depending on the result of the approval process.
Have fun! –Cristiano.
Disclaimer – The information contained in this blog post doesn’t represent the official Microsoft guidance or best practices. It is just the view of the author on current alternatives, implementations and workarounds for common issues and/or business needs. Please refer to official Microsoft documentation and evaluate carefully any steps, code or procedures documented herein. The author doesn’t offer any warranty. Use this information at your own risk.