QnA Bot Using Microsoft Azure

Introduction

 
Bots have become so famous these days,  and integrating a Bot into an existing application is much easier. Microsoft introduced QnA Maker for this and also provided good documentation for the same. I went through different documentation to understand and implement it in one of my applications. So, I'm trying to put everything here in one flow.
 
In this article, I'm going to explain how to create a bot from the existing QnA section of your application (or website). I'm going to use the C-sharp Corner FAQs section in this article. Let's start.
 
Prerequisites
  1. Microsoft Azure Account.
Step 1 - Create a QnA Maker Service
 
Sign-in to your Azure account on the Azure portal. Click on "Create a resource" and search for QnA Maker.
 
QnA Bot Using Microsoft Azure
 
Click on "Create". It will navigate to a form which looks like below.
 
QnA Bot Using Microsoft Azure
 
Fill all the required fields and select the pricing tier based on your requirement (check this link for pricing). Finally, clicking on "Create" will create your bot service and it might take a couple of minutes to deploy. 

Click on "All resources" and make sure your bot service is listed in it.

Step 2 - Create QnA Maker Knowledge Base
 
Sign-in the qnamaker portal with your Azure credentials. On QnA Maker portal, click on "Create a Knowledge base". 
 
QnA Bot Using Microsoft Azure
 
It will take you to a "Create knowledge base" page. We already have created a QnA Service. Go to the second section and click Refresh. Select your account, subscription etc. and you're done with the creation of service.

Note
Don't use the Incognito window. It might not refresh and it won't list out the created QnA service in the list.

In Step 3, give a knowledge base name.

In Step 4, I'm giving the C# Corner FAQ link (https://www.c-sharpcorner.com/faq).
 
QnA Bot Using Microsoft Azure
Later, click on "Create KB". It might take a few minutes to create your knowledge base.

Step 3 - Test Your Bot

In your QnA portal, at the top right of Knowledge Base page, there is an option to test.

QnA Bot Using Microsoft Azure
 
Click on "Test" and a chat box will slide the to left. 

QnA Bot Using Microsoft Azure

Now, let's try with any question from C-sharp Corner FAQ section.
 
QnA Bot Using Microsoft Azure
 
We can try the highlighted question from the above screenshot and the response looks like below.

QnA Bot Using Microsoft Azure
 
Yes, our Bot is working fine!

Step 4 - Publish

Click on the "Publish" tab. It will take you to the Publish page. Click Publish and it might take a couple of minutes to publish.
 
QnA Bot Using Microsoft Azure 
If you've published it successfully, it will take you to the Success page. Your service is exposed as REST API. We can integrate it into our application.
 
QnA Bot Using Microsoft Azure
 

Summary

 
In this article, we discussed how to create a Bot Service using Microsoft QnA Maker. We also saw how to create a Knowledgebase from our FAQs and how to test and publish it. The Service is exposed as REST API and can be integrated into our application irrespective of the technology used.


Similar Articles