Build Bots With Microsoft Teams Manual

User Manual:

Open the PDF directly: View PDF PDF.
Page Count: 32

DownloadBuild Bots With Microsoft Teams Manual
Open PDF In BrowserView PDF
Building Bots with Microsoft
Teams
Lab Manual
Office365 Dev Bootcamp, Chennai.

1|Page

Table of Contents
1)Overview of Microsoft Bot and Teams
2)Getting Started
3)Prerequisites
4)Creating QnA Service
5)Creating a QnA Maker Knowledge Base
6)Adding Chit Chat to KB
7)Creating a QnA Bot with Azure Bot Service
8)Testing Bot
9)Connecting QnA KB to QnA Bot
10)Testing FAQ Bot
11)Adding Bot to teams
12)Conclusion

2|Page

--------------------------------------------Hands on Lab:
Creating an Intelligent Bot using QnA
Maker Service and Azure Bot Service
---------------------------------------------Microsoft Bot
Chat bots are services that people interact with through conversation and messaging. It can
perform automated tasks varying from simple to complex in nature. A very simple example
of a Bot is a chatbot – which answers user queries based on keywords typed in by users.

Microsoft Teams
Microsoft Teams is the digital hub that brings conversations, content, assignments, and apps
together in one place.
✓
✓
✓
✓
✓

Communicate through chat, meetings, and calls
Collaborate together with integrated Office 365 apps
Customize your workplace and achieve more
Make calls in Office 365 and Teams
Connect across devices

3|Page

1.Getting Started
We’ll be running through an example of how to build, train, and deploy a question-andanswer bot based on FAQs. We will be using Microsoft’s Cognitive Services and Web App Bot
Service, both of which can be found in the Azure portal (portal.azure.com).
Then integrate it within Microsoft Teams. It will go over the complete start to finish process
and show a working bot in MS Teams that answers Azure Bot Service FAQs.

2.Prerequisites
We will need the below tools/apps to get started
✓
✓
✓
✓

Visual Studio
Azure Subscription
Access to an MS Account
MS Teams app installed

3.Creating a QnA Service
QnA Maker allows you to quickly create a knowledge base to which you can link existing data
sources to be used as a data repository for your bot. Before you can create a knowledge base,
however, you have to create a QnA Service.
Navigate here, sign in with you Azure credentials, then select Create a QnA Service

4|Page

In the QnA Maker, fill out the required fields:
5|Page

•
•
•
•
•

•
•
•

Fill in the Name with a unique name to identify this service. I will be using the
name TeamsQnAService
Select Free Trial as the Subscription
Select F0 (3 calls per second) as the Management Pricing Tier
Create a new Resource Group
Choose the Free tier for the Search pricing tier option. If this option is greyed out, it means
you already have a Free Azure Search tier deployed and you will need to use the Basic Azure
Search Tier.
Select East US or West US as the Search Location. This is where your Azure Search data will
be deployed.
Choose an App Name for your service
Choose East US or West US or Central India(based on your region) for both the Website
Location and App Insights Location. (Note: the search location can be different from the
website location.)

6|Page

Once all the fields are filled out and validated, click on Create to start deploying these
services.
You will see your new QnA Service show up in your list of subscriptions once the
deployment is complete (this usually takes a few minutes).

7|Page

4.Creating a QnA Maker Knowledge Base
Now that your QnA Service has been created, return here and scroll down to Step 2: Connect your
QnA Service to your KB

8|Page

•
•
•

Select the same tenant as your Microsoft Azure account for the Microsoft Azure Directory ID
Choose the Free Tier option for the Azure Subscription Name
Finally, select the name of the QnA Service you created in the previous step from the Azure
QnA Service dropdown, which should now be available
In Step 3, name your KB for your reference (you can change it anytime). I have named
my KB Test QnA KB.

In Step 4, choose a source to populate your KB. Microsoft’s QnA Maker supports formats
including .pdf, .doc, .docx, .xlsx, and others. For this demo, enter
https://azure.microsoft.com/en-us/support/faq/
9|Page

into the URL field. This is the FAQ page for Microsoft Azure. When complete, your bot will be
able to answer all the questions listed in this FAQ page.

5. Adding Chit Chat to your KB.
➢ Adding chit-chat to your bot makes it more conversational and engaging. The chit-chat
feature in QnA maker allows you to easily add a pre-populated set of the top chit-chat, into
your knowledge base (KB).
➢ This can be a starting point for your bot's personality, and it will save you the time and cost
of writing them from scratch.
➢ This dataset has about 100 scenarios of chit-chat in the voice of three personas - The
Professional, The Friend, The Comic. Choose the persona that most closely resembles your
bot's voice. Given a user query, QnA Maker tries to match it with the closest known chit-chat
QnA.

10 | P a g e

Finally, select Create your KB in step 5. This will go through the link you provided and
create a knowledge base for your service. When the KB is created, it opens the Knowledge
Base page from which you can edit the contents of your KB.

11 | P a g e

Now you can see the list of questions and answers which is pulled from the FAQ URL

Click on Add QnA Pair to add a new row to the KB and enter the following.

12 | P a g e

Select Save and train to save your changes and train the QnA Maker model.
You can test your KB by choosing Test from the top bar. If you enter "Hi", the KB should
respond with the answer you just entered.

13 | P a g e

You also have the option of Inspecting this response by selecting the Inspect link. From
here, you can add different phrasings for the same question and also view the Confidence
Score the service assigned to the answer it returned. Remember to select Save and train to
save your changes.

You can now select Publish from the top bar. This will deploy your service to an endpoint
that, once published successfully, can be used to feed your QnA Bot! You can always
select Edit Service to return to your KB and make changes.

14 | P a g e

In just a few minutes, you have easily created a QnA Maker Service using Microsoft’s
Cognitive Services without writing a single line of code!
15 | P a g e

6. Creating a QnA Bot with Azure Bot Service
Now that you’ve successfully created a QnA Maker Service, you can create a bot that uses
the KB you created to respond to questions via the QnAMakerDialog.
From the Azure Portal, Create a new bot service
1. Click Create new resource link found on the upper left-hand corner of the Azure portal,
then select AI + Machine Learning > Web App bot.
2. A new blade will open with information about the Web App Bot.

16 | P a g e

3. In the Bot Service blade, provide the requested information about your bot as specified in
the table below the image.

17 | P a g e

18 | P a g e

✓
✓
✓
✓
✓
✓
✓
✓
✓

Set Bot Name to your bot’s desired name. I will be using TeamsFAQBotIntegration for mine.
Choose Free Trial for the Subscription
Select Create new for Resource Group
Choose Location
Choose F0 (10K Premium Messages) for the Pricing Tier
Select Question and Answer C# for the Bot template and hit Select
Choose Create New for Azure Storage
Choose App Insights Location
Select Create

19 | P a g e

Reference
Setting

Suggested value

Description

Bot name

Your bot's display
name

The display name for the bot that appears in
channels and directories. This name can be
changed at anytime.

Subscription

Your subscription

Select the Azure subscription you want to use.

Resource
Group

myResourceGrou
p

You can create a new resource group or choose
from an existing one.

Location

The default
location

Select the geographic location for your
resource group. Your location choice can be any
location listed, though it's often best to choose a
location closest to your customer. The location
cannot be changed once the bot is created.

Pricing tier

F0

Select a pricing tier. You may update the pricing
tier at any time. For more information, see Bot
Service pricing.

App name

A unique name

The unique URL name of the bot. For example, if
you name your bot myawesomebot, then your
bot's URL will
be http://myawesomebot.azurewebsites.net
. The name must use alphanumeric and
underscore characters only. There is a 35
character limit to this field. The App name cannot
be changed once the bot is created.

20 | P a g e

Setting

Suggested value

Description

Bot template

Echo bot

Choose SDK v4. Select either C# or Node.js for
this quickstart, then click Select.

App service
plan/Locatio
n

Your app service
plan

Select an app service plan location. Your location
choice can be any location listed, though it's
often best to choose the same location as the
bot service.

Azure
Storage

Your Azure
storage account

You can create a new data storage account or
use an existing one. By default, the bot will
use Table Storage.

Application
Insights

On

Decide if you want to turn Application
Insights On or Off. If you select On, you must
also specify a regional location. Your location
choice can be any location listed, though it's
often best to choose the same location as the
bot service.

Microsoft
App ID and
password

Auto create App
ID and password

Use this option if you need to manually enter a
Microsoft App ID and password. Otherwise, a
new Microsoft App ID and password will be
created for you in the bot creation process.

The deployment will take a few minutes. Once the notification displays Deployment
Succeeded, select Go To Resource on that notification.

21 | P a g e

7.Testing the Bot
Once the bot’s resource window is open, click Test in Web Chat and type “hi” into the chat
box.

22 | P a g e

The bot should respond with “Please set QnAKnowledgebaseId and QnASubscriptionKey in
App Settings. Get them at https://qnamker.ai. This is letting you know that your bot is not
yet linked to the KB you created earlier. Let’s do that next.

8.Connecting your QnA KB to your QnA Bot
Navigate back to the QnA Maker page and select the “My Knowledge Bases” tab.

23 | P a g e

Select View Code from the row that lists the KB you created earlier to locate the
appropriate values.

Now navigate back to the Azure portal and select the Web App bot you just created.
Select the Application Settings tab under App Service Settings and edit
the QnAKnowledgebaseId, QnAAuthKey, and the QnAEndpointHostName fields to add the
values of the QnA KB that you previously created.

24 | P a g e

25 | P a g e

Click Save

9.Testing the FAQ Bot
Once again in the Azure Portal, select the QnA Bot you created and hit Test in Web
Chat and type “hi” into the chat box.
The bot should respond with “Hello, ask me about Microsoft Azure!” as expected.

26 | P a g e

This bot is now fully connected to your knowledge base! You can continue asking questions
normally found in the FAQ directly through this bot.

27 | P a g e

10.Adding the Bot to teams
This section will describe how to add the Bot that has been created into teams.
1. Navigate to the Channels tab.

This shows all the supported channels that the Bot can be added to. In this demo, the Bot
will be added to MS Teams. Select the team’s icon. Once selected select the Done. The
Microsoft Teams now appears under connect to channels section.
Agree to the terms and Conditions

28 | P a g e

29 | P a g e

Now you can find the Teams channel added under Channels list
2. Click Settings Tab and Upload Icon for Bot

30 | P a g e

3. Now click the Microsoft Teams Text.
This will open a new tab asking you to open the bot in Microsoft Teams. Depending on the
browser being used the dialogue may be different. If using Chrome select ‘Open Microsoft
Teams’. The bot will then open in MS Teams.

Now try and type something else and see what the response is

31 | P a g e

11. Conclusion
Hopefully this provides enough information in a clear and concise way to create a Bot and
surfacing the Bot in Microsoft Teams.
The one key point from using the QnA bots service is the more time you spend in the test
and knowledge base sections the more reliable the answer would be.
For more information on the QnA Maker visit:
https://docs.microsoft.com/en-us/azure/cognitiveservices/qnamaker/overview/overview

32 | P a g e



Source Exif Data:
File Type                       : PDF
File Type Extension             : pdf
MIME Type                       : application/pdf
PDF Version                     : 1.7
Linearized                      : No
Page Count                      : 32
Language                        : en-US
Tagged PDF                      : Yes
XMP Toolkit                     : 3.1-701
Producer                        : Microsoft® Word for Office 365
Creator                         : Jayanthi P
Creator Tool                    : Microsoft® Word for Office 365
Create Date                     : 2018:10:23 00:48:47+05:30
Modify Date                     : 2018:10:23 00:48:47+05:30
Document ID                     : uuid:100A0814-8D56-4987-87B8-CE2E4487941C
Instance ID                     : uuid:100A0814-8D56-4987-87B8-CE2E4487941C
Author                          : Jayanthi P
EXIF Metadata provided by EXIF.tools

Navigation menu