Creating your first Microsoft Power Virtual Agent (PVA chatbot)

Creating your first Microsoft Power Virtual Agent (PVA chatbot)

Chat bots are an easy way for users/customers to get help, get things done, and/or explain stuff using a textual response system. Nowadays most companies have some kind of chatbot on their internet site to help customers communicate with the company and help them get basic information or schedule an appointment. The definition by the Oxford Dictionary is:

A chatbot is a “… computer program designed to simulate a conversation with human users, especially over the Internet.”
Oxford Dictionary

In a previous post, I explained how to create a Power Virtual Agent environment (and if it doesn’t work how to work around a possible issue).

Power Virtual Agent or Azure Chat bot what’s the difference

When you look at the Microsoft cloud portfolio there are 2 types of chat bots. The chat bots that you can use via the Power Automate platform (Power Virtual Agents) and the chat bots you can use via the Azure Bot Framework.

The principal difference is with Power Virtual Agent you use no-code to develop the chatbots, which is very easy to use, as I will demonstrate in this blogpost. When you are developing using Bot Framework (Azure Bot Services) you will use code to develop the chatbot with specific technologies (C#/Nodejs). 

Power Virtual Agent Licensing

The PVA platform is built as part of the Power Automate platform so the licensing of the platform is similar. You can read all about the licensing here: Get access to Power Virtual Agents – Power Virtual Agents | Microsoft Learn. The bottom line there is a version of PVA included in selected Office 365 subscriptions but that has only standard connectors to different applications. This means it has the same limitations as Power Apps so it can only connect to a subset of standard applications (e.g. you can export stuff to Excel but you can’t create a Word document using PVA standard licensing). Furthermore, you can only use it inside a teams environment. Then there are 2 paid plans where you have premium connectivity so you can connect to a lot more applications and you can also use it for websites etc.

Creating your first PVA (chatbot)

For this demo we will create a bot that can send a helpdesk ticket to JIRA. After creating your Power Virtual Agent environment you can log on to:https://web.powerva.microsoft.com/. After logging on you are on the main site. here you can create topics or use one of the existing topics. In this case, we are going to create a new bot so we have a fresh start. To do this click on the robot icon in the top right and then click new bot.

In this example we are going to create a chatbot and call it Dude (you know from the movie Free Guy :-)).

After about 10 seconds a new instance for Dude is started. After clicking on topics you see the list of default topics that are available in the chatbot.

If you want to switch between bots you can also click on the bot icon and on the bottom you will see all the chat bots you have an select between them.

To help Dude shine we will disable all the default lessons, you can disable them by clicking on the status and setting it from on to off.

After disabling all the default topic click on new topic. You are greeted with a flow you can fill in starting with trigger phases. These phases will help the bot understand when his help is wanted. For dude we can add several phrases.

Click on the trigger phrases rectangle and fill in the trigger phrases. In this case they are Help, my computer doesn’t work, can I create a helpdesk ticket and ticket please.

After that we need to think of a response for Dude so the customer feels his issue is heard.

The response Dude will give you can read it up here.

After that we give the user a choice perhaps he doesn’t have an issue with his computer but there is another issue. To facilitate that click on the plus sign beneath the message

You will be asked what the next step is going to be.

You can:

  • Ask a follow up question, (e.g. is it your laptop or your phone)
  • Add a condition (e.g. yes/no statement),
  • Call to action (start a Power Automate flow)
  • Show a message (e.g. give extra information, like there are issues with the financial system)
  • Redirect to another topic (you can redirect them to another topic, if you have another topic like maintanace for broken desks etc. you can redirect the user to that flow if needed)
  • Or end the conversation (Dude will end the conversation and leave you to it)

