Build an FAQ Bot in less than an hour

Reading Time: 3 minutes

Blog post: 2 minute read

I’ve previously blogged about building a Data Protection Center to assist end-users in learning everything they need to know about Data Protection in Office 365. I think this is an excellent use-case for an FAQ Bot so I set out to see how quickly I could build a proof-of-concept one. Turns out it was pretty quick to pull together.

Here’s the steps I took to build a Bot in less than an hour. It is not production-ready, but it is enough to get a Bot up and running so you can demonstrate the power of this cool new service to your friends at work.Steps:

  1. Create a new Q&A service (your knowledge base)
  2. Build a Bot connecting it to your Q&A service
  3. Connect your Bot to a channel
  4. Test it out!

Create a new Q&A Service

QnA Maker (Preview): This is a new member of Azure Cognitive Services that allows you to build an FAQ Bot based on a web page, PDF, or a .tsv file of questions and answers. This allows you to pull your repository of questions from a location controlled by a subject matter expert on the knowledge base you’re building your Bot on.

A test engine is also included which allows you to test and train the service to fine tune the answers to your questions.

For a quick setup, I created a .tsv file with the format question<tab>answer

Example:  What is your favorite color?        Blue

When you publish your service, it generates an HTTP Request like this:

POST /knowledgebases/999999999999999999999999999999999/generateAnswer
Ocp-Apim-Subscription-Key: 999999999999999999999999999999
Content-Type: application/json

Build a Bot to connect to your Q&A Service

The Bot is built using Azure Bot Services. You need to have an Azure service plan to do this.

Reference: Create a bot with Azure Bot Service

  1. Go to your Azure portal
  2. Go to the Data and Analytics … Bot Service blade
  3. Select an app name (
  4. It will deploy the Bot Service to your Azure portal
  5. Select the language you want your Bot to be built in (C# or Node.js) and a Bot template. Your options are Basic, Form, Understanding, Question and Answer, and Proactive. I selected ‘Question and Answer’
  6. To authenticate your Bot to the framework you need to register it and generate an App ID and password.
  7. You will be asked to connect your Azure Bot service to a knowledge base. From the previous step, you will see the Q&A service you created in the drop-down list (shown below). This will provision your Bot to use this Q&A service and deploy it.


Note: You can use the App ID generated to quickly test your bot. (See next step below)

The managing Endpoint will be in this format where JoanneDataProtectionBot is the app name you provided on setup:


Connect your Bot to a Channel

While still in the Bot Service of the Azure Portal, go to the Channels tab. This is where you can connect to different channels and get the embed codes for each.

I added the Teams Channel and clicked Get bot embed codes for it. Once you have the embed code, copy and paste it to a website to launch your Teams bot. Another quick way of testing your Bot in Microsoft Teams is to copy the App ID into the To: line of your Teams chat window (shown below). This will launch your Bot and you can ask your questions.


Tip for Teams: In order to allow your Bot to run in Microsoft Teams, you must enable sideloading of external apps. Here is a link on how to do that: Enable sideloading

Sample chat with my Bot

If you go to the Development Bot Framework, you will see your Bot listed under the My Bots tab.

I now need to spend some time learning how to tie this in with various other channels across Office 365. For now, this will get you heading down the right track.

Thanks for reading.


Credit: Photo by Mark Solarski on Unsplash

One comment

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.