Quarantine Chat Bot: Let’s Build a Virtual Agent!

In these odd days of quarantine, I have spent a lot of time talking to my parents to convince them to stay home or just finding ways to keep them entertained. My mom loves this quarantine life and never has a need to leave but my dad is a bit of a different story. So, I thought I should use Power Virtual Agents to create a virtual daughter for them to chat with, because this is our new normal now. While it wasn’t super successful in occupying my parents, it turned out to be a great learning opportunity for me.

What I did

I built a simple bot that asks a few questions and then responds to them accordingly. It will first confirm which parent it is speaking too then asks that parent simple question specific to them. The text is analyzed so the bot can respond correctly to their questions. Next, it gives them an opportunity to talk about their day and emails me the details. Finally, it asks if they want to talk to me and gives the opportunity to schedule an appointment (with my approval of course!).

I learned a lot in this experiment but there are a few things I want to talk through specifically in this series:

  1. How to get started
  2. Connecting to Power Automate and using Sentiment Analysis
  3. Using Power Automate to kick off approvals and other actions
  4. Review the session data

Let’s jump right in!

Where to Start

Before creating the bot, I would suggest creating your Power Apps trial or Dynamics trial first. This is because you need a CDS environment with a database. You can create this when you create a new account on the Power Virtual Agent site but that requires a work address and does not have the option to use a personal email to set up a developer trial.

If you already have a tenant available, then you should create a fresh environment to ensure no unwanted interactions. This tip is courtesy of Éric Sauvé who also assisted me through the next bit.

Next go to the Power Virtual Agents site where you can sign in and it will guide you in creating your first bot. Make sure you sign in with the login credentials for the trial or environment you just created.

On the first page you will enter the bot name and then you should expand to choose the correct environment.

Enter a name for the bot and select the environment you just created
Enter a name for the bot and select the environment you just created

You will need to wait as everything gets provisioned. A bar at the top of the screen will tell you the current progress. This was the hardest part for me as it took a few tries for my bot to provision correctly. The hardest thing was patience!

When it is done provisioning you can jump right in! The trial bot is created with some sample topics so you can even test the functionality before building anything.

Editing Your Greeting

I got started by going to Customize Greeting. This will take you to the Greeting Topic that will trigger the bot. This shows you the trigger phrases, aka what people type in to get on this path and a visual representation of the logic and flow.

Getting Started on Power Virtual Agents
This is the first screen after your bot is provisioned. Select Customize Your Greeting to start working.

Some logic and messages are already built in and you can customize these to sound like you or remove them entirely.

Power Virtual Agent Greeting
Greeting topic is already created so you can edit and start adding on from here.

Then after those messages you can simply add your own messages or questions. I added a question with multiple choice answers. The tool will automatically add branches for each possible response, then you can keep building from there.

Power Virtual Agent Multiple Choice
Multiple Choice Questions will automatically build out a branch for each answer. Then you can build out specific return messages or actions for that branch. If the branches need to converge back together, this can be done through drag-and-drop.

For my simple use case, editing the Greeting worked for me. However in a real-life scenario you may have more potential paths than a multiple choice answer, so that’s when you would use more topics. This will be outside of the scope of what we are covering right now.

The process is a little more involved and these are just the steps to get started. Come back tomorrow to hear about the other types of answers I requested and how I acted on them with Power Automate.

One thought on “Quarantine Chat Bot: Let’s Build a Virtual Agent!

Leave a Reply