Share via


AI Builder: Extract Email Sentiments using a Prebuilt model

  • Introduction
  • Business Use Case
  • Implementation
  • Test the flow
  • Summary

Introduction

AI Builder is a Power Platform capability that provides you the AI models to take leverage of artificial intelligence to optimize your business as well as automate process. We can either use the already existing prebuilt models that suits our needs to use the Power of AI in Power Apps or Power Automate or create our own custom AI models to suit some specific business needs. You can read more about AI Models in the Official documentation here. The out of the box prebuilt available models in AI Builder are:

  • Business card reader    
  • Category classification     
  • Entity extraction                   
  • ID reader
  • Invoice Processing          
  • Key phrase extraction     
  • Language detection              
  • Receipt processing            
  • Sentiment analysis                
  • Text recognition                    
  • Text translation      

In this article we will see how to use the AI Builder Model Sentiment Analysis to analyze the sentiment of a text and take necessarily follow up actions

Business Use Case

We have a requirement where we have a mailbox that is used to receive feedback about the products sold by the company and it is an unattended mailbox that serves the sole purpose of receiving feedback mails. We need to ensure that we have a system in place that reads every single incoming mail and extract the sentiment of the feedback and if it is a negative feedback , escalate it to the supervisor for a follow up action.

Implementation

We will use the When a new email arrives trigger to kickstart the flow in response to the event. Then we add the AI Builder action – Analyze positive or negative sentiment in text to the flow.

We will get the body of the email and assign it to the text field of the action which will be used by the model for sentiment analysis

The output of the action will be sentiments related information and we can use 10+ such output values for further processing. More detailed information on the outputs from the AI Build Model is described here

We will be saving the sentiment as well as the text of the email body as a SharePoint list for record keeping. As the email body will be containing HTML tags, lets convert it to plain text using the action – Html to text

We will then use the Create Item action to create a new list item with the below values:

  • Title: Email Subject
  • Email Body: Output of the Html to text action
  • Feedback Sentiment: Dynamic Output Overall Text Sentiment from the AI Builder action

 

Finally, we will add a condition check to see if the Sentiment is negative and in that case sent an escalation mail to the supervisor to take necessary action on the feedback

Thus, the overall flow would look like:

Test the flow

Let’s sent out a negative feedback mail to the mailbox and this will trigger the flow which will use the email body as input for sentiment analysis model

 

The sentiment for the text has been analysed as negative by the AI model and an escalation mail has been triggered.

 

Now lets sent out a positive feedback mail

and we can see that the sentiment analyzer has captured the feedback accordingly:

Both above feedback details have been captured and created as a list item for further record keeping.

Summary

Thus, we saw how to use the Sentiment Analysis AI Builder Model to analyze the feedback of email body and take corrective measures in case of a negative feedback.