Build a Q and A Bot in 15 minutes

I was intrigued by one of the new Ux paradigms talked about in Build 2017. Microsoft is providing several technologies to build a bot.

Bots can communicate with a user in a variety of ways including text, card, and speech. Microsoft Bot framework lets you build the bots using C# and Node.js. Azure Bot Services can host the bots and scale them up as necessary. Bot connectors can let a bot connect with a variety of channels including Skype, Slack, Facebook messenger, Cortana and much more. Effectively user can chat with your bot using those tools. A bot can also be connected to Cognitive Services to make it smarter.

One of the common use cases for Bot would be to answer FAQs. If you have a compilation of FAQ and answers, Microsoft provides AI service to extract Q and A from your document(s) and/or URL(s). It creates a knowledge base from the information and builds a REST API endpoint for you. A subject matter expert (SME) is able to further train this knowledge base and customize it with no programming knowledge. This infrastructure lets SME and developer work independently.

A developer can create Bot/API that will be able to communicate with the REST endpoint created for the knowledge base. If you want to skip writing the code, Azure Bot Service will automatically generate and host code to communicate with this endpoint. Once a bot is created by Azure Bot Service, it is automatically registered with the Skype channel and you have Web Chat control available for consumption. You can connect it to the other channels available in the portal.

Here are the steps to create a Q and A bot in 15 minutes 🙂 based on my experience.

I get several questions about my Secure Storage Xamarin Plugin. So I thought of building a bot to answer those questions. So here is how to build an easy Q and A bot.

  1. Prepare FAQs

Write an FAQ document or use your FAQ URL. You can also use multiple documents or combination of URLs and documents.

  1. Go to https://qnamaker.ai
    1. Sign In and accept the terms
    2. Click on Create New Service
    3. Provide a name to the service. This name will be same as the name of your chat bot
    4. In the URLs section, you can refer to the relevant URLs or your FAQ site.
    5. You can alternatively/additionally upload an FAQ document file. It intelligently extracts questions and answers from the document and URLs
    6. This will build your knowledge base. It will have questions answers ready for you (or SME) to review.
    7. Click Test on the left side and test your bot. You/SME may need to retrain it for additional questions or correction.
    8. Once you are satisfied with it, publish the bot. This will give you URL endpoint, knowledge base ID and subscription key to create a bot.
    9. It has effectively built a knowledge base and you can use like REST API with JSON format.
  1. Go to portal.azure.com
    1. Click on Add new -> Choose Bot Service (Preview)
    2. Provide an App name. This will be the name of your service. It will take a few minutes to create the deployment.
    3. After the service is created, click on the notification. It will take you to Create a Microsoft App ID screen
    4. Complete the steps in Generate Password section. Eventually, it will give you a password and returns back to the earlier screen.
    5. After returning, it will ask you to choose a language. C# or Node.jsChooseLang
    6. In the templates, select Question and Answer templatetemplate
    7. When you click Create Bot, It will redirect you to login in the Q and A maker service.
    8. It will then ask you to create new knowledge base or use an existing one.
    9. Choose the one you created in the Q and A Maker. KBSelectIt takes a while to provision the bot.
    10. Once it is ready, you can test it from the Test button.
    11. Now is the time to integrate with channels. Click on the Channels tab.
    12. Skype and Web Chat channels are preselected. Bot in the Skype channel is not available publicly. Click on the channel and go through various tabs to configure and publish it. You may need additional information there such as publisher name, email etc.
    13. You can add your bot to the other channel(s) of your choice. Each channel may need more info pertaining to that channel.
    14. If you add it to the Bing channel, users will be able to chat with it.

Click here to try my bot.

You can ask questions like:

  1. What is Secure Storage Plugin?
  2. Is it open source?

FYI, it answers general questions asked by a developer and does not have extensive knowledge base . Hope you enjoy it.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s