How to create a bot with Azure Bot Framework

Posted on Posted in Azure, Chatbot, Dynamics 365

Azure Bot Framework

Bot services have become popular in the industry in the recent past. They are used to control and maintain data, build Q, and A platforms and to build virtual agents for the industry. These intelligent enterprise-grade bots transform the industry into a profitable, responsive, and competitive state. Azure Bot Service is one of the Bot services that serve in many aspects of the industry. Data controlling, Q and A platforms, virtual assistants, and natural language understanding are some of the above aspects.

Q and A Chat Bot with Azure Bot Framework

In this tutorial, we will make a Q and A bot for your platform. Q and A bot functions as follows:

Chat Bot understands the user input, and it will give a solution if it’s a straightforward question. Otherwise, if the chatbot needs further clarification, it will prompt a series of Question and Answer models until the customer is satisfied with the solution.

QnA Maker knowledge base (KB)

QnA Maker knowledge base (KB) is a set of Questions and Answers based on simple FAQs or Manual that you own. You have to create a free Microsoft Azure account (if you don’t have one) before we start our tutorial. Use this link for Microsoft Azure page. Then use your Azure Credentials to sign in to with this given link. You will be able to see the below screen if you have successfully signed in.

Creating a QnA Maker. 

Step 1: Click on the “Create a Knowledge Base” as shown in the below image.

Step 2: Select “Create a QnA service in Microsoft Azure,” if you haven’t created any Q and A service before. But if you have created a Q and A service before, you can connect it for a chatbot by clicking “Connect your QnA service to your KB.” As you are new, just click “Create a QnA service in Microsoft Azure.”

Step 3: Fill the required details of the generated window as follows.

“Name” is the name of your chatbot. “Subscription” is your generated Azure subscription. “Pricing Tier” is the plan you can select with the required features. You have to create a “Resource group” if you have not created one before. “Resource group location” is the created place of your resource group. “Azure search pricing tier” is a feature plan with your Azure Subscription. “Azure search location” is the search location, and you can give a name to your chatbot under the field of “App Name”. Keep “Website location” and “App insight location” as default. Finally, you can create your “QnA Maker” by clicking the “Create” button. I have given my details below.



Step 4: Fill the  Step 2  section in the “Create a knowledge base” page with the following details. “Microsoft Azure Directory ID” is the directory of your Microsoft account. “Azure subscription name” is the name of your subscription. “Azure QnA service” is the name of your QnA service and you can select your preferred language in the “Language” section.


Step 5:Give a name to your knowledge base in Step 3 in the “Create a knowledge base” page.


Step 6: Fill Step 4 with the following details.

  • Select Checked for “Enable multi-turn extraction from URLs, .pdf or .docx files.”
  • Give “Quickstart – default answer not found” for Default answer text.
  • Give the following URL for “+ Add URL”
  • Select Professional for “Chit-chat.”



Step 7:Finally Create your Knowledge Base by clicking the “Create your KB” button.



Building the knowledge base.




Use the “Add QnA pair” to make a question and answer pair for your knowledge base. Make a question and answer pair in the relevant fields. You can delete it and remake the QnA pair using the delete button if it is not as you expected. “Add alternative phrasing” means the message of the user. “Enter an answer” on the right side is the answer by the chatbot to the relevant question by the user.



“Add follow-up prompt” is used to get a specific answer by a pre-given solution. “Display text” is the prompt you place and “Link to QnA” is another Question and Answer pair that you want to link to the prompt. Click the “Save” button after you have finished.

Let’s make a scenario as follows. You want to place a message for the manager of a certain department in a company as they are not available at the moment. So when you say “Hi” it prompts certain Questions to you and gets your message. Department is “Sales” and the Company is “ABC company in the scenario which I have built. You can see the connected QnA pairs as in the below images.


When you have finished the QnA pairs you can “save and train” your KB. Then you can test it by the “Test” button. You can test and make adjustments to your QnA pairs until you are satisfied with your KB. See My test below.



1                                                            2                                                                 3





Then click “Publish” to publish your KB. Click “Publish” on the prompted window.


You can see some valuable information related to your bot in the upcoming window.

Deploying the bot.


Then you can just deploy your bot using the “Create Bot” button. You will be redirected to the Azure portal to deploy your bot. You can change the settings of your bot in the prompted window. Select “Bot handle” and “App name” as you prefer and you can select the “Pricing tier” with regarding your needs. Other settings are generated in the previous settings and you don’t need to change that. You can see my settings below. Click the “Create” button to create your bot after changing the settings.



You will get a notification in the Azure portal after you have successfully deployed the Bot as in the image. Click the “Go to resource” button in that.


You will be redirected to your created bot page and click “Test in Web Chat” to test your bot. Test your created KB and check the results.



Here are my results.

You can build and test bots as you like easily on Azure. Also, you can try out different bot types as virtual assistants and enterprise bots. You can try out many features from your free 200$ given for your new account, and Azure is a great platform to deploy and test your bots.

Leave a Reply