I’m currently working with a client on preparing to roll-out Yammer as part of a new Employee Portal project. One of the key project objectives is to help drive employee engagement through this new portal however there are executives who are concerned with how employees might use their new found digital voice. The plan is to build a “Voice of the Employee” Yammer group to drive those connections and leverage the Modern Yammer webpart embedded in the page to surface those conversations. Yammer does offer the ability to configure “naughty words” and alert an administrator if those are triggered however those can also result in false positive responses. As I pondered how I might be able to help appease some of the executives’ concerns with how Yammer might be misused, I started to wonder if perhaps I might be able to leverage technology to help better detect misuse of Yammer – and that’s how I came up with this proof of concept.

First off, you’re going to need access to Azure and specifically to provision an instance of Text Analytics which will be used to detect the sentiment of the text that is posted to Yammer. Using Machine Learning, Microsoft’s Cognitive Services will extract key phrases from the text and provide a score based on data gathered to assess the sentiment of what the person had typed.

TextAnalytics

When you click create you’ll give the service a name, assign it to a subscription, decide on which datacenter to run the service from, which resource group to add it to, and then finally allows you to pick the pricing tier.

Microsoft is rather generous in providing you 5,000 transactions per month for free which is great for getting you going. At the next level of 25K transactions (calls to the Text Analytics API) you would be charged $74.71 (as of 7/6/18) which will likely go down as more people are on the service. You can see the various pricing tiers below as of when this blog post was written.

CognitiveServicesPricing.png

After Azure finishes provisioning your resource you’ll want to grab your Keys which will be used later to setup Flow to be able to connect to Text Analytics and receive a sentiment score.

Keys.png

Now comes the fun part! We’re going to hop into Microsoft Flow and create our awesome workflow!

You’re going to start from a blank template and have the trigger action be when there is a new message in a group. You’ll configure the action to point to your Yammer instance and select the appropriate group which you will be monitoring.

YammerMessagePosted.png

The next action is to Detect Sentiment which you will configure using the information you received from Azure. You’ll name the connection, provide the account key from Azure, and then provide the Site URL which is the Text Analytics API based on the region where you provisioned your service.

TextAnalytics.png

Example of API:

API.png

Once you’ve created the connection you’ll want to have it reference the Message Text value from the Yammer post.

DetectSentiment.png

Your next step is to add a condition to check and see if the score received back from Text Analytics is less than .3 which would indicate that the post is negative. Text Analytics uses a machine learning classification algorithm to generate a sentiment score between 0 and 1. Scores closer to 1 indicate positive sentiment, while scores closer to 0 indicate negative sentiment. I noticed another Flow template available which leveraged Text Analytics for detecting negative Tweets and they also used .3 as their negative threshold – so for consistency sake, let’s follow their lead!

Condition-Sentiment.png

If you click on Edit in advanced mode you can copy & paste the line below:

@less(body(‘Detect_Sentiment’)?[‘score’], 0.3)

If the text meets the condition of being less than .3, then I perform two actions:

  1. I get the user details of the person who made the post
  2. I lookup that person’s manager by passing the User Email variable fromt he previous Get User Details action. I’m sure you know where this is going! 🙂

GetUser&Manager.png

Finally, I have an action that sends an e-mail to both the Corporate Communications admin who wants to be notified of these negative posts. Second, I CC the user’s manager so that they are also aware of what has taken place on Yammer.

So obviously this is very customizable to meet your needs, but I merely coded in the “To” line for the person or shared mailbox that is monitoring Yammer content along with a subject line to let them know it’s a negative message that was posted.

In the body I provide the person who caused the offense, the message they posted, and then a link to the conversation thread.

NegativeYammerEmail

Just so you can see what happens when the data is passed to Text Analytics – notice the post I added to Yammer was “Super duper stupid” which was given a score of .221 (with a lot of extra numbers) which pushes it below the .3 threshold that was set.

BadSentiment.png

To get a little meaner I submitted an additional post on Yammer which said “Our executives are so stupid” which if you’ll notice received an even lower score meaning that there’s a higher probability of this post being negative.

ExecutivesAreStupid.png

So a couple of thoughts about this setup:

  1. You definitely do not want to run this type of a Flow for all your Yammer groups, that will definitely become expensive as adoption increases.
  2. There is a lag between when someone posts on Yammer and when your Flow fires. This can mean a potentially negative message is visible for a few minutes. Testing in my O365 Developer tenant, I found that most of the time the Flow ran within 3-4 minutes of the post being made in the group.
  3. I really think this is the type of thing you might setup “in the beginning of Yammer” to help quell the fear of those anxious executives that feel that employees may misuse Yammer.

When I look at Yammer as a product I really do focus on the positive impact that it can have on an organization, while respecting the fact that there is always the possibility of the platform being misused.

One of the interesting things to consider is how you could perhaps leverage Cognitive Services to catch a negative message before it’s even posted to Yammer. What if as a user is typing it alerted them that what they might be posting could be perceived as negative, remind them of the social media policy they signed, reinforce the consequences of platform misuse. Extend that same thought to Outlook and have it quarantine any e-mail that you are about to send that is snarky and perhaps unprofessional. Imagine being able to catch those moments before they happen using something like Text Analytics could be quite powerful!

Very cool stuff indeed!

UPDATE: I’ve submitted the following User Voice for Microsoft’s consideration https://yammer.uservoice.com/forums/399627-yammer/suggestions/34781296-leverage-microsoft-cognitive-services-for-sentimen