> ## Documentation Index
> Fetch the complete documentation index at: https://docs.atonom.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Microsoft Teams

> Create a Microsoft Teams bot in your own Microsoft tenant and connect it to an Atonom Cloud Employee.

Connect a Microsoft Teams bot to an Atonom Cloud Employee. You create the bot in your own Microsoft tenant. Atonom does not publish a bot for you.

One company uses one Microsoft directory. That directory can hold more than one bot. Each bot needs its own Entra app, Azure Bot, and app package. A second company needs its own directory.

When a conversation closes, Atonom sends the [external chat webhook](https://docs.atonom.ai/webhooks/external-chat.md). For Microsoft Teams, `provider` is `msteams` and `workspace_id` is the Directory (tenant) ID.

***

## Create the Entra app

1. Sign in to the [Microsoft Entra admin center](https://entra.microsoft.com/) as an administrator.
2. If you have more than one tenant, use the **Settings** icon in the top menu and switch to the tenant for this bot.
3. Go to **Entra ID → App registrations**.
4. Click **New registration**.
5. Enter a name.
6. Set **Supported account types** to **Single tenant only**.
7. Leave the redirect URI empty. Click **Register**.
8. On the app **Overview** page, copy these two values:
   * **Application (client) ID**. This is the App ID you paste into Atonom.
   * **Directory (tenant) ID**. This is the Azure tenant ID you paste into Atonom.

***

## Create the client secret

1. On the same app, open **Certificates & secrets**.
2. Click **New client secret**.
3. Enter a description and an expiry. Click **Add**.
4. Copy the secret **Value** immediately. Microsoft shows it only once. This is the client secret you paste into Atonom.

To replace an expired secret, create a new one and paste the new value into the Cloud Employee. The App ID and the Directory (tenant) ID stay the same.

***

## Expose an API

1. On the same app, open **Expose an API**.
2. Click **Add** next to **Application ID URI**.
3. Set the URI to `api://` plus the Application (client) ID. For example, `api://11111111-2222-3333-4444-555555555555`.
4. Click **Save**.

Use this same URI in the Developer Portal. The Developer Portal writes it into the zip. It does not register the URI on the Entra app.

***

## Let the bot read the sender's email

The Teams message contains the sender's Entra object id. It does not contain an email. Atonom calls Microsoft Graph to read `mail`, and uses `userPrincipalName` when `mail` is empty.

1. On the same app, open **API permissions**.
2. Click **Add a permission → Microsoft Graph → Application permissions**.
3. Add **User.ReadBasic.All**.
4. Click **Grant admin consent** for your organization.
5. Confirm the status for **User.ReadBasic.All** is **Granted**.
6. Click **Add a permission → Microsoft Graph → Application permissions** again.
7. Add **TeamsAppInstallation.ReadWriteSelfForUser.All**.
8. Click **Grant admin consent** for your organization.
9. Confirm the status for **TeamsAppInstallation.ReadWriteSelfForUser.All** is **Granted**.

> [!NOTE]
>
> These are application permissions. **User.Read** only works for a signed-in user, so it does not cover this bot. Do not add **User.Read.All**.

Without **User.ReadBasic.All**, people can still chat with the bot. Atonom may not receive the sender's email. Without **TeamsAppInstallation.ReadWriteSelfForUser.All**, the bot cannot message a person first.

***

## Create the Azure Bot

Create the bot in the same tenant as the Entra app. Use **Single Tenant**. Keep this bot after you upload the app package. The package does not replace it.

The bot code stays on Atonom. This resource only registers the bot with Azure.

### Add an Azure subscription

The Teams tenant and the Azure subscription are separate. Add a subscription when the **Subscription** list on the create page is empty. An administrator of this tenant does these steps.

1. Sign in to the [Azure portal](https://portal.azure.com/) as an administrator of the same tenant as the Entra app.
2. Open **Subscriptions**, then click **Add**.
3. If Azure asks for a billing account, name the subscription and set the directory to this tenant. Choose **Microsoft Azure Plan**.
4. If there is no billing account, open [Create an Azure account](https://azure.microsoft.com/pricing/purchase-options/azure-account). Sign up with a work email in this tenant. A credit card is required for the identity check. The free account adds the subscription to this tenant.
5. Return to the Azure portal. The new subscription appears in the list.

### Create the bot resource

1. Open [Create an Azure Bot](https://portal.azure.com/#create/Microsoft.AzureBot). Or open the [Azure portal](https://portal.azure.com/), type `Azure Bot` in the top search box, open **Azure Bot**, and click **Create**.
2. If the tenant is wrong, use the gear icon, open **Directories + subscriptions**, and switch to the same tenant as the Entra app.
3. If **Subscription** is empty, add one with the steps above, then return to this page.
4. On the first screen, set **Plan** to **Azure Bot**. This is the product name. The price is on the next page. Continue.
5. On **Basics**, enter the bot handle. Use the name people should see in the Teams chat.
6. Create a new resource group. Name it after the bot.
7. Set **Pricing tier** to **Free**. If the page shows Standard, click **Change plan** and choose **Free**.
8. Under **Microsoft App ID**, set the type to **Single Tenant**.
9. Set **Creation type** to **Use existing app registration**.
10. Paste the **Application (client) ID** into **Microsoft App ID**. Paste the **Directory (tenant) ID** into **App tenant ID**. Both values are on the Entra app **Overview** page.
11. Click **Review + create**, then **Create**.
12. When deployment finishes, click **Go to resource**. Open **Settings → Configuration**.
13. Set the messaging endpoint to:

```
https://app.getsignals.ai/api/chatinator/msteams-actions
```

14. Click **Apply**.
15. Open **Settings → Channels**. Under **Add a featured channel**, click **Microsoft Teams**. Agree to the terms. On the **Messaging** tab, select **Microsoft Teams commercial (most common)**. Leave the **Calling** tab empty. Click **Apply**. The channel list then shows Teams as running.

> [!NOTE]
>
> Use the same messaging endpoint for every Cloud Employee. Atonom tells tenants apart by the Directory (tenant) ID on each message.

***

## Publish the app to your organization

Build the app package in the [Teams Developer Portal](https://dev.teams.microsoft.com/apps), then upload that zip in the Teams admin center. A personal upload inside the Teams client does not create the organization catalog app.

Open the Developer Portal site and sign in with the same tenant. You do not install a Teams app first.

### Build the package

1. Click **Apps → New app**. Enter the bot name.
2. Open **Configure → Basic information**. Teams rejects the zip when these fields are empty:
   * Short name
   * Short description
   * Full description
   * Developer name
   * Website, privacy policy, and terms of use. Each value must start with `https://`. If you do not have a privacy page or a terms page, use `https://getsignals.ai/privacy-policy`.
   * **Application (client) ID**: the Entra app ID
3. Click **Save**.
4. Open **Branding**. Upload a color icon, 192×192 pixels, and an outline icon, 32×32 pixels.
5. Open **App features → Bot**.
6. In **Enter a bot ID**, paste the Application (client) ID. The page does not list your Azure Bots.
7. Select the **Personal** scope only.
8. Leave these boxes off: **Upload and download files**, **Only send notification**, **Supports audio calls**, and **Supports video calls**.
9. Click **Save**.
10. Open **Single sign-on**. Set the Application ID URI to the same `api://` URI from **Expose an API**. Click **Save**.
11. Click **Apps** in the left pane to return to the list.
12. On that app's row, click **...**, then **Download app package**.

The download is one `.zip` file. Upload that file. Leave the zip closed.

### Upload the zip

1. Open the [Teams admin center](https://admin.teams.microsoft.com/) as a Teams administrator.
2. Go to **Teams apps → Manage apps**.
3. At the top right, click **Actions → Add new app**. Select the zip.
4. Open the app. Open the **About** tab.
5. Copy **App ID**. This is the Catalog app ID you paste into Atonom.
6. Stay on this app. Open **Users and groups**.
7. Select **Availability**. Select **Edit availability**. In **Available to**, select **Everyone**. Select **Apply**.
8. Select **Installs**. Select **Install app**. Select **Everyone**. Select **Apply**. If **Install app** is not shown, select **Edit installs**, then **Everyone**, then **Apply**.

If Teams says an app with the same app ID is already in the catalog, the first upload is already there. Clear the search box. Check **Pending approval** at the top. In **Filter**, include publishing status **Submitted** and status **Blocked**. Search the short name. Open that app. The **About** tab **App ID** is the Catalog app ID. To replace the package, stay on that details page and use **Upload file**.

> [!NOTE]
>
> The Catalog app ID is not the Application (client) ID. If the About tab App ID equals the Application (client) ID, that row is a personal sideload, not the organization catalog app.

***

## Link the bot to a Cloud Employee

1. In Atonom, open the Cloud Employee **channel settings**.
2. Open the **external chat** channel.
3. Choose **Microsoft Teams**.
4. Paste these four values and save:
   * **Azure tenant ID**: the Directory (tenant) ID
   * **App ID**: the Application (client) ID
   * **Catalog app ID**: the About tab App ID from the Teams admin center
   * **Client secret**: the secret value

People install the app from **Apps → Built for your org** in Teams, then open the chat and send a message. A direct message does not need an @mention.

To change a saved value, open the same platform form, edit the field, and save again. The form shows the values already saved for this Cloud Employee.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.