Build an AI-Powered Bot on Azure Using QnA Maker

OVERVIEW
It is crucial to establish communication with users, to trigger their limbic system, to make them feel a strong emotional connection towards your app or whatever you are building or maintaining.
That can be easily achieved by providing the ability for users to ask questions and have them answered in real-time without having to compose an email and wait for a reply.
I will walk you through in this blogpost on how you can build AI-Powered bot without even having to write a single line of code, and go live in just few minutes using the Microsoft Bot Framework SDK, Azure, and QnA Maker!
Requirements
Breakdown
QnA Maker
QnA Maker is a web-based service with user-friendly interface to develop a knowledge-base(KB) with intelligence natural language processing abilities, enabling it to even provide answers to questions similar but no not identical to those in the KB.
QnA Maker is an easy-to-use web-based service to train AI to respond to user’s questions in a more natural, conversational way.
qnamaker.ai
Bot Framework SDK
The Bot Framework SDK is an Open Source SDK that enables developers to model and build bots at ease using their favorite programming language.
Demo
STEP 1
To start things up, visit qnamaker.ai and sign-in with your Azure account.

Click on “Create a knowledge base” from the navigation bar.

Click on “Create a QnA service” button.

You will be redirected to the Azure portal to fill the details and finalize the creation process of your QnA Service.

Then click the “Create” button.

Wait till it shows “Deployment succeeded” in the “Notifications” tab.

STEP 2
Return to where you left off and click the “Refresh” button.

Wait till the loading is finished.

Select your directory, subscription, and the service you just created on Azure.

STEP 3
Give your knowledge base (KB) a name.

STEP 4
You can optionally add a web page that contains frequently asked questions (FAQ) to use as a base for the bot, for example, I am going to be using the FAQ about Iron Man from IMDb for that purpose.

Then optionally as well choose a personality for your bot.

STEP 5
Click the “Create your KB” button.

Wait till the creation process is finished.

The questions and answers from the FAQ page that we added in STEP 4 in now loaded in our KB and we can update them, or even add a new set of QnA pairs.

STEP 6
In-order to go live with the bot, we first need to click the “Save and Train” button.

Wait for it to do just that.

Then click “Publish” from the navigation bar and confirm.


Wait for it to finish publishing.

STEP 7
We have successfully deployed A.I. that is going to empower our bot, but we still need to create the bot and integrate it with our A.I. in order to go live.

You will be redirected to the Azure portal to fill the details and finalize the creation process of your bot.

Then click the “Create” button.

Wait till it shows “Deployment succeeded” in the “Notifications” tab.

Click on the “Go to resource” button.

You will be taken to the bot service page where you will have to click “Channels” under the “Bot management” section.

Click “Edit” in the “Web Chat” section.

Click “Copy” under the “Embed code” section, then click “Regenerate” for a fresh key, then copy that and replace “YOUR_SECRET_HERE” within the embed code with that one you got!

If the key we generated looks like this for example “XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX” then the embed code should look like the following snippet.
<iframe src='https://webchat.botframework.com/embed/aliqnaservice-bot?s=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' style='min-width: 400px; width: 100%; min-height: 500px;'></iframe>
Your iframe can be used to embed the bot anywhere you want, but for now, let’s just visit the bot directly by copying the URL from the iframe to test that the bot is live and working!
https://webchat.botframework.com/embed/aliqnaservice-bot?s=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
I will start a conversation with the bot and ask it something about Iron Man since I originally populated the KB in STEP 4 using the FAQ about Iron Man from IMDb, and let’s see if it can answer that!
Our AI-Powered bot is finally fully functional and live without having to write even a single line of code!
Resources
If you want to go above and beyond, here are some resources to help you out!
Azure Bot Service Documentation
Summary
This was just a quick build, and I only used the Web Chat channel, but the bot can be connected to a variety of other channels and integrate a lot of other A.I. features through the Cognitive Services for example, just like the QnA Maker we used in this demo!
I went live with a bot for our company by just following your blog, I am so thankful really!
Keep it coming 😉