# Microsoft Teams

Microsoft Teams — @mention the bot to query data, agent can post messages

- Category: Apps
- Runs in: the Phloem cloud

Ask Hamming questions in Microsoft Teams by @mentioning your bot, and let Hamming and your alerts post to Teams conversations.

## What you need
- An Azure Bot registration added to Teams, with its messaging endpoint pointed at Phloem
- The bot's **Microsoft App ID** and a client secret for its app registration
- Optional: your Azure AD tenant ID, to accept messages from that tenant only

## Connect
1. In the console, open **Connectors**, choose **Add connector**, then **Microsoft Teams**.
2. Enter **Microsoft App ID** and **App Password** (the client secret). Fill in **Tenant ID** only to limit the bot to one tenant; leave it empty for a multi-tenant bot.
3. Save and test. The test checks the App ID and password with Microsoft.

## What Hamming can do
- **Answer in Teams.** @mention the bot in a channel (`@Phloem what failed on stand 3 today?`) or send it a direct message. Hamming replies in the conversation, with a **View in Phloem** link to the session.
- **Keep the conversation.** Each Teams conversation is one Phloem session, so a follow-up continues it.
- **Post a message** to a conversation, optionally as a reply and with Adaptive Cards. Each post needs your approval by default. An org admin can set **Changes** on the connector to **Off**, **Needs approval** or **Allowed**.

## Notes
- When the bot joins a conversation, it posts a short help card.
- Questions asked in Teams run as the Phloem user who added the connector, whoever asks them.
- With **Tenant ID** set, messages from other tenants are rejected.
- A message sent while Hamming is still answering joins that reply instead of getting its own.
- When your workspace's monthly AI allowance is used up, the bot says so in the conversation.
- To send alerts to Teams, open **Alerts**, add a role, and choose this connector with a conversation id.

## Connection fields

| Field | Type | Required | Notes |
|---|---|---|---|
| Microsoft App ID | Text | Yes | The Azure Bot's Microsoft App ID (from the bot registration). |
| App Password | Secret | Yes | Client secret for the bot's app registration. |
| Tenant ID | Text | No | If set, inbound activities from other tenants are rejected. Leave empty for multi-tenant bots. |
