Education Teams Uncategorized

Convert FAQs into Team Bots with 0 lines of code

Ok, for this recipe you need the following ingredients.

  1. Access to Microsoft Azure and a subscription doesn’t need to be a pay-as-you-go version, can be MSDN, Visual Studio Enterprise, Trial, etc.
  2.  Sign in to https://www.qnamaker.ai. (This is where you QnA pairs will be stored)
  3.  App Studio in Teams (further down, I will explain how to install the app in Team

Let’s start by creating our QnA.

  1.  Open QnAMaker.ai and create a new knowledge base
  2.  We need a QnAService (which lives on Azure). Click on the button Create a QnA service
  3.  Fill in the details of your Bot
    1. Name
    2. Subscription
    3. Pricing Tier. The F tier is free but limited in traffic, the S tier is not free but doesn’t have the limitation the F tier has.
    4. Define your ResourceGroup. The purpose of a Resource Group is beyond the scope of this article but docs.microsoft.com can help you with this information.
    5. Define your Search pricing tier. F is free.
    6. Set your Search location
    7. Define your App Name
    8. Define Website location
    9. Define App insights enabled and its location
  4. Click Create
  5. Go back to QnAMaker and refresh.
  6. Select your Microsoft Azure Directory ID, subscription and Azure QnA Service (the one you just created)
  7. Name your KB. I am going to use the Microsoft FAQ found on https://www.microsoft.com/en-us/software-download/faq as a setup so my name is Microsoft Download FAQ
  8. Populate your KB. This can be done by adding a URL like what I am going to do (perfect if you want to use you existing FAQ) or you can upload a file with your QnA pair. I also going to select “Enable multi-turn extraction”, which allows me to have follow-up questions in my bot conversation. Of course your FAQ needs to have this otherwise it will be just a plain QnA setup. More information can be found here.
  9. Chit-Chat. You can provide a personality to you bot. Since this is going to be a bot that people will use to find information I am going to choose a Caring personality.
  10. Click on Create your KB. When finished you will see pages of QnA pairs that you adjust, add question or finetune the tone where necessary.
  11. You can test the QnA pair by using the test button.
  12. To make it ready for usage in a real bot click Save and Train and publish
  13. This provide some information you will need when you create the bot.
  14. POST /knowledgebases/5b0c26a8-490b-4cec-a3b2-251b1d65edc3/generateAnswer
    Host: https://askmebotfaq.azurewebsites.net/qnamaker
    Authorization: EndpointKey c09ff040-8e35-4445-a14e-ac1801b44ab9
    Content-Type: application/json
    {“question”:””}

Time to Create the brains of the operation 

  1. Login your Azure Portal and search for Bot Services
  2. Click Create bot service and choose a Web App Bot, finalize by clicking Create
  3. Fill in all the details like we did earlier. Some interesting information:
    1. Name: I used the Bot name: AskMeAnythingBot
    2. Make sure in the Bot template, you select the SDK v3 and Question and Answer. I choose Node.js as the SDK language but since we are not writing code this shouldn’t matter.
    3. Fill in the rest
  4. Click Create
  5. You should get the notification Validation successful. Now have patience until the bot is created.
  6. We have a bot! When we go in Test in Web Chat and start having a conversation we get the following message. Please set QnAKnowledgebaseId, QnAAuthKey and QnAEndpointHostName (if applicable) in App Settings. Learn how to get them at https://aka.ms/qnaabssetup. This make sense we have not connected the QnA to the bot itself. We need to do this based on the information we got back from QnA maker. In my example:
    1. Go to Configuration under App Service Settings and add the following configuration. Make sure you replace it with the right information. The information is unique to my setup.
    2. QnAKnowledgebaseId: 5b0c26a8-490b-4cec-a3b2-251b1d65edc3
    3. QnAAuthKey : c09ff040-8e35-4445-a14e-ac1801b44ab9
    4. QnAEndpointHostName : https://askmebotfaq.azurewebsites.net/qnamaker
  7. Go in the Web Chat again and now you should be able to have a proper conversation with the QnA.
  8. Next we need to make sure the Bot is ready to accept conversations from Teams. This falls under Channels. Click on Microsoft Teams under featured channel. When you click on Microsoft Teams it will open your Teams client and start a conversation with the bot. This allows you to test the bot inside the Teams chat to see if everything works as wanted.

Make the bot a permanent part of Microsoft Teams

  1. Install App Studio (or open if already installed). You can find this in the Store in Microsoft Teams
  2. Go to manifest editor
  3. Click Create a new App.
  4. Fill in all the App details 
  5. Click on Bots
  6. Click on Setup
  7. Select Existing Bot
  8. Give it a name and find the MicrosoftAppId under the bot configuration in the Azure Portal and enter it under Connect to a different bot id
  9. Select the scope of your bot.
    1. Personal = only in personal chat
    2. Team = deploy in a channel as well
    3. Group Chat = add the bot as a member of a group chat.
  10. Click Save
  11. Click Test and Distribute
  12. Click Install and decide in what channel the bot needs to be deployed

This is all you need.

Result in a channel:

botchannel

Result in a chat:

BotChat

 

Click on the Team Icon to share to your Teams Environment

teams

 

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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s

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

%d bloggers like this: