Rediger

Del via


Build bots for Teams

A bot is also referred to as a chatbot or conversational bot. It's an app that runs simple and repetitive tasks by users such as customer service or support staff. Everyday use of bots include, bots that provide information about the weather, make dinner reservations, or provide travel information. Interactions with bots can be quick questions and answers or complex conversations.

It's recommended to start with build your first bot app using JavaScript or build notification bot with JavaScript by using the new generation development tool for Teams. For more information, see Teams Toolkit overview.

Important

  • Bots are available in Government Community Cloud (GCC), GCC-High, and Department of Defense (DOD) environments. Bot applications within Microsoft Teams for GCC-High and DOD are available through Azure bot Service and bot channel registration must be done in Azure Government portal.

  • Image URLs in Adaptive Cards aren't supported in GCC-High and DOD environments. You can replace an image URL with Base64 encoded DataUri.

  • When a user changes the Teams theme in a bot, the theme doesn’t apply to the content shared using an Adaptive Card.

Conversational bots allow users to interact with your web service using text, interactive cards, and dialogs (referred as task modules in TeamsJS v1.x).

The screenshot is an example that shows a web service using text.

The screenshot is an example that shows a web service using interactive cards.

The screenshot is an example that shows a web service using dialog.

Conversational bots are incredibly flexible. Bots can handle a few basic commands or complex tasks that involve artificial intelligence and natural language processing. Bots can be part of a larger application or be standalone.

Use the right mix of cards, text, and dialogs to create a useful bot. The following image shows a user conversing with a bot in a one-to-one chat using text and interactive cards.

The screenshot is an example that shows a sample FAQ bot.

Every interaction between the user and the bot is represented as an activity. When a bot receives an activity, it passes it on to its activity handlers. See bot activity handlers.

Bots are apps that have a conversational interface. You can interact with a bot using text, interactive cards, and speech. A bot behaves differently in a channel or group chat conversation and in a one-to-one conversation. Conversations are handled through the Bot Framework connector. See conversation basics.

Your bot requires contextual information, such as user profile details to access relevant content and enhance the bot experience. See get Teams context.

You can send and receive files through the bot using Graph APIs or Teams bot APIs. See send and receive files through the bot.

Rate limiting is used to optimize bots used for your Teams application. To protect Teams and its users, the bot APIs provide a rate limit for incoming requests. See optimize your bot with rate limiting in Teams.

With Microsoft Graph APIs for calls and online meetings, Teams apps can now interact with users using voice and video. See calls and meetings bots.

You can use the Teams bot APIs to get information for members of a chat or team. See changes to Teams bot APIs for fetching team or chat members.

Bot name and icon

Bot name: You can change the bot name displayed in Teams environment by updating it in the following occurrences:

  • The bot name, displayed as a title in the chat window, is updated and managed within your app manifest (previously called Teams app manifest).

  • The bot name that's displayed in your Teams chat list and in the chat window with each message is managed within Microsoft Azure portal. For custom uploaded apps, you can update the bot name in the Bot profile page in Azure portal.

    The screenshot shows the bot name displayed in a Teams window.

Bot icon: You can add or update the bot icon for the Teams app as follows. The updated bot icon becomes visible only after the user signs out and signs back into Teams. This is because the icons are cached:

  • Microsoft Teams Store app: For Teams Store apps, bot icons are fetched from the app manifest. You can update the bot profile icon by updating it through the app manifest and republishing the app.

    
    {
      "$schema": "https://developer.microsoft.com/json-schemas/teams/v1.16/MicrosoftTeams.schema.json",
      "manifestVersion": "1.17",
      "version": "1.0.0",
      "id": "%MICROSOFT-APP-ID%",
      "icons": {
         "outline": "A relative path to a transparent .png icon — 32px X 32px", // This icon is used for bot profile.
         "color": "A relative path to a full color .png icon — 192px X 192px"
      },
      "bots": [
      {
        "botId": "%MICROSOFT-APP-ID-REGISTERED-WITH-BOT-FRAMEWORK%",
        "scopes": [
          "team",
          "personal",
          "groupChat"
        ]
      }
      ]
    ...
    }
    
    
  • Uploading a custom app in Teams or custom apps built for your org (LOB apps):

Specify host runtime requirements (developer preview)

To ensure your app always provides customers with high-quality experiences, you can tailor your app's behavior in applicable Microsoft 365 hosts, or omit it from surfacing in contexts that you're not ready to support. Use app manifest to specify any dependency relationships across capabilities of your app, and specific runtime requirements of your static tabs, message extensions, and bots.

For more information, see how to specify Microsoft 365 host runtime requirements in your app manifest.

Add SSO authentication to your conversation bots

You can add single sign-on authentication to your conversation bot using the following steps:

Bot configuration experience

Bot configuration experience helps you to enable the bot settings for users to configure their bot during installation and reconfigure the bot from the channel or group chat scope where the bot is installed. Bot configuration is an important functionality for apps within the Teams platform, laying the foundation for their operational effectiveness. For more information, see bot configuration experience.

Code samples

Sample name Description .NET Node.js Manifest
Bot daily task reminder This sample shows how to schedule a recurring task and get a reminder at a scheduled time using bot. View View View
Hello world bot This is a simple hello world application with both bot and message extension capabilities. NA View
Adaptive Card notification This is a sample, which shows how to send notifications with different Adaptive Cards using bots. NA View
Incoming Webhook notification This is a sample, which shows how to send notifications using Incoming Webhook in Microsoft Teams channels. NA View

Next step

See also