Integrating Twitter, SharePoint, and Azure Sentiment Analysis with Flow

Last month, I wrote a post that included steps for setting up Sentiment Analysis, an Azure Cognitive Service, and how to use it to score how positive your emails are.  This time, I’m going to leverage the service that was configured in that post by using it in a Flow.  The Flow will pull content from Twitter, store it in SharePoint, and determine the Sentiment score for the tweet.

To begin, I setup a SharePoint list with a number field named Sentiment Score.  For the purpose of this demo, I’ll use the Title field to store the tweet text but in production, I’d create a separate field for it.

Sentiment Score

Next, I click on Flow in the menu select Create a flow.

Create a flow

A menu will appear to the right of the page with a few templates but we’ll want to create our own so we’ll click on “See your flows” at the bottom.

See your flows

Next, you’ll be taken to the Flow page where you’ll want to select “Create from blank”

Flow page


The trigger for our flow will be when an item matching a particular hashtag is created in Twitter so you can either select the Twitter icon titled “When a new tweet is posted” or if it’s not there, you can click the Search button below it and find the Twitter trigger there.

Twitter trigger

Your flow designer will start you with the Twitter trigger.  When you first select it, you’ll need to provide credentials for Twitter.  After you do, your trigger will display a simple text box that lets you enter the text you’d like to search for.  In this case, I chose to search for #Microsoft.  This will grab any new tweets with that hashtag.


Next, I want to run that tweet against the sentiment analysis action.  I’m going to assume that you have the sentiment analysis service configured but if not, you can go back to my previous post where I walk through those steps.  To narrow down the actions, I searched for “sentiment” and it filtered it down to the results below.

Filter the results

I then selected “Text Analytics” from the connector to show that there are multiple options, but I could’ve just selected the action titled “Text Analytics – Detect Sentiment”.

Text analytics


Next, it’s time to configure the sentiment action.  When the action first comes up, it’ll ask for a key and endpoint which you can get from the sentiment analysis service in Azure.  Once you provide that, you’ll get the action below which asks for the text that you want to analyze.  Using the Dynamic Content, you can tell the action to analyze the Tweet Text that is coming from the Tweet trigger and you can specify a language as well.

Configure the sentiment action

Once the text is scored, I can create another action to Create a SharePoint Item.

Create a SharePoint Item

That will give me the action below which simply needs a URL, the List where we want to store our results.  This is the list that I created in the beginning with the Title and Sentiment Score fields.  Using dynamic content, you can save the Tweet Text to the Title field and the score from the sentiment action to the Sentiment Score field.

Sentiment Score field

Once you’re done, the Flow should look something like this.  (Don’t forget to give your Flow a proper name by clicking on the text at the top left of the screen.  I named mine “Twitter Sentiment Analysis”)

Twitter Sentiment Analysis

The result is a list that is populated with tweets and scores.

The result


This is just a simple proof of concept to show how simple it can be to do this.  Depending on how many tweets you expect to have, you may not want to create SharePoint list items for this.  Instead, you may want to store the content in a spreadsheet or database.  With a little more effort, you can create better ways to present the data using column formatting or SPFx web parts.   If you release a new products or have some sort of event, you can keep an eye on your social media buzz to see how people are receiving them.

About the Author: 

Jason Rivera is a SharePoint Architect / Developer / Consultant in Philadelphia. Specializing in SharePoint and Office 365 Solution Architecture, he plans and implements tailored solutions with the goal of enhancing communication, productivity, and collaboration. Jason has over a decade of designing and implementing SharePoint business solutions that integrate with line of business systems to achieve each customer’s unique goals. Over the years, Jason has also contributed to the community via blog posts and user group presentations that are geared toward the technical and business audiences. His work has taken him from the DC area to New York, working with companies in various industries from local, small businesses to global corporations.

Reference: Rivera, J (2018). Integrating Twitter, SharePoint, and Azure Sentiment Analysis with Flow. Available at: [Accessed 6 July 2018]

Share this on...

Rate this Post: