SQL Clone
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in

Creating a Knowledge Base Chat Bot w/ Azure Bot Service

A while back you may have caught my blog post introducing the Power BI Chat Bot 9000. Since posting that blog, I’ve received a lot of requests on the steps required to build the bot. The good new is that its super easy and really only take a few minutes to get it set up. In this blog post, I’m going to walk you through how to set up your own chat bot by creating a chat bot based on the SQL Database FAQ, which can be found here.

1. Create a new service at https://QnAMaker.ai

The first step is to create your QnA service at https://QnAMaker.ai. Navigate to the site and click Create new service. You’ll need to be signed in with your Microsoft account.

When you click Create new service, you’ll need to first name your service. I’m calling this bot SQL Database Chat Bot.


Then you have three options for defining your question and answer pairs used as the knowledge base for your bot.

a. Enter the URLs of the web pages that have the Q and A pairs you want to use. This could be an FAQ page or some other website. For this bot, I’m using the FAQ page on the SQL Database documentation.

b. You can also upload a file that contains your questions and answers. You’ve got a few options for types of files you can use, such as Excel files, PDF, Word, and others.

c. Or you can enter the questions and answers manually.

Once you’ve uploaded or created your knowledge base, click Create to create the knowledge base for your service.

2. Edit and Publish your Knowledge Base

After you click create, you should see your knowledge base questions and answers.


After you’ve created your knowledge base you can then edit and update your knowledge base. There’s a few different ways to update your knowledge.

a. Manually edit the knowledge base directly within QnAMaker.ai. You can do this by directly editing the questions by modifying the text of your knowledge base.

b. Edit the source of your knowledge base. Click the Settings tab on the left to edit the URL of your FAQs or upload a new document.

c. You can also download your entire knowledge base and then re-upload the knowledge based after you’ve made you’re edits. Just be aware that when you upload a new knowledge base you will overwrite whatever Q and A pairs previously existed.


Once you’re happy with your questions and answers in your knowledge base, click the Publish button in the top right. Review your knowledge base and then click Publish one more time.

3. Create and Configure the Bot Service in the Azure Portal

Now navigate to the Azure portal and create a new Bot Service resources. Click create at the bottom.


After the Bot Service is provisioned in your Azure subscription, navigate to your Bot Service and select Question and Answer. Then scroll down a bit and click Next.


After clicking Next you’ll need to register your Bot application and create your App ID and password by following the on screen prompts. Make sure you paste your App ID and password into the correct text boxes, check the agreement check boxes and click Create bot.


After you click Create bot, you can select your knowledge base that created in the previous steps.


Click OK.

4. Start using your Bot by Selecting a Channel to Use

Next, navigate to the Channel page and select how you want to start using your bot. You’ve got a lot of different options for how you want to use your bot. For instance, you can chat with your bot by embedding it in a web page using iframes or you can chat with it using Skype, Teams, Facebook Messenger, or a whole host of other options.


But I’m going to embed my chat bot in this page by clicking the Edit button next to the Web Chat option.


I copied the iframe code, copied my secret into the URL and embedded it here:

And that’s all there is to it.

5. Improve your Bot by Training

The last, but very important step, is to improve your bot by training it. You can read more about how to train your chat bot by testing the knowledge base and review chat logs here.


QnAMaker.ai documentation is a great place to start.

Review the Bot Service documentation here.

I hope you found this useful! Leave me a comment and let me know how you’re using these very cool tools to create interesting and powerful for solutions for your customers!

SQL with Dustin Ryan

Dustin Ryan is a Data Platform Solution Architect on the Education Specialist Team Unit at Microsoft. Dustin has worked in the business intelligence and data warehousing field since 2008, has spoken at community events such as Code Camp, SQL Saturday, SQL Rally, and PASS Summit, and has a wide range of experience using the Microsoft business intelligence stack of products across multiple industries. Prior to his time at Microsoft, Dustin worked as a business intelligence consultant and trainer for Pragmatic Works, a Microsoft partner. Dustin is also an author, contributor and technical editor of books such as Applied Microsoft Business Intelligence, Professional Microsoft SQL Server 2012 Analysis Services with MDX and DAX, and others. You can learn more about Dustin at http://SQLDusty.com.


Leave a comment on the original post [sqldusty.com, opens in a new window]

Loading comments...