In this case the next step would be a question (we need to know if the user has an issue with his computer

After typing in the question you can create a multiple-choice field for the users, there are a lot more types of questions you can ask and you can change the identify portion to reflect what you want to know (e.g. residential information). The PVA will store this information in the correct format so you can use it in a Power Automate flow or give information back to the user.

Next step is to follow up both conditions.

First let’s start with the easy one, if the user chooses No the PVA will redirect the user to a phone number and email address.

You can also handoff to a live agent and/or conclude with a survey but that’s something to cover in another post.

If the user selects yes, the next step is to let the user explain what’s wrong, if you look at the identify portion User’s entire response is selected and this response is captured in a variable that we can use later in the Power Automate flow to place into Jira. If you click on the computerissue (in this example) variable you can get more information and rename the variable as needed (so you can understand what its doing).

Next step is to start a Power Automate flow to get this information into Jira.

Small tip. You can’t use an already created Power Automate flow that is used for e.g a Power App, because the initiating and return value is not to a Power App but a Power Virtual Agent you have to rebuild it.

I have made another post on how to create a Jira instance and how to connect to it using Power Apps so you can read that article for a more in-depth explanation of those topics. Once you click the create flow button you will be redirected to the Power Automate portal to create a flow based on the Power Virtual Agents Flow Template.

First we need to create the connector to Jira. To do that click on the plus sign beneath the Power Virtual Agents

And select add an action. The screen for the operation will be added to the flow and you will be asked to input the information for the connection to the JIRA instance

Type in JIRA and selecte the create a new issue (V2), be aware this is a premium connector so you need a paid subscription to the PVA to use this!

Fill in the required information. For testing you can fill in a standard username but in production, you might want to have this field populate the Office 365 UPN of the user so the user logs the ticket in his own name. I will add how this works to this blog in the near future.

After creating the connection you will be asked what project you want the issue added to, what the issue type is and what the text is that should be added.

The input field is the field we created in the PVA flow where the user gave their issue information

The output from the connection to JIRA is the Issue ID and/or the Issue Key which we can pass back to the PVA to give to the user for more information:

This will result in this Power Automate flow.

To rename the flow click on the name and give it a logical name you can remember and that it explains what is does :-).

In my case: PVA – Dude – Create JIRA Issue

After clicking the save button on the bottom of the screen you can click the back button to go back to the overview screen of the Power Automate flow.

Next step is to connect the Power Automate flow to the PVA. To do that reopen the the selection screen so you can select the correct Power Automate flow

Next step is to let the user know all is well and the ticket is logged.

If you look at this part of the flow you see that input (needed in the Power Automate flow) gets its value from the computerissue variable which is created from the user input. at the bottom you can see there is a hyperlink to the corresponding JIRA queue. You can rename the PVA topic to something you can understand/remember.

Next step is to test the bot you can do that on the screen on the left. If you type one of the trigger phrases in the type your message box the flow should start

You can also check JIRA to see if the ticket is created.

and what do you know it works! Next step is to publish this bot into teams/website etc.. to do this go to the publish tab on the left.

Here you can choose where to publish Dude :-). Click on the publish button and the PVA will be public

Next click on channels on the left to see where you can add your bot. In this case we are using Microsoft teams so click on the teams button

After clicking on teams you are asked if you are sure you want this.

Click on Turn on Teams to enable Dude to be visible in teams. After its visible you can change several things (icon, name, etc.) So for esthetic purposes lets change the picture to reflect Dude the way he is. To do that click on edit details.

Click on change icon

Search for a png with max 30kb size and upload it.

Click on save. Next select avalibility options to make Dude available for all users.

Next step is to choose how Dude should be made available to the users

If you want to make it available organisation wide, one of the teams admins will have to approve it. For testing you can put in the teams store so they can select it if needed. We’ll choose that option for now.

Click on share, it should become visible in the teams store.

After logging into teams go to the three dots on the left and select more apps then select build with power platform, dude should be available there

After clicking on Dude you can add it to your teams environment

After dadding Dude to teams you can use it to file tickets in JIRA.

Have fun playing with PVA, if you have any questions hit me up on twitter @gkunst. And I hope to update this blog and create the rest of the series that I have in mind soon.

Leave a Reply