Provide Sentiment Analysis through Chatbot by using Power Virtual Agents

Photo by Jason Leung on Unsplash

Power Virtual Agents (VA) is one of the Microsoft Power Platforms that provide the ability to build chatbots in a code-less graphical environment without the need for data scientists or developers. In another word, it enables everyone to be a chatbot developer.

On this occasion, I would demonstrate how to build a chatbot to provide a sentiment analysis prediction. There are two Power Platform services we are going to use here: Power Virtual Agent and Power Automate.

Let’s go dive in!

Create the Chatbot

First, let’s go to the Power VA homepage here. Take a look at the top-right of the website, choose the bot icon.

Choose bot icon

On the bot dashboard, go to the Topics menu. Next, choose New topic to create a new topic. We are going to use this topic to provide the sentiment analysis service.

Create a new topic

Name the topic with “Analyze Sentiment” or anything else that represents the topic. Then, add several phrases on the Trigger phrases. When you have set all the phrases, you could close the pane.

Add Trigger phrases

Now, on the canvas, if you have another node after the Trigger node, you could delete it first. Then, add a Question node after the Trigger node.

Set Identify on the Question node to User’s entire response. To make it easier on the next development process, specify a variable name on the Save response as part.

The canvas now would look like the below image.

Add Question node

Under the Question node, add an Action node by choosing Call an action. On the pop-up, choose Create a Flow.

Add an action

You would be redirected to the Power Automate website to create a flow. We are going to use this flow to provide the sentiment prediction by using AI Builder.

The initial workflow would look like this one.

Power Automate initial workflow

On the Power Virtual Agents step, click Add an input. Choose the type of user input as Text. Next, set the title and fill in the description.

Between the Power Virtual Agent step and Return value(s)… step, insert another step by choosing Add an action. Search for “sentiment” in the search box, then choose the one provided by AI Builder.

Choose Sentiment Analysis service from AI Builder

You could choose your preferred language as the language the AI would use as the based language to predict sentiment. Here, I select English as the language. For the Text field, choose to_analyze.

Configure Language and Text

Next, add a Text output on the Return value(s)… step. Enter Result as the title and select Overall text sentiment as the response’s value.

Configure Return value

As the last step on the Power Automate, rename your flow as your preference and then save the flow.

Back to the Power VA canvas, on the Action node, choose the flow we just created. Set the rest as the below image.

Configure action node

After that, let’s return the sentiment prediction result to users. Add a Message node and write a message to be provided to the user. The prediction value is accessible through a variable called Result. You could add the variable by choosing the variable icon.

Set Message node

We are all set! You could modify and add other nodes to the topic to give a better user experience. Now, let’s test our bot!

Test the Bot

We could test our bot by using the Test bot pane on the left. If the pane is not visible, you could click Test your bot on the bottom-left of your screen. Here is my test result.

Test bot result
Test bot result

Publish the Bot

Power VA provides the ability to publish the bot into a live accessible environment.

Now, go to Publish menu through the left pane. Then, hit the Publish button and wait for the bot to be published. We could view our bot through a demo website through the demo website hyperlink.

Publish the bot

We could also deploy the bot through several channels such as Facebook Messenger, Microsoft Teams, Telegram, and many others.

Available Power VA channel connection

The Demo website channels could also be customized. We could then share our bot by sharing the link provided in the Share your website area.

Customized demo website

Here is what my demo website looks like. It is accessible here.

Published bot in the demo website channel

Analyze the Bot Performance

As our users grow, we could then analyze the bot performance. Go to the Analytics menu on the left pane. Here is my bot performance after several uses on the demo website.

Analyze bot performance

Conclusion

This sentiment analysis chatbot is just one of the implementation of Power Virtual Agents. Interesting, isn’t it?

And, there are many more possibilities when we build a chatbot in Power Virtual Agents. Here are several references you could use to explore Power VA.

--

--

--

An Information Systems student at the University of Singaperbangsa Karawang. Focus on exploring about Data Science, Cloud Computing, and FLOSS.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Revisiting DCT Domain Deep Learning

How to train your own YOLOv3 detector from scratch

A Primer on Supervised and Unsupervised Machine Learning Models

Machine Learning & Its Application in Our Daily Lives

GAN Inversion: A brief walkthrough — Part IV

Supervised Learning — Support Vector Machine

Confusion Matrix and Accuracy vs Precision vs Recall

TensorFlow 2 Object Detection API using Custom Dataset

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Ahmad Maulana

Ahmad Maulana

An Information Systems student at the University of Singaperbangsa Karawang. Focus on exploring about Data Science, Cloud Computing, and FLOSS.

More from Medium

Basic Chatbot in NLTK and RASA

Bot and 360 Employee Review

Photo by Christina Morillo from Pexels: https://www.pexels.com/photo/two-woman-in-black-sits-on-chair-near-table-1181605/

How to Extract Data from Any Government Website?

Transfer Learning: Summarizing Medical Documents