AI Builder: Extract Email Sentiments using a Prebuilt model

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 processes. We can either use the already existing prebuilt models that suit 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 necessary 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 negative feedback, escalate it to the supervisor for 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.

Graphical user interface, text, application

Description automatically generated

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

Graphical user interface, text, application, email

Description automatically generated

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

Graphical user interface, application

Description automatically generated

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, let’s convert it to plain text using the action – Html to text

Graphical user interface, text, application, table

Description automatically generated

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

Graphical user interface, text, application, email

Description automatically generated

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

Graphical user interface, application

Description automatically generated

Thus, the overall flow would look like this:

Graphical user interface, text, application

Description automatically generated

Test the flow

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

Graphical user interface, application

Description automatically generated with medium confidence

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

Graphical user interface, text, application, email

Description automatically generated

Now let’s sent out a positive feedback mail

A picture containing diagram

Description automatically generated

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

Graphical user interface, text, application, email

Description automatically generated

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

Graphical user interface, text, application, email

Description automatically generated

Summary

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

Related Articles

Author

Author

Priyaranjan KS is a Modern Workplace Architect primarily focused on developing and architecting solutions around Office 365,Power Platform and Azure.He is also a Microsoft Most Valuable Professional(MVP) and a Microsoft Certified Trainer(MCT)

Latest Articles