Register a bot with the cloud communications API

You can use the cloud communications API in Microsoft Graph to build bots to respond to your customers' needs and facilitate collaboration. This article describes how to register your bot and then manage the state of your bot.

Prerequisites

Before you get started, familiarize yourself with the following topics:

Register a bot

The terms "service application" and "bot" can be used interchangeably. You can either create a bot through the Azure portal directly or register a bot that isn't hosted on Azure. For more information, see Registering a calling bot.

To make things easier later, it's helpful to understand the different types of permissions within Microsoft Entra ID. Apps with delegated permissions require a signed-in user. Application-based permissions don't need a signed-in user and can often run as a background service.

After you register your bot, if you'd like to add your bot to Microsoft Teams, make sure you understand how to use the Developer portal for teams and define the required metadata.

Manage the state of the bot

After registering your bot, decide whether you want your audio and video-based media to be application-hosted or service-hosted. At a high level, this involves deciding whether or not you want to access a live-stream of raw media.

Next, you can decide whether your bot should be stateful or stateless.

Stateless bots

Any virtual machine can handle any bot instance, which means that if one machine goes down, another can take care of it. This makes for a resilient solution.

On the other hand, a shared cache, such as REDIS, needs to be accessible to all the virtual machines.

Stateful bots

A virtual machine can handle only one bot instance at a time. Because all the states are on one machine, there aren't any extra memory or REDIS cache checks.

The drawback is that it isn't as resilient because the bot instance is just on one computer.

Note

Service-hosted media bots can be stateful or stateless. Application-hosted media bots must be stateful to use the Bot Media SDK.

Use the SDKs

The following SDKs are available in C#. We'll provide support for other languages in the future.

Examples

Learn how to implement different scenarios using stateful bots, such as answering an incoming call with either application-hosted or service-hosted media.

For more examples, see the Communications samples repository.

Privacy and compliance

In the requests to our APIs, sensitive data shouldn't be sent in client-side generated IDs (such as scenario IDs, request IDs, or other correlation IDs) in headers or the request body. These IDs are logged on the server side for diagnostics.