By Theo van Kraay, Data and AI Solution Architect at Microsoft
Chat bots are an increasingly popular way for businesses to allow customers or internal staff to interact with information in a more conversational way. People want the information they need as quickly as possible, and while email inboxes have become more and more cluttered, consumers are moving to social media and other channels to find the information they need. Bots help consumers find solutions without using forms, cluttered inboxes, or wasted minutes spent searching and scrolling through content.
QnA Maker is a free, easy-to-use, web-based service that trains AI to respond to questions in a natural, conversational way. It is compatible across development platforms, hosting services and channels, and is the only question and answer service with a graphical user interface. You don’t need to be a developer to build and deploy a question and answer bot based on FAQ URLs, structured documents, or editorial content in minutes!
The below instructions show you how to build the bot in QnA Maker, and make it visible as a “web chat” channel that anyone can interact with online. If you want to watch this being done in under 3 minutes, check out the video below!
Build a bot in minutes
In the Web App Bot Blade, create a unique name for your bot (all other mandatory values will be pre-populated but you can edit as you see fit) then click on “Bot template” (another blade will appear to the right). Be sure to select the “Question and Answer” as the template, and then hit “select”:
When selected, hit create:
This will start deploying a web app bot, which won’t take long. While that is happening, open a new window and log in to QnA Maker (you will need a valid Microsoft account). Click “Create new service”:
Give your QnA Service a name, and add the url of an FAQ site you want to crawl for question and answer pairs:
Scroll down. You will see an option to use a file (if you didn’t have an FAQ url) supporting various file formats. When you have selected an FAQ site or file to use for Q & A pair generation, hit create:
Warning: be sure that your site (or file if you use one) actually has text that can be identified as question and answer pairs. If the operation fails, it is likely that your site or document doesn’t qualify.
After a period of time, the knowledge base will be created:
Essentially, you now have the conversational logic for your Q&A bot. For more detail on how to edit Question & Answer pairs, see here. For now though, we are in a rush to publish a bot quickly, so let’s do that! Hit publish:
On the review screen, hit publish again:
You will then have a published knowledge base, but that is all you have. We need to make your bot visible as a channel. For this, there are two keys you need: QnAKnowledgebaseId and QnASubscriptionKey, which will be available in the screen presented to you after the service is deployed. Leave this window open.
Meanwhile, your bot has probably deployed, or is close to deploying. From notifications, hit “Go to resource”:
In the resource, hit application settings:
Scroll to the bottom of application settings, where you will see fields for QnAKnowledgebaseId and QnASubscriptionKey. Enter the corresponding keys from the other (QnA Maker) window, then hit save.
When deploying a web app bot, it is deployed as a “Web Chat” channel automatically (for deploying to other channels, e.g. Skype, Cortana, Slack and many others, see here). Go to channels and hit “get bot embed codes”:
In the popup that appears, hit “Click here to open the Web Chat configuration page”:
In the configuration page, click on “show” to reveal one of the secret keys (either will do). Copy the contents of the “embed code” text box to somewhere else, and replace “YOUR_SECRET_HERE” with the secret key:
You should end up with something like this:
<iframe width="300" height="150" src="//webchat.botframework.com/embed/TVKQnABot?s=zA4qh-9znAs.cwA.3dI.BOZVvNmXAiM00OlHz7gn8J7jDUNNEJ3Yk6iBiu6fnRc’"></iframe>
You can embed this in a web page, or you can simply take the url part to interact with your bot online:
You've now set up your chatbot!