cancel
Showing results for 
Search instead for 
Did you mean: 

Walk through Using the Sentiment Analysis Action from MIcrosoft Flow and PowerApps

AI Builder has some amazing features. This walk through will get you started with using AI Builder sentiment analysis from Flow and PowerApps. 

 

Please note: at the time of this publishing you can not reference a Flow from PowerApps in a solution....but this should be resolved soon!

The steps: 

 

  1. Login to PowerApps


  1. Navigate to Solutions

     


 

  1. Create a new Solution

  1. Open your Solution

  1. Add a new Flow

  1. Set the trigger to PowerApps. Note I also named the flow at this step: “Sentiment from PowerApps”

  1. Add the “Predict” action to the Flow.

    Note: if you don’t see the “Predict” action, you are likely NOT in a solution. NOTE this is required!!!!!!!!!!

  1. Set the model to “SentimentAnalysis Model”

    Note: the other AI Builder Models I had created and available to the Flow

  1. Insert the following Text into the Request Payload

    {“text”:”My Text”, “language”:”My Language”}

     

    This from https://docs.microsoft.com/en-us/ai-builder/flow-sentiment-analysis (watch those evil smart quotes!)

     

    For the action strings supported please see: https://powerusers.microsoft.com/t5/AI-Builder/Language-Support-for-Sentiment-Analysis/m-p/378125#M8...
  1. en
  2. fr
  3. it
  4. ja
  5. zh-Hans
  6. zh-Hant

 

 

  1. Replace the “My Text” argument with Ask in PowerApps by clicking the “Ask in PowerApps” shape in the bottom of the action

  1. Replace the “My Language” argument with Ask in PowerApps by clicking the “Ask in PowerApps” shape in the bottom of the action

 

  1. Add a new Step and add the Parse JSON action

  1. Specify the content as the Response Payload. Specify the schema as the JSON below.

JSON for the Schema: 

(Also can be found here: https://docs.microsoft.com/en-us/ai-builder/flow-sentiment-analysis)

 

 

{

“type”: “object”,

“properties”: {

“predictionOutput”: {

“type”: “object”,

“properties”: {

“result”: {

“type”: “object”,

“properties”: {

“sentiment”: {

“type”: “string”,

“title”: “documentSentiment”

},

“documentScores”: {

“type”: “object”,

“properties”: {

“positive”: {

“type”: “number”

},

“neutral”: {

“type”: “number”

},

“negative”: {

“type”: “number”

}

}

},

“sentences”: {

“type”: “array”,

“items”: {

“type”: “object”,

“properties”: {

“sentiment”: {

“type”: “string”

},

“sentenceScores”: {

“type”: “object”,

“properties”: {

“positive”: {

“type”: “number”

},

“neutral”: {

“type”: “number”

},

“negative”: {

“type”: “number”

}

}

},

“offset”: {

“type”: “integer”

},

“length”: {

“type”: “integer”

}

},

“required”: [

“sentiment”,

“sentenceScores”,

“offset”,

“length”

]

}

}

}

}

}

},

“operationStatus”: {

“type”: “string”

},

“error”: {}

}

}

  1. Add a PowerApps Response Action to the Flow

  1. Set the PowerApps Response to return an output a text value that is documentsentiment object from the parse JSON action.

  1. Save flow
  2. Go back to Solutions

  1. Add a new Canvas App. ( in this is a Phone form factor…but it isn’t really that important)

  1. Add a button and a Text Input and a button control

 

  1. Add a label control and set the text equal to mysentiment.sentiment

    PowerApps will complain about this…ignore for the time now.

  1. Select the button you added above and select the menu “Actions”, select Flows then select the Flow you created above.

NOTE: This is currently not working as Flows can not be referenced from a PowerApps in a Solution.

It is working in our staging environment and should be working soon! (Where the screen shots were taken)

  1. And here it is running!

Note the AI action gives many sentiment heuristics such as the scores for each sentiment type

Meet Our Blog Authors