What is a Microsoft Teams Chatbot and how to create it?

By Joren Wouters Updated on

Over the last two years, Microsoft Teams has become one of the most used applications.

And with 145 million daily active users, it might become interesting to automatically reply to users on Microsoft Teams.

In this tutorial, I will explain:

  • What a Microsoft Teams chatbot is
  • Why you should create a chatbot for Microsoft Teams
  • And how you can create a Microsoft Teams chatbot, without writing any code

Let’s dive in!

 

What is a Microsoft Teams Chatbot?

A chatbot is an automated conversation partner.

Usually, when you have a conversation, you are talking to another human. But with chatbots, you are talking to a computer that can understand what you’re saying and automatically talks back.

But what is a Microsoft Teams chatbot then?

A Microsoft Teams chatbot is an automated conversation partner on Microsoft Teams.

 

Why should you create a Microsoft Teams Chatbot?

Microsoft Teams has 145 million daily active users.

microsoft-teams-daily-users

With 95 million added users in 2020, it’s even one of the fastest-growing apps of the pandemic.

Also, around 500,000 organizations use Microsoft Teams as their default messaging platform.

microsoft-teams-organizations

So basically you should create a chatbot for Microsoft Teams, because you are probably one of those organizations that are already using it.

And instead of manually replying to every message on Teams, your chatbot can automatically handle those messages and give a reply instantly.

Here are some examples of what you could do with a Microsoft Teams chatbot:

  • Automatically give answers to common questions of employees, such as when the holidays are and what the wifi password is
  • Automate HR processes, for example when an employee requests a vacation
  • Direct an employee to the right person inside the organization

 

How to Create a Microsoft Teams Chatbot

Now that we know why we should create a chatbot for Microsoft Teams, let’s start by creating one.

And for this tutorial, we are going to use Xenioo:

Create Xenioo Account

The benefit of Xenioo is that you can easily create a chatbot using their visual flow builder and publish it on more than 10 channels.

On the Xenioo website, you can just click on Signup and fill in the form information.

Once you’ve created your Xenioo account, click on New Bot:

xenioo-create-new-bot

Now, Xenioo creates a new bot for you with a pre-built flow in it.

Today we are going to create a chatbot that can do two things:

  • Automatically reply to standard questions, such as “What is the wifi password”
  • And create a complete chatbot flow for requesting vacation time

So let’s start with the first one. In Xenioo, you need to create a new chatbot flow by clicking on the Plus icon:

xenioo-add-new-behavior

Then, Xenioo creates a new chatbot flow you.

By the way, Xenioo uses the word “Behavior” for a chatbot flow. Just know that they use that word, that’s all 😉

Now,  go to the settings of the chatbot flow by clicking on the tools icon on the right:

xenioo-behavior-settings

And then we can give a good name to our chatbot flow, such as “Wifi password” (because we are going to give our wifi password in this flow) and click on Save:

global-operation-wifi-password

The content of this chatbot flow will be pretty simple, we will just tell the user what the wifi password is.

So, you can just click on the Text element under “Start interaction” and change it to “The wifi password is 1234567890”:

xenioo-text-element-wifi

But this doesn’t do anything yet, it does not automatically respond to anything.

To make it automatically respond to the phrase “wifi password”, we need to set up a Global Bot Operation.

In Xenioo, you can click on the Act icon, which will bring you to the Global Bot Operations.

xenioo-view-global-bot-operations

Here, you can click on Add Bot Operation:

xenioo-add-bot-operation

Choose the Text Parse option under “Input”:

xenioo-text-parse

Then, you need to set the Control Expression to “wifi password” (this is the word you want to automatically reply to), the target variable to “last_user_message”, set the behavior to “Wifi password” (the flow we just created) and the Interaction to “Start Interaction” (the block we just edited):

global-operation-wifi-password

By the way, if you want to reply to multiple keywords, you can just type in multiple keywords in the Control expression separated by “|”. For example, if you want to reply to “wifi password” and “password for wifi”, you can type in “wifi password|password for wifi”.

And now your chatbot automatically replies when someone types in “wifi password”. You can easily test this out by clicking on Preview Your Bot on the right side:

xenioo-preview-bot

And then, just click on Start Preview and type in “Wifi password”:

xenioo-bot-preview

Great, that’s working!

Request a vacation in your chatbot

The next thing we are going to do, is we are going to create a flow where someone can request a vacation.

And when someone wants to request a vacation, we are going to ask three simple questions:

  1. When does the vacation start?
  2. How many days do you want your vacation to be?
  3. What is your email?

Again, we will add a new behavior by clicking on the Plus icon:

xenioo-add-new-behavior

And you can give the behavior a good name, such as “Request vacation”, just like we did before.

Now, you need to clone the start interaction:

xenioo-clone-interaction

Then you need to change the name to “Yes”:

xenioo-change-interaction-name

And you can do the same thing for another clone, but only set it to “No”, so that it looks like this:

vacation-flow-start

Don’t worry too much about this now, but we will need it later on in the flow.

Next, we are going to add a new action to our start interaction:

xenioo-add-new-action

And select the Carousel template under “Cards”:

xenioo-carousel-template

Here, we need to set the Card Title and Cart subtitle. So the Card Title will be “Do you want to request a vacation?” and the Card Subtitle will be “Just click one of the buttons below!”:

xenioo-carousel-card-vacation

Then, if you scroll down, you can click on Add Button:

xenioo-carousel-add-button

Choose the Postback button:

xenioo-postback-button

Set the Text to “Yes” and click on Add Operation:

xenioo-postback-button-add-operation

Select the Go To Bot Interaction:

xenioo-go-to-bot-interaction

And connect it to the “Yes” interaction of your “Request vacation” flow:

xenioo-postback-button-vacation

Now, you can add another button for the “No” option, so that your flow eventually looks like this:

vacation-flow-with-buttons

We will first edit the “No” block, which is very simple. Just edit the text to “Okay, no worries” and that will be the end of the flow:

vacation-flow-after-no-button

For the “Yes” option, we are going to ask the three questions. But before we do that, we need to clone the “Yes” interaction three times and give good names to the new interactions, so that it looks like this:

request-vacation-flow-structure

So, let’s start by asking the first question. Just edit the text to “When do you want your vacation to start? Please put the date in the following format: 31-12-2021”:

request-vacation-flow-start-date

Then, you can add a new action and choose for the Generic Input under “Input”:

xenioo-generic-input

Here, you need to set the Control Expression to “(0[1-9]|[12]\d|3[01])-(0[1-9]|1[0-2])-([12]\d{3})” and set the Target Variable to “start_vacation”:

xenioo-date-validation

What this will do, is that Xenioo checks if the date filled in by the user is in the format of “31-12-2021”. When it is in the right format, it will automatically store it in the “start_vacation” variable.

But what happens if the user does not give the right input? Then, we can set an automatic message under Wrong User Input Reply and can set the Max wrong answers to “3”, so that the chatbot will ask this max three times:

xenioo-wrong-date

Next, we are going to set the Go To Bot Interaction to the next block in the flow (“Ask many days”):

go-to-ask-many-days

For the next block, we are going to change the text to “How many do you want to be on vacation? Just type in a number, such as ‘5’.”,  add a new action and choose for the Number Input (Under “Input”):

xenioo-number-input

Here, you need to set the Target Variable to “vacation_days” and set the Wrong User Input Reply and the maximum number of times your chatbot tries:

xenioo-number-vacation-days

By the way, Xenioo automatically checks if the input by the user is a number. Very useful!

Now, connect it to the next block (“Ask email”):

xenioo-go-to-ask-email

In this block, we are just going to ask “What is your email?”, add a new action and choose the Email Address Input element:xenioo-email-address-input

Just like the Number Input element, this element automatically checks if the user filled in a valid email.

By the way, with the Email Address Input you don’t need to set a Target Variable. The email of the user will be automatically stored in the “user_email” variable.

Next, you need to connect this element to the last one (“Confirmation”):

xenioo-go-to-confirmation

In this last element, we are going to do two things:

  1. Thank the user for requesting a vacation
  2. Send an automatic email to someone inside your company

First, just change the text to “Thank you for your request. We will send it to HR and get back to you as soon as possible”.

Secondly, add a new action and choose the Send Custom Mail Message (Under “Integration”):

xenioo-custom-mail-message

NOTE: This is a Premium feature. So you cannot use this feature if you have a free Xenioo account.

Then, you can add to who you want to send the email and the contents of the email:

xenioo-send-custom-mail

And as you can see above, you can just use the values of variable by typing in {{variable_name}}.

So, the final flow will look like this:

xenioo-request-vacation-flow

But again, it does not respond to anything, so we need to create a Global Bot Operation for this.

Just like we did before, add a new Bot Operation, but now you we want to reply when someone types in “vacation”:

xenioo-vacation-keyword

And that’s it, we created a complete chatbot flow for requesting a vacation!

 

Connect your chatbot to Microsoft Teams

Now that we’ve created our chatbot, it’s time to connect it to Microsoft Teams.

In Microsoft Teams, go to Apps, search for the “App Studio” and click on Add:

microsoft-teams-add-app-studio

Click on Create New app:

microsoft-teams-add-application

Generate an app ID and fill in all the required information of the form:

microsoft-teams-app-details

Then, go to “Bots” and click on Set up:

microsoft-teams-setup-bot

Here, you can give your chatbot a name, assign the right permissions and click on Create bot:

microsoft-teams-create-bot

Once you’ve created the bot, you see a value under the title of the bot, which is the Bot ID:

microsoft-teams-copy-bot-id

Just copy this value for now and paste it somewhere in a document.

Next, we need to Generate a new password:

microsoft-teams-create-password-bot

This will show a pop-up with the value of your password. Also copy this value to a document on your computer.

Now, in Xenioo, you need to click on Publish:

xenioo-publish-chatbot

Select Microsoft Teams:

xenioo-microsoft-teams-publish

And paste your Bot ID and password in the fields:

xenioo-paste-microsoft-credentials

Also, you need to copy the Messaging Endpoint, because we need to paste that in Microsoft Teams under “Bot Endpoint Address”:

microsoft-teams-messaging-endpoint

By the way, don’t forget to click on Save and Publish in Xenioo. Otherwise, your chatbot will not be live.

Then, in Microsoft Teams, go to “Test and Distribute” and click on Download:

download-microsoft-teams-chatbot

This will download a Zip file to your computer.

Now, to go “Apps” in Microsoft Teams and click on Submit to app catalog“:

microsoft-teams-submit-app-catalog

And then choose for Upload an app to your org’s catalog:

microsoft-teams-upload-app

When you upload your file, your app should become visible under “Built for your org”:

microsoft-teams-select-chatbot

And when you click on it, you can click on Add which will add it to your Teams organization:

microsoft-teams-add-chatbot

And that’s it! Now you’ve successfully connected your chatbot to Microsoft Teams.

Now It’s Your Turn

And that’s how you create a Microsoft Teams chatbot without writing a single line of code.

Now, I have a question for you:

Why do you want to create a Microsoft Teams chatbot? What are you going to use it for?

Please let me know by leaving a comment below!👇

Leave a Reply