Introduction

In this article, we will be learning how to create or build an intelligent Azure Bot using Microsoft QnA Maker and Azure Bot service. Also, we will be deploying this Bot to the application live.

For novice cloud developers, aspiring cloud architects, pre-sales consultants, and all other IT professionals associated with the cloud computing, especially with Microsoft Azure and Artificial Intelligence, this article will explain the capabilities of Microsoft Bot service and Microsoft cognitive QnA Maker.

Pre-requisite

Overview

Earlier in this year January, I had an article on Creating FAQ Bot with BOT Framework's QnA Maker (it also got featured 😊) and was going through the same. But noticed much change, though small but really smart changes. I wanted to write this article as a continuation of the earlier article but when I tried it out, it was really cool and much easier to build intelligent bot with quick time using QnA Maker and Azure Bot service.

QnA Maker

When it comes to FAQ Bot, an important member of the Cognitive family is QnA Maker. It basically creates a database or in QnA term, a Knowledgebase with given set of FAQ data.

Now, this data could be in the form of existing Live, accessible to public web page URL. Or could be in the form of a document with data in question and answers format. This document can be either FAQ pages in .tsv, .pdf, .doc, .docx and .xlsx format or product manuals in .pdf format. You can upload up to five files, with a size limit of 5 MB each. Also, you can manually enter a question and answer into QnA maker web portal.

Would recommend reading Creating FAQ Bot with BOT Framework's QnA Maker article for better understanding of its functional working.

Azure Bot Service

This offering is an intelligent bot service which scales on demand. It comes with a pricing option of ‘pay for only use’. It offers an ability for our bot to get connected with multiple channels like Skype, Skype for business, Cortona, Bing, Telegram, Facebook Messenger, and many others.

Building C# Corner FAQ Bot

For practical understanding, let’s build up a C# Corner FAQ bot using QnA Maker and Azure bot service.

Open QnA Maker web portal => Sign up the portal with valid Email ID.

Click on link, ‘Create new service’.

Azure Bot

The section would allow us to add a content source to seed the data into our bot knowledgebase.

For our Bot, it’s of C# Corner FAQ page: http://www.c-sharpcorner.com/faq, Copy FAQ webpage URL.

Azure Bot

Once the inputs are provided, it would look like,

We can add multiple URLs by clicking on link ‘+ Add another ‘

Azure Bot

Once the inputs are provided, it would look like,

We can add multiple files by clicking on button ‘Select file.. ‘

And last source option is to add manually.

Once done with adding URLs, and uploading files,

Click on Create.

Azure Bot

Once the service is created, we will redirect to Knowledgebase page. Here we can see and verify all the Question and Answers extracted from different sources provided.

We can test our knowledgebase by clicking "Test" section.

Here, we can add, modify the Input questions and answers by rephrasing the same questions in different forms.

Azure Bot

These are the most important Buttons or Links in the entire Data seeding exercise.

After clicking on Publish, it navigates to Review page,

Azure Bot

Click on Publish again once reviewed.

This will take fewer seconds for publishing our knowledge base & creating an endpoint.

Azure Bot

After publishing it provides with sample Http request.

Also, you can again click on Edit service for massaging your knowledge base.

Azure Bot

Azure Bot Service

Now we have our csharpcornerfaq bot knowledge base ready. What’s Next!

To use this knowledgebase, we have Azure Bot service.

Open Microsoft Azure Porta.

Click on ‘+ New‘ => AI + Cognitive Services => Bot Service

Note

At the time of writing this article, both QnA Maker and Bot Service are in the preview
.

Azure Bot

Enter all the required details for creating Bot service,

Once done with providing all details, Pin it to Dashboard!

Service will take fewer minutes to get deployed & we will be landed at below Bot service page.

Here, we need to select programming language from the available option, C# and Node.js. Also, need to select chat bot template among five templates.

As our bot is of Question and Answer pattern, we will be selecting, C# as language and Question and Answer as our bot template.

Click on Next to proceed.

Azure Bot

Create a Microsoft App ID

Now in order to authenticate our bot with the Bot Framework, will need to register our application and generate an App ID and password.

This involves two steps,

Note
Before Accepting the terms, policies do read it carefully
.

Click on Create bot

Once authenticated and registered, bot service needs the knowledge base to converse with outer world.

As we have selected Question and Answer Template, next it opens up QnA Maker dialogue window.

Here, we need to select our Csharpcornerfaq as knowledgebase.

Click OK

Azure Bot

Next, the bot will get provisioned and it may take fewer minutes.

Azure Bot

Status messages can be seen

Azure Bot

And finally, our Bot service with csharpcornerfaq knowledge base is ready to use!

Under Build section, you have different options to modify or work on your code.

Azure Bot

Testing our Bot

We can test our Bot right from Azure Portal, i.e. under Test section in Bot service.

Azure Bot

Connect to Channel

We can connect our bot with different channels like Cortona, Facebook Messenger, Telegram, Skype for Business and all other listed in below image.

We can see that by default, it's seen running for Skype and Web Chat.

Let’s use this Web Chat into application and deploy the same on Cloud, to experience it live!

Click on pen icon, to configure Web Chat.

Azure Bot

Configure Web Chat

After configuring Web Chat, use this embed code in to our application.

Here I have created a small project with HTML file name c-sharpcorner-faq-bot.html

We will be using Web Chat embed code in to this HTML file.

This application is uploaded to Azure web app with

URL

http://faqbots.azurewebsites.net/c-sharpcorner-faq-bot.html
, and it looks like,

Azure Bot

Now, our C# Corner FAQ bot is Live on Cloud!

Let’s ask few questions.

Azure Bot

Interesting isn’t it?

Also, you can create this entire bot right from scratch in less than 15 minutes!

I know you will not believe in what I say until you yourself see it happening. Have created a video following above steps for creating C# Corner FAQ Bot.

Watch How to build C# Corner FAQ Bot using QnA maker and Azure Bot service in less than 15 minutes!

Summary

Microsoft is really working hard to help us to build super intelligent & Smart bots. QnA Maker and Azure Bot service are among wide AI & Cognitive offerings to achieve a scalable, on demand, profitable, of course, an intelligent product.

Would highly recommend to learn, dive into this article and try to create a bot for your organization or personal blog or product.

Do let me know your findings of it.

Happy Azure Coding! Thank You!