lectio-uninapoli-2021

Introduction

Contents

CREATE YOUR FIRST BOT

Before you start creating bots, it is important to consider what the bot will be used for. For example, you might use the bot to handle account inquiries, or you could use it for self-service support cases such as knowledge base access. Knowing how you plan to use the bot will help you define and plot out conversation paths and determine how many topics the bot will handle.

Once you have in mind this, it's time to create the Bot.

In order to create a Bot on Power Virtual Agent, follow these steps:

  1. Go to https://powerva.microsoft.com/
  2. Click on the Bot icon on the right side of the page:
  3. Chose the environment where the Bot will be created and click on the "New Bot" button

image

  1. On the window that appear, chose a name for the Bot, select the language and check that the environment is the right one. Then click the "Create" button.

image

  1. Wait for few minutes and the Bot is created

CREATE AND MANAGE TOPICS

In order to create a new topic on Power Virtual Agent follow these steps:

  1. Click on the Bot icon on the right side of the screen and ensure the Bot you are working on is the right one:

image

  1. Click on "Topics" on the left side of the screen:

image

  1. Click on "New Topic":

image

  1. On the Setup window, give a name to the topic and add as many "trigger phrases" as you prefer.

Trigger phrases represent all the phrases that the user can type when chatting with a Bot to activate a specific Topic and execute all the actions built on that topic.

image

  1. Once added all the trigger phrases, click on "Go to authoring canvas" on the right side of the screen:

image

  1. Once on the authoring canvas, here you can start to build all the actions the Bot should perform once activated. In order to build these actions, under the trigger phrases box, click on the "+" sign to add a node:

image

  1. Choose the action you want to build by selecting one of the actions listed:

image

ACTIONS AVAILABLE IN PVA

When you are authoring a specific topic, there all several type of actions you can add to build the Bot behavior.

Here you find a list of all of them:

  1. Ask a question
  2. Add a condition
  3. Call an action
  4. Show a message
  5. Go to another topic
  6. End the conversation

ASK A QUESTION

This action let you type a specific question to the user and offers different possibilities on how to ask it by specifying the "Identify".

Following a short guide of how to do it and the different identify possibilities:

  1. Go to https://web.powerva.microsoft.com/
  2. Click on "Topics" in the menù on the left side of the screen:

image

  1. Choose a topic where add the action or create a new topic:

image

  1. Click on "Go to authoring canvas":

image

  1. Click on the plus sign (add a node):

image

  1. Click on "Ask a question":

image

  1. Type the question:

image

  1. Select the identify you prefer from the ones listed

image

  1. Click on the pen icon to edit the name of the variable in which you will save the response of the user:

image

  1. Give a name to the variable and decide if you want to make it available also in other topics or limit the scope to the topic you are working on clicking on one of the two options in the "usage" section

image

  1. Save the topic by clicking on the save button on the upper right side of the screen

image

ADD A CONDITION

This action will let you to specify the action the Bot should perform depending if the condition is satisfied or not.

Usually the condition is automatically built by Power Virtual Agent when you choose to use the "ask a question" action with the "multiple choices" option according to the different choices.

Following a short guide of how to do it and the different identify possibilities:

  1. Go to https://web.powerva.microsoft.com/
  2. Click on "Topics" in the menù on the left side of the screen:

image

  1. Choose a topic where add the action or create a new topic:

image

  1. Click on "Go to authoring canvas":

image

  1. Click on the plus sign (add a node):

image

  1. Click on "Ask a question":

image

  1. Type the question, choose the "multiple choices" identify and type the different choices:

image

  1. Click on the pen icon to edit the name of the variable in which you will save the response of the user:

image

  1. Give a name to the variable and decide if you want to make it available also in other topics or limit the scope to the topic you are working on clicking on one of the two options in the "usage" section

image

  1. Once added the options for the user, Power Virtual Agent will automatically build the conditions based on the name of the city variable. As you can see, in the condition box you will find the name of the variable (you can change the variable you want to use), the condition statement that determines the expression of which the condition is based on (you can change it as you prefer) and finally the option chosen by the user.

image

  1. By clicking on the plus sign (add a node) you can define the next action the Bot should perform if the condition is satisfied:

