QnA maker helps us in building a basic bot that can handle first level of recurring tasks. This benefits the end user in providing the faster response and answer to their question. This benefits the end user in getting a quicker response and answer to their inquiry. We can reduce a lot of repeating chores at the operational level with QnA maker. For example, we may use QnA maker to provide first-level NOC monitoring help, which will benefit both the requestor and the first-line support team significantly.
We had a look through a similar article 2.8 years back how to create a azure web app bot here
Microsoft’s investment in cognitive services has been fantastic, as they have simplified the automation process and integration with Microsoft Teams while requiring little or no coding knowledge. This greatly aids us in building QnA makers and bringing them live in a matter of days providing we keep all of our knowledge bases up to date and accessible.
In this article we will go through the steps that is required to integrate the QnA Maker with Microsoft Teams.
Below are the main requirements to build QnA Maker and integrating them with Teams :
- QnA Maker needs to be created.
- Bot Framework Composer
- A basic bot that is required to handle the interaction
- App Package that needs to be created
The first and the foremost thing is to create the QnA maker from the Azure portal. We can create them easily by navigating to https://QnAMaker.ai
Choose the appropriate Subscription, Resource Group and the Pricing Tier.
After creation you will be taken to the below screen where you will be asked to create the knowledge base.
In the next step we will be asked to connect the QnA service to the KB . Over here we need to provide the Azure Directory ID, Azure Subscription name, QnA service that we created in the previous steps and choose the required language where the bot can interact.
In the next screen we have to name the KB and we can rename it later
In the last step we do have an option to populate the KB with links or a word document. This part is beneficial where the QnA maker can extract question and answer from an online URLs or an updated PDF or docx files.
We also have the options to add the friendly chit chat options and finally create them. This will help the bot to answer small talk questions. And we have the option to choose them based on the etiquette.
Finally after a successful creation we see the below screen which comes with the chit chat questions because we have selected them in our case.
Now its the time for us to add the QnA pairs, In our example we have just added 2 QnA Pairs
When we try to publish this we get the below message
Below screen is shown after successful Publishing. Our next step is to create a bot as mentioned in this portal. If you already have a Bot that is running on C# or node js you can simply copy the postman request to call the knowledge base from the bot.
The next step is to create a basic bot that can handle the QnA interaction between the end user and the QnA service in the backend. There are several methods to create them. In this blog we are going to see them creating via Bot Framework Composer.
Inorder to do that first we need to download the bot framework composer. The bot framework composer can be downloaded from here. To know more about bot framework composer you can always have a look at this Microsoft Docs
The first and the foremost thing we need to do after installation of the bot framework is to create a bot project like below . We need to give them a name, runtime type and the location where it will be stored. In our case we have selected Runtime Azure Web App since we will be uploading them to the Azure.
After the bot project is created , now we need to create the new bot, by clicking on the create new button. The best part is we have the predefined templates which can be chosen based upon our requirement. In our example we will be choosing Core Bot with QnA Maker.
Like example above during bot creation, you’ll select the Azure Bot Service template that best fits your needs. Azure Bot Service may need to provision an instance of the Cognitive Service Language Understanding Intelligent Service (LUIS) or QnA Maker, depending on the template you pick for your Bot. Both are free or trial tiers that will display in your Azure subscription after they are created and can be upgraded any time from the pricing section.
Now we need to integrate the already existing QnA Maker we have in the Azure to the bot framework composer. We do have an option to create a new one from the scratch.
So in our case we are going with the option import existing knowledge base from QnA maker portal. So over here we need to select the correct Azure Subscription and the QnA maker Resource Name.
In the next step we will be prompted for a knowledgebase to import.
Now its time to copy the QnA maker subscription key and populate them in the BOT Profile ID.
We will be presented with the option to create the publishing profile
Now its time to configure the resources
We get the options to select the resources that is required for creating the bot. Usually the default that is required for the bots will be already highlighted and cannot be deselected. If we notice that for a bot registration in Azure we need Microsoft App registration, App services webapp , not channels registration which is created by default in the backend which makes our job much simpler.
Now we need to select the bot that we create and click on the option publish selected bots.
After successful provisioning we get the below screen which states that provision success.
After its created we see the bot is uploaded in the Azure portal.
Now lets make some testing. When testing the bot with the sample questions that was entered in the QnA maker it provides us the information requested as an answer we created in the backend.
We have this bot working in the default webchat, we need to integrate this to Microsoft Teams So that people can pin this as an App and start using them as a first line support.
Inorder to do that we need to go to channels section. By default state we see only the web chat is available and there are other channles that can be integrated to enable this service.
In our case we will be selecting the option Teams and agree to the terms and conditions.
Finally we see a screen like below. There is an option for configuring messaging and calling via webhook. In our case we are using only messaging because we are going to utilize them only for QnA maker.
And finally we need to change the bot profile picture, provide them a name and a description that can help the end users to understand the functionality of this bot.
Now we are done with our steps of integrating the bot and our next step is to see if they are available in Microsoft Teams.
There is an easier way to check if the bot is available in Teams. We need to copy the app id that is present in the configuration and search them normally from the Teams Client.
When we search them with the App id in people section, we can see them they are available.
One more important thing to note is that when we initiate the actual conversation with this bot it takes us to the below screen like how we interact with the end user. Over here we can see the name as ITNOCBOT and this is the name of the Azure BOT that was given during the registration of the bot. This name cannot be altered. So be very choosy on picking your bot name based on the service it will be utilized.
And now when trying to initiate the conversation that we had entered for the 2 sample questions that we already had entered in the QnA maker the bot is easily able to answer them in fraction of seconds.
And if not the QnA maker is able to respond to the correct answers even though the end users are attempting to frame the questions in not correct format. We have options to add large sets of QnA pairs and train them in LUIS which will eventually help end users in receiving the correct answers.
Its always a good idea to update the QnA pair and train them frequently which will eventually help a lot in the IT operations load and the team can focus on the new innovations part. And with Microsoft Teams it really helps a lot for the admins to bring all these features centered and available to the end users from Microsoft Teams.
And we can use this same bot with the applications that can help with integration with App ID and connection strings that can be fetched to perform some 1st level recurring tasks like create an incident with adaptive card, reset passwords of 3rd party application presented through the bots. Also inturn these bots can be provided to end users for further developing and integrating them with other application for providing more services to the end users via Microsoft Teams.
This can help an IT admin in creating bots for reducing lot of recurring tasks to the local support without an assistance of developers. This will be of great benefit to the business they save on time on answering these basic level of general questions. Just with few configurations we are able to bring a bot live and integrate them with Microsoft Teams. There are few more steps which is required to bring this bot as a 3rd party app and make it available for few sets of users in Microsoft Teams. We will look into this steps in the next upcoming blog.