Connect a bot to Microsoft Teams
APPLIES TO: SDK v4
You can configure your bot to communicate with people via Microsoft Teams. This article describes how to create a Teams app in Teams, connect your bot to your Teams app in Azure, and then test your bot in Teams.
- An Azure subscription. If you don't already have one, create a free account before you begin.
- A bot published to Azure that you want to connect to Teams.
- A developer tenant in Teams with custom app uploading or sideloading enabled. For more information, see Prepare your Microsoft 365 tenant.
- A valid Teams app package. For more information, see Upload your app in Microsoft Teams.
Configure your bot in Azure
- Open the Azure portal.
- Open the Azure Bot resource blade for your bot.
- Open Channels and select Microsoft Teams:
- Read and agree to the terms of service.
- On the Messaging tab, select the cloud environment for your bot. For more information, see the Post build section of Plan your app with Teams features.
- Select Apply.
- Select Get bot embed code, locate the embed code for Teams, and then copy the https part of the code. For example,
https://teams.microsoft.com/l/chat/0/0?users=28:b8a22302e-9303-4e54-b348-343232. You can use this code to test the bot in Teams.
- The Calling tab supports the Teams calling feature. For more information, see Register calls and meetings bot for Microsoft Teams.
- The Publish tab contains information about how to publish your Teams app to the Teams Store.
Test your bot in Teams
Bots in production should be added to Teams as part of a Teams app. For more information, see Test your app.
Adding a bot by GUID, for anything other than testing purposes, is not recommended. Doing so severely limits the functionality of a bot. Bots in production should be added to Teams as part of an app.
- In your browser, open the URL you copied from your embed code, then choose the Microsoft Teams app (client or web) that you use to add the bot to Teams. You should be able to see the bot listed as a contact that you can send messages to and receive messages from in Microsoft Teams.
- Interact with your bot in Teams.
Use one bot channel registration per environment, since your endpoint changes when you switch between local development, staging, and production environments.
Deleting the Teams channel registration will cause a new pair of keys to be generated when it is re-enabled. This invalidates all 29:xxx and a:xxx IDs that the bot may have stored for proactive messaging.
Publish your bot in Teams
For instructions on how to publish your app, see Distribute your Microsoft Teams app.
- For more about Teams app development, see Build apps for Microsoft Teams and Get started.
- For more about creating bots for Teams, see Bots in Microsoft Teams.
- For more about publishing and testing a bot in Teams, see Distribute your Microsoft Teams app and Test your app.
- To provide feedback and find additional resources, see Microsoft Teams developer community channels.
Submit and view feedback for