Blog Post

FastTrack for Azure
3 MIN READ

Building a chat bot in 2022

abot-msft's avatar
abot-msft
Icon for Microsoft rankMicrosoft
Dec 01, 2021

More and more customers adopt conversational agents to provide a chat based interaction with their end users. Typical scenarios include Question and Answer (QnA) bots for campus students, customer support bots reducing the load of the IT department or even e-shop ordering bots guiding you through various alternatives.

 

If you are looking into building a bot, the idea is to build with Power Virtual Agents (PVA) and extend with bot framework if needed. All data from PVA are stored in Dataverse which is a database as a service from the Power Platform. PVA offers analytics on top of the collected data and there is also the potential to export the data to datalake and perform further analysis if you want and you think that there is business value to do such an investment. You can also use https://aka.ms/pvaAnalytics as a base to build your own analytics on top of the dataverse data.

 

The advised way for integration with any third party system, like for example your ticketing system, is through power automate (something you may have heard in the past as Flows). There are connectors for multiple systems, and you can even use REST API. If you want, you can also implement that integration with Bot Framework Composer. Skills require a lot more effort and should be only used if there is a good technical reason, for example if you need high volume throughput, something that you may be looking at if you have at least a million requests per month. Also, the quota of power automate is included in the cost of the PVA.

 

You can have multiple PVA bots and environments, like dev/qa/prod. You can start by exporting and importing bots using solutions. The Power platform offers solutions for Application lifecycle management (ALM). The solution file is just a zip file that you can extract and you can version control and there are GitHub actions and Azure DevOps extensions to help you automate the process and build your CI/CD pipelines. The PVA product group has also created https://aka.ms/pvaArchitectureSeries which are sessions guiding you how to architect your PVA.

 

Regarding the website integration, you can use the default web site option. If you need complete control, PVA has tools that allows you to create a custom canvas. This is basically the javascript component that embeds PVA into a website. This is the advances scenario you can read in the Customize the web chat canvas article. You can see some advanced customization examples in the samples under the “Branding, styling, and customization” section.

 

Regarding multi-language support, although this is a highly requested feature, it is not currently available within the platform. For now, you can have multiple bots, one for each language and you can have an ALM process that tracks the changes on the main language bot and then implement them in the rest of the languages. To switch language on the UI side, you can do it in the javascript code. If you want to do the switch on the server side, then perhaps you can use the PowerVirtualAgentsSamples/RelayBotSample (github.com) to build the routing logic where the relay bot will be sending to the proper language. You can also base your code on this guide that puts a Microsoft Bot Framework bot in front of a PVA. Just note that this web app will effectively be the single point of failure for the bot and you have to ensure traits like high availability and scalability, that are features already baked in the PVA backends it will be talking to.

 

When it comes to QnA content, to define your exact strategy you will need to think of the following questions:

  • Do you have 1000 FAQs or 20?
  • Is it a single question with a single answer or do you have clarification questions as well, like building a decision tree?

Based on those answers, you can convert the existing content into a web page and import the topics from there as seen in this article. If you need more advanced control you can use QnA maker and import the content in various formats but this is not the advised way as more features will appear within PVA in the future.

 

Hope this helps and let us know in the comments if you have more topics you would like to ask.

Updated Dec 01, 2021
Version 1.0