Integrating Power Virtual Agents with AI Builder

Introduction

With Power Virtual Agents, the use cases are limitless, and based on the requirements we can keep pushing the boundaries of its abilities. By integrating Power Virtual Agents with Power Automate and AI builder we can further expand the horizons of its usage by leaps and bounds.

In this article, we will see how to leverage AI builder and make use of Sentiment Analysis to analyze the textual feedback from the user

Scenario

We have a requirement where we have a Restaurant app that accepts feedback from end-user about the food and services. We will expand the basic chat implementation to accept the feedback and do sentiment analysis using AI builder to categorize the negative feedback so that instantaneous actions can be taken on those feedbacks by the management.

Implementation

We will create a SharePoint List with Title and Feedback Sentiment columns to house the details from the user conversation. Let’s create a basic bot and create a new blank topic to which we will add a few trigger words.

Graphical user interface, text, application, email

Description automatically generated

We will then greet the user and ask for the feedback so that we can capture it for further analysis

Graphical user interface, application

Description automatically generated

Now, let’s create a Power Automate by clicking on Call an Action which will open the Power Automate window.

Graphical user interface, application

Description automatically generated

Create Power Automate

Let’s add an input parameter in the Power Automate so that we can accept the user response for analysis. Followed by that, we will add the AI Builder action – Analyse positive or negative sentiment in the text to which we will pass the user feedback as the input.

Graphical user interface, text, application, email

Description automatically generated

We will declare 2 variables, one to store the overall sentiment of the feedback and the next to store the response for the respective sentiment.

Graphical user interface, text, application, email

Description automatically generated

We will then add a Switch statement On the Feedback sentiment variable and add 3 case branches

In the first branch, if the feedback is positive, we will assign a Positive Thank You response that the bot will say in return. If the feedback is negative, we will add an apologetic response for the bot and sent a mail to the management escalating the issue. As the default case, the sentiment is neutral, and we share a neutral response back to the customer.

A screenshot of a computer

Description automatically generated

Finally, we will save the record to the SharePoint List and return the Bot Response to the Power Virtual Agent.

Graphical user interface, text, application, email

Description automatically generated

Heading back to PVA, we will add the recently created flow and pass in the User Response and get back the bot response as below:

Graphical user interface, text, application, chat or text message

Description automatically generated

Test the Bot

Let’s test the bot implementation by providing negative feedback. The AI builder analyses the response and categorizes it as negative and shares the appropriate apologetic response back to the user

Graphical user interface, text, application

Description automatically generated

Now let’s try out positive feedback and we receive back the exciting positive response from the bot

Graphical user interface, text, application

Description automatically generated

Summary

Thus, we saw how to plug in the AI Builder with Power Virtual Agents to analyze the user conversation using sentiment analysis and respond back accordingly to the user.

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