Using the Microsoft Cognitive Services with Microsoft Flow and SharePoint Online Lists

Using the Microsoft Cognitive Services with Microsoft Flow and SharePoint Online Lists

This week I am attending the MVP summit in Redmond. This morning I had a chat with SharePointAppie about the possibilities of Microsoft Flow and the Cognitive Services. We had the following scenario: We want to get the hashtag of Twitter: #MVPSummit and put that in a SharePoint Online list. We want to see if the tweet about the MVPSummit is possitive of negative and write that score back to the SharePoint list.

Global solution:

  • Get items from twitter with Microsoft Flow
  • Save them in a SharePoint List a SharePoint List
  • Create a flow that sees new listitems in that list
  • Post it to Microsoft Cognitive Service Text Analyses / Sentiment via HTTP
  • The sentiment services gives a score 0 (negative) and 1 (positive)
  • Update the item with the sentiment score

It straight forwards, but when we came to the posting and getting information from the Cognitive Services with Microsoft Flow we had some issues.

Here some issues we had:

First of all: Posting to the service. We need authentication before we can post the tweet. Below the settings of the HTTP post. Just update your Subscription key and you can connect



The second part was more ‘complex’ and we did a lot of testing/debugging, the solution of course was simple….

We need to get the score out of the answer, in stead of storing the whole document. After a lot of testing we created the following settings in Microsoft Flow:


After putting the above into Microsoft Flow property, Flow updates the ‘code’ to the following (last item):


After that we now get the score of a tweetthe cognitive services directly back into a SharePoint list. There is one catch, you need to add a space before the “documents.score” element in the above screenshot, else I will not work…

Below the scores in the list, close to 1 the tweet is positive: