Integrating Power Virtual Agents with AI Builder

  • Introduction
  • Scenario
  • Implementation
  • Create Power Automate
  • Test the Bot
  • Summary

 

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 the feedback from end user about the food and services. We will expand the basic chat implementation to accept the feedback and do a sentiment analysis using AI builder to categorize the negative feedbacks 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 few trigger words.

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

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

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 – Analyze positive or negative sentiment in text to which we will pass the user feedback as the input.

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.

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. 

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

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:

Test the Bot

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

 

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

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.