{"id":11745,"date":"2018-11-18T12:00:25","date_gmt":"2018-11-18T12:00:25","guid":{"rendered":"https:\/\/www.microsoft.com\/en-gb\/industry\/blog\/?p=11745"},"modified":"2020-06-24T13:33:42","modified_gmt":"2020-06-24T12:33:42","slug":"build-a-bot-in-under-3-minutes-in-azure","status":"publish","type":"post","link":"https:\/\/www.microsoft.com\/en-gb\/industry\/blog\/technetuk\/2018\/11\/18\/build-a-bot-in-under-3-minutes-in-azure\/","title":{"rendered":"Build a bot in under 3 minutes\u2026 in Azure!"},"content":{"rendered":"

\"A<\/p>\n

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.<\/p>\n

QnA Maker<\/a> 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\u2019t 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!<\/p>\n

The below instructions show you how to build the bot in QnA Maker, and make it visible as a \u201cweb chat\u201d channel that anyone can interact with online. If you want to watch this being done in under 3 minutes, click here<\/a>!<\/p>\n

(please note that the video demo was done using the preview service<\/a> \u2013 see below for a \u201cquick start\u201d guide to building a bot in minutes using the now Generally Available QnA Maker service<\/a>)<\/p>\n

 <\/p>\n

Build a bot in minutes<\/h2>\n

First, go to the Azure Portal<\/a> (you will need a subscription, click here<\/a> to sign up for free if you don\u2019t already have one). Create a resource -> AI + Machine Learning -> Web App Bot:<\/p>\n

 <\/p>\n

\"A<\/p>\n

 <\/p>\n

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 \u201cBot template\u201d (another blade will appear to the right). Be sure to select the \u201cQuestion and Answer\u201d as the template<\/strong>, and then hit \u201cselect\u201d:<\/p>\n

 <\/p>\n

\"A<\/p>\n

 <\/p>\n

When selected, hit create:<\/p>\n

 <\/p>\n

\"A<\/p>\n

 <\/p>\n

This will start deploying a web app bot, which won\u2019t take long. While that is happening, open a new window and log in to QnA Maker<\/a> (you will need a valid Microsoft account<\/a>). Click \u201cCreate a knowledge base\u201d:<\/p>\n

 <\/p>\n

\"A<\/p>\n

 <\/p>\n

First you need to create a QnA Cognitive Service. Click \u201cCreate QnA service\u201d:<\/p>\n

 <\/p>\n

\"A<\/p>\n

 <\/p>\n

This will take you to the Azure portal to set up the service. Fill in the mandatory fields and hit \u201ccreate\u201d:<\/p>\n

 <\/p>\n

\"A<\/p>\n

 <\/p>\n

Wait for the service to deploy:<\/p>\n

 <\/p>\n

\"A<\/p>\n

 <\/p>\n

When Deployed, go back to your other still open browser window (from which you logged into QnA Maker). Hit \u201crefresh this page\u201d, after which you should then be able to select the appropriate Active Directory ID, subscription, and the QnA service you just setup, as below:<\/p>\n

 <\/p>\n

\"A<\/p>\n

 <\/p>\n

When selected, scroll to steps 3, 4 and 5 to give your QnA Service a name, and add the url of an FAQ site you want to crawl for question and answer pairs. You will also see an option to use a file (if you didn\u2019t 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 \u201ccreate your KB\u201d:<\/p>\n

 <\/p>\n

\"A<\/p>\n

 <\/p>\n

Warning: be sure that your site (or file if you use one) actually has text that can be identified as question and answer pairs<\/em>. If the operation fails, it is likely that your site or document doesn\u2019t qualify.<\/p>\n

After a period of time, the knowledge base will be created:<\/p>\n

 <\/p>\n

\"\"<\/p>\n

 <\/p>\n

Essentially, you now have the conversational logic for your Q&A bot. For more detail on how to edit Question & Answer pairs, see here<\/a>. For now though, we are in a rush to publish a bot quickly, so let\u2019s do that! Hit publish:<\/p>\n

 <\/p>\n

\"A<\/p>\n

 <\/p>\n

On the review screen, hit publish again:<\/p>\n

 <\/p>\n

\"A<\/p>\n

 <\/p>\n

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 three values you need: QnAKnowledgebaseId<\/strong>, QnAEndpointHostName<\/strong>, and QnAAuthKey<\/strong>, which will be available in the screen presented to you after the service is deployed (these are highlighted below). Leave this window open.<\/p>\n

 <\/p>\n

\"The<\/p>\n

 <\/p>\n

Meanwhile, your web app bot has probably deployed. From notifications, hit \u201cGo to resource\u201d for the web app bot we created at the first step (in this case called \u201cTVKQnABotTest\u201d),<\/p>\n

 <\/p>\n

\"A<\/p>\n

 <\/p>\n

In the resource, hit application settings.\u00a0Scroll to the bottom of application settings, where you will see fields for QnAKnowledgebaseId<\/strong>, QnAEndpointHostName<\/strong>, and QnAAuthKey<\/strong>. Enter the corresponding keys from the other (QnA Maker) window that you have left open, then hit save.<\/p>\n

 <\/p>\n

\"The<\/p>\n

 <\/p>\n

When deploying a web app bot, it is deployed as a \u201cWeb Chat\u201d channel automatically (for deploying to other channels, e.g. Skype, Cortana, Slack and many others, see here<\/a>). Go to channels and hit \u201cget bot embed codes\u201d:<\/p>\n

 <\/p>\n

\"The<\/p>\n

 <\/p>\n

In the popup that appears, hit \u201cClick here to open the Web Chat configuration page\u201d:<\/p>\n

 <\/p>\n

\"A<\/p>\n

 <\/p>\n

In the configuration page, click on \u201cshow\u201d to reveal one of the secret keys (either will do). Copy the contents of the \u201cembed code\u201d text box to somewhere else, and replace \u201cYOUR_SECRET_HERE\u201d with the secret key:<\/p>\n

 <\/p>\n

\"A<\/p>\n

 <\/p>\n

You should end up with something like this:<\/p>\n

<iframe src='https:\/\/webchat.botframework.com\/embed\/TVKQnABotTest?s=KPpdajqTxa4.cwA.unE.RBVjzlFalMNWFm3mUU6TLy0gfYc16gbpWKb1_us6F44'><\/iframe><\/pre>\n

You can embed this in a web page, or you can simply take the url part to interact with your bot online:<\/p>\n

 <\/p>\n

\"An<\/p>\n

 <\/p>\n

You’ve now set up your chatbot!<\/p>\n

Resources<\/h3>\n