image

CALL AN ACTION

This action will let you to create or add a Power Automate flow to the Bot which will perform a series of actions based on what you need.

It is usually used to integrate different technologies such as SharePoint, QnA Maker, LUIS etc. to the PVA Bot.

Following a short guide of how to do it and the different identify possibilities:

  1. Go to https://web.powerva.microsoft.com/
  2. Click on "Topics" in the menù on the left side of the screen:

image

  1. Choose a topic where add the action or create a new topic:

image

  1. Click on "Go to authoring canvas":

image

  1. Click on the plus sign (add a node):

image

  1. Click on "Call an action":

image

  1. If you have already created your flow, you will find it in the list of available flows. You need just to click on its name.

image

  1. Once added, if required, select the variable from which the flow will take the input as trigger

image

  1. If the flow is not yet created, you can create a new one by clicking on "Create a flow"

image

  1. You will be redirected in the Power Automate page with a Power Virtual Agent flow template

image

  1. Click on "Add an input" to add the input from PVA as flow's trigger

image

  1. Choose the input type you are interested in from the ones showed

image

  1. Click on the plus sign to insert a new step to perform some actions.

image

  1. In this case we have added a Sharepoint "Create item" action

image

  1. Add an output to return it on Power Virtual Agent

image

  1. Choose the output's types to return from the ones showed

image

  1. In this case we have decided to return the "Title" from the Sharepoint item just created

image

  1. Rename the flow and then click on the "save" button

image

  1. Once saved, come back on PVA page and click on the flow just created

image

SHOW A MESSAGE

This action will let you to create a message that the Bot will show to the user.

It is usually used to communicate something to the user

Following a short guide of how to do it and the different identify possibilities:

  1. Go to https://web.powerva.microsoft.com/
  2. Click on "Topics" in the menù on the left side of the screen:

image

  1. Choose a topic where add the action or create a new topic:

image

  1. Click on "Go to authoring canvas":

image

  1. Click on the plus sign (add a node):

image

  1. Click on "Show a message":

image

  1. Type the message you want to show to the user

image

  1. You can also insert a variable to the message by clicking on the {x} and choosing the variable you are interested in from the ones listed

image

  1. You can also modify the layout of the message by clicking on the different options available as showed:

image

GO TO ANOTHER TOPIC

This action will let you to jump between topics.

It is usually used when specific actions that the Bot should perform are contained in other topics (created by you or system topics).

Following a short guide of how to do it and the different identify possibilities:

  1. Go to https://web.powerva.microsoft.com/
  2. Click on "Topics" in the menù on the left side of the screen:

image

  1. Choose a topic where add the action or create a new topic:

image

  1. Click on "Go to authoring canvas":

image

  1. Click on the plus sign (add a node):

image

  1. Click on "Go to another topic":

image

  1. Choose the topic you are interested in from the ones listed and click on it:

image

  1. Once clicked, it will be represented as following:

image

END THE CONVERSATION

This action will let you to end the conversation with the user in two ways:

  1. With a survey
  2. Transfer to an agent

Ending the conversation with a survey will let you to collect the user experience.

Ending the conversation with the transfer to an agent is used when probably the Bot is not capable to run a user's need and you want to send the request to a live agent.

Following a short guide of how to do it and the different identify possibilities:

  1. Go to https://web.powerva.microsoft.com/
  2. Click on "Topics" in the menù on the left side of the screen:

image

  1. Choose a topic where add the action or create a new topic:

image

  1. Click on "Go to authoring canvas":

image

  1. Click on the plus sign (add a node):

image

  1. Click on "end the conversation":

image

  1. Choose between the two options available

image

  1. In case you choose to end with a survey, it will be showed as following:

image

  1. In case you choose to "transfer to an agent", you will be able to specify a message that recap the user need so that the live agent will have all the info required

image

TEST YOUR BOT

Because a bot is made up of multiple topics, it is important to ensure that each topic is working appropriately and can be interacted with as intended. You can test your bot in real time by using the test bot panel, which you can enable by selecting Test your bot at the bottom of the side navigation pane. When the panel displays, the button name changes to Hide your bot so that you can hide it if more space is needed during the design process.

In order to do so, follow these simple three steps:

  1. Click on "Test your bot" button on the left bottom side of the screen:

image

  1. Type a phrase or a word and check if the Bot is performing as expected:

image

  1. If it is not performing well, check the topic that is not working and adjust it till it works as expected

By testing your bots often throughout the creation process, you can ensure that the conversation flows as anticipated. If the dialog does not reflect your intention, you can change the dialog and save it. The latest content will be pushed into the test bot, and you can try it out again.

PUBLISH THE BOT

After your bot content has been created, it needs to be published so that customers can engage with it. Published bots can be made available across multiple platforms and channels. Before a bot can be added to channels, interacted with, or used by team members, it will need to be published at least once.

Publishing bots as you make changes also ensures that customers are engaging with the latest bot content. When you are ready to publish your bot, select the Publish tab on the side navigation pane. During the publishing process, the bot will be checked for errors. Bot publishing typically takes a few minutes. When the publish is successful, the top of the page will display a green banner indicating that everything worked correctly. If errors are detected, you will be notified through a message that is displayed in the application.

Here a short guide on how to do it:

  1. Click on the "Publish" section on the Menu on the left side of the screen:

image

  1. On the appearing screen, click on the "Publish" button:

image

  1. On the appearing window, click again on the "Publish" button:

image

  1. Once published, you will be noticed with a green bar at the top of the page:

image

INTEGRATE THE BOT IN A DEMO WEBSITE

Before the bot is deployed to the different channels that use it, you might want to gain feedback from other team members. When a bot is first published, it can be made available to the demo website. You can provide the demo website's URL to team members or stakeholders to try it out. The advantage of using the demo website is that the experience is different than testing the bot during the design process. Because the test bot experience is only intended to allow bot authors to test it, the demo website link increases the pool of users that can test and provide feedback that is related to the overall experience of the bot.

To add a bot to the demo website, select the demo website link under Share your bot. This webpage demonstrates what your bot looks like to a user who comes to your webpage. The bot canvas is at the bottom. You can interact with it by entering text in the window or by selecting a starter phrase from the provided options.

image

INTEGRATE THE BOT IN MICROSOFT TEAMS

Power Virtual Agent Chatbots can be easily integrated in other Microsoft applications like Microsoft Teams or third-party applications like Facebook, Slack etc.

Here a short guide on how to integrate the Bot in Microsoft Teams:

  1. Click on the "Manage" section on the Menu on the left side of the screen:

image

  1. Click on "Channels"

image

  1. Select "Microsoft Teams":

image

  1. On the appearing window, click on the "Turn on Teams" button

image

  1. Now you will be able to use your Bot on Microsoft Teams. Keep in mind that with this operation only you will be able to use the Bot in Teams. In the next steps you will see how to find and use it.

image

  1. Go on Microsoft Teams application
  2. Click on the three dots on the left side of the screen:

image

  1. You will be able to find it in the recent apps. If not, type the name in the search box and then click on the application:

image

  1. Use the Chatbot:

image

  1. In order to make the Bot available to all the Organization's users, in the step 10 click on the "Submit for admin approval" button and wait for the administrator approval:

image

  1. Once approved, go on Microsoft Teams
  2. Click on the "Apps" button on the left side of the screen
  3. Type the name of the ChatBot in the search box
  4. Once find it, click on it
  5. Click on the "Add" button

INTEGRATE A COGNITIVE SERVICE (QNA MAKER) IN A PVA CHATBOT

In order to create a Knowledge Base on QnA Maker service, follow these steps:

  1. Go to the QnA Maker service clicking on this link: https://www.qnamaker.ai/

  2. Click on Create a Knowledge Base

image

  1. On the Create page, skip Step 1 if you already have your QnA Maker resource.

If you haven't created the resource yet, select Create a QnA service. You are directed to the Azure portal to set up a QnA Maker service in your subscription. Remember your Azure Active Directory ID, Subscription, QnA resource name you selected when you created the resource.

image

image

image

image

  1. When you are done creating the resource in the Azure portal, return to the QnA Maker portal, refresh the browser page, and continue to Step 2 selecting your Active directory, subscription, service (resource), and the language for all knowledge bases created in the service.

image

  1. In Step 3, name your knowledge base

image

  1. In Step 4, add a URL or a file (which represent the Knowledge Base you want to refer to) and set the Chit-chat as you prefer

image

image

  1. In Step 5, click on Select Create your KB.

image

The extraction process takes a few moments to read the document and identify questions and answers.

After QnA Maker successfully creates the knowledge base, the Knowledge base page opens. You can edit the contents of the knowledge base on this page.

image

ADD A NEW QUESTION AND ANSWER SET

In order to add new questions and answers on the Knowledge Base, follow these steps:

  1. In the QnA Maker portal, on the Edit page, select + Add QnA pair from the context toolbar.
  2. Add a question as the following example:

How many Azure services are used by a knowledge base?

  1. Add the answer formatted with markdown as the following example:

* Azure QnA Maker service\n* Azure Cognitive Search\n* Azure web app\n* Azure app plan

The markdown symbol, *, is used for bullet points. The \n is used for a new line.

The Edit page shows the markdown. When you use the Test panel later, you will see the markdown displayed properly.

image

SAVE AND TRAIN

In the upper right, select Save and train to save your edits and train QnA Maker. Edits aren't kept unless they're saved.

image

TEST THE KNOWLEDGE BASE

To test the already created KB, follow these steps:

  1. In the QnA Maker portal, in the upper right, select Test to test that the changes you made took effect.
  2. Enter an example user query in the textbox.
  3. Select Inspect to examine the response in more detail. The test window is used to test your changes to the knowledge base before publishing your knowledge base.
  4. Select Test again to close the Test panel.

image

PUBLISH THE KNOWLEDGE BASE

When you publish a knowledge base, the contents of your knowledge base move from the test index to a prod index in Azure search.

In the QnA Maker portal, select Publish. Then to confirm, select Publish on the page.

The QnA Maker service is now successfully published. You can use the endpoint in your application or bot code.

HOW TO INTEGRATE A KNOWLEDGE BASE FROM QNA MAKER TO POWER VIRTUAL AGENT BOT

Once published, it is now the time to integrate the Knowledge Base to a Power Virtual Agent Bot.

Here a short guide on how to do it:

  1. Go back to the PVA Chatbot page
  2. Click on Settings (gear icon on the upper right side of the screen):

image

  1. Click on System fallback:

image

  1. On the appearing window, click on Add

image

  1. Once added, click on Go to fallback topic

image

  1. On the fallback topic, click on Go to authoring canvas:

image

  1. Click on the plus sign

image

  1. Click on "Call an action" and then on "Create a flow"

image

  1. Click on Templates and leave this page

image

  1. Look for "QnA" and select the template showed " Generate answer using QnA Maker knowledge base from Power Virtual Agent"

image

  1. Establish the connection with QnA passing the parameter asked in the following image.

The name of the connection can be chosen as you prefer. The two remaining info can be taken on the QnA Service as described in the next step.

image

  1. On the QnA service, go to the "settings" of the Knowledge Base". Copy the info underlined in red and paste it to Power Automate QnA connection and click create

image

  1. On the flow that appear, insert the parameter on the "Generate Answer" block. On the next step will be showed the info to insert

image

  1. On the QnA service, always on the setting page, copy the info underlined in red and paste them on the previous step:

image

15) Once inserted the info, rename the flow and save it

image

  1. Click on Solution on the left side of the screen and then click on "New Solution"

image

  1. Give a name to the solution and select a Publisher. Then select "Create"

image

  1. Select the solution just created, click on the three dot and then click on edit

image

  1. Click on "Add existing" and then click on "Cloud Flow"

image

  1. Look for the flow previously created on the Outside Solution, select it and then click on Add

image

  1. Once added to the solution, go back to the Power Virtual Agent Fallback topic, click again on "Call an action" and then select the flow created:

image

  1. As input text, select "UnrecognizedTriggerPhrase":

image

  1. On the message, select the "Final Answer" variable and save the topic. It will show the answer taken from the QnA Knowledge Base.

image

Agenda

  1. Presentation
  2. Introduction
  3. Create your First Bot
  4. [Q&A]