Intermediate | Flow of the Week: Sentiment analysis on survey data

Hey everyone! Last week we started creating a Flow of The Week based around a survey in Microsoft Forms. I asked you to take the survey, and then I'd to show you how to turn the results into insights. 19 of you filled it out (thank you!) and gave us some fantastic info.

Take a quick peek at the dashboard we built in Power BI around your responses:

Some of the things we at Flow learned through this survey is that you guys really are enjoying the product, and you are pleased with how quickly we release updates and new connectors. One common theme was that we need more instructional material, whether it be documentation, instructional videos, or more how-to blogs. We hear your feedback, and we're planning big investments in those areas. It’s also an area where we would love your help — if you want to run webinars, write blogs, or create instructional material around Flow, please contact me directly at I’m happy to help give you a platform to do so!

Okay, on to the rest of the post!

Now that we have a working Power BI dashboard that we can slice and dice and begin to understand how you guys feel about the product, I also want to build a Flow that takes some of your comments and runs them through sentiment analysis. This will give me a score for each comment, and then I can focus first on the replies that were less happy.

Let's do some housework first, and go to our SharePoint List to add two columns: first Sentiment (single line of text) and then Checked for sentiment (yes/no picker).

With that done, we can head over to the Flow website and sign in.

We are going to create a brand new Flow, so let's click on My Flows at the top of the page, and then on Create From Blank +.

Let's start by using a recurrence trigger. We dont need the sentiment analysis to happen line-by-line as the data arrives, so we can save ourselves some Flow runs by checking every four hours, or even once per day. To do this, type Schedule in the connectors box, select Recurrence as the trigger, and set it to 4 Hour. Click + New Step, then Add an Action.

For the next action, search for the SharePoint connector to pull from our SP list where we are storing the data, and choose the action Get Items.

Now, I am going to insert a condition by selecting +New Step and then Add a Condition.

We can have the condition check if the item has already been Checked for Sentiment by using our dynamic content piece, and then selecting equals and typing False into the box as False = No.

Now in the If Yes side of the condition choose +New Step. Then Add an Action and type Detect Sentiment. (This connector will require you to go to Azure and get a FREE Cognitive services API Key.)

The connector will ask me which text it should run through sentiment analysis and so, to keep this dynamic, I want to use some of my Dynamic content from my SharePoint list. More specifically, I'll use the survey question, "Have you recommended Microsoft Flow to a friend or co-worker? Why or why not?" as I think it can give us a good reading of overall sentiment.

Now that our data is going to go through the sentiment analysis we need to do something with it. I want to append the SharePoint list with the sentiment data, and also update the Yes/No check to say that the item HAS been checked, so that future checks are not re-running the same information.

In the If Yes column of the condition, let's go ahead and choose Add an Action. Select the SharePoint connector and the action Update Item, and make sure to choose the correct SP Site, List, and ID. From there, select the updates you want made to the item. I am using dynamic content to update the sentiment score column, and typing Yes into the Checked for Sentiment column like so:

From here I can stream this data into my Power BI dashboard for visualization, or I can create flows that send digest emails of the results, or I can build mobile notifications for myself based on certain sentiment scores, or a million other things! How would you continue to build this Flow? Share your ideas with us below in the comments, on Twitter, or in the Community!

As always, we love your feedback and hope you enjoyed another Flow of the Week!