DEV Community

Albert Bennett
Albert Bennett

Posted on • Updated on

How to: Connect a MS Bot Framework chatbot to MS Teams using Azure

For this tutorial I'd like to show how you can attach a chatbot to a channel in MS Teams.

Step 1:
To start in Azure we need to create an Azure Bot. This is a service that is going to allow us to seamlessly integrate with our MS Teams instance. Is defines settings and configurations, for connecting the bot to MS teams. Here are the settings that I had used to deploy the Azure Bot:
Azure Bot Settings

It is worth mentioning that I had set the option 'Microsoft App ID' to 'Create new Microsoft App ID' instead of using an existing app registration. You can use an existing one if you need to but, I didn't want to go and create a new one manually.

Step 2:
Next we need to configure the Azure Bot to connect with the messaging endpoint of our bot. To do this we will start by going to the Configuration panel and setting the messaging endpoint of our bot.
image
The rest of the settings should be fine in the Configuration panel. Don't forget to click apply afterward.
It is also worth noting that in you App Service for your bot you need to add the app settings for: 'MicrosoftAppPassword' and 'MicrosoftAppId' with values from the Microsoft App registered with the Azure Bot. This is so that the two can authenticate with each other.
You can test if the configuration is correct at this time by going to the 'Test in Web Chat' panel and messaging your bot.
image

Step 3:
Next up we need to configure the channels, so that we can access our bot on teams.
To do this we need to go to the Channel panel and then click on the MS Teams icon.
image
From here its just a matter of ticking some boxes well.. only one that being Microsoft Teams Commercial under messaging. The rest of the defaults are fine. Next it is on to testing the bot in teams. This is just two clicks away. First click on channels then on 'Open in Teams'. You should be presented with the 'Join Conversation' page in MS Teams.
image
Open in teams, and you can see...
image

As you can see we can contact the bot through a channel in MS Teams. From here, you start contacting your bot through chats, using the new chat box at the top of the screen in Teams.
image




If you found something useful in the blog post feel free to leave a like I'd really appreciate it.
You can also connect with me on Linkedin as well if you'd like.

Top comments (0)