Connect a bot to Microsoft Teams


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.


Configure your bot in Azure

  1. Open the Azure portal.
  2. Open the Azure Bot resource blade for your bot.
  3. Open Channels and select Microsoft Teams:
    1. Read and agree to the terms of service.
    2. 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.
    3. Select Apply.
  4. Select Get bot embed code, locate the embed code for Teams, and then copy the https part of the code. For example, You can use this code to test the bot in Teams.


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, isn't recommended. Doing so severely limits the functionality of a bot. Bots in production should be added to Teams as part of an app.

  1. 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.
  2. 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's 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 the Teams overview of how to Distribute your Microsoft Teams app. It and the associated articles cover how to:

  • Choose and configure install options for your bot
  • Create your Teams app manifest, icon, and package
  • Upload your app to Teams
  • Publish your app to your org or to the Teams store

Additional information