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

# Ankra AI on call in Slack or Microsoft Teams

> Send your alerts to a Slack or Microsoft Teams channel, ask Ankra AI about one in its thread, and approve the fix it proposes without leaving chat.

When an alert fires at night, the fastest answer is the one that arrives where your team already is. In this tutorial you connect Ankra AI to Slack or Microsoft Teams, send an alert to a channel, ask Ankra AI about it in the alert's thread, and confirm the fix it proposes from the same thread.

You end up with one channel that receives an alert, a thread where Ankra AI investigates it with the alert as context, and a fix confirmed under your own name.

## Before you start

* **An owner or admin role** in your Ankra organisation, to connect a chat app and change its AI mode. See [Roles and access](https://docs.ankra.ai/guides/roles-and-access.md).
* **A role that may manage alerts** (`alerts.manage`), to add a notification destination and change an alert rule.
* **An alert rule on a cluster.** If you have none, add one first: see [Alerts](https://docs.ankra.ai/guides/alerts.md).
* **Slack:** a workspace where you may install apps. **Microsoft Teams:** Ankra AI allowed in your tenant. If your tenant restricts Store apps, your Teams administrator allows it once; [Connecting Microsoft Teams](https://docs.ankra.ai/platform/ai-connections.md#connecting-microsoft-teams) has a message to send them.
* **For the CLI steps:** the [Ankra CLI](https://docs.ankra.ai/reference/cli/index.md), signed in.

**1. Connect your chat app**

> [tab] Slack
>
> Open **Ankra AI → Gateway connections** (`/next/ai/settings/gateway`). In the **Slack** section, press **Add to Slack**, approve the app in Slack, and come back.
>
> ```bash theme={null}
> ankra slack connect
> ```
>
> Ankra says **The Slack workspace is connected.**, and the workspace shows as a row in the **Slack** section. `ankra slack status` lists it too.

> [tab] Microsoft Teams
>
> In Teams, open **Apps**, search for **Ankra AI** and press **Add**. Add **Ankra AI** to the team whose channel should receive alerts. The bot sends you a welcome card in a personal chat: press **Connect to Ankra**, and press **Connect** on the page that opens.
>
> The tenant shows as a row in the **Microsoft Teams** section of **Ankra AI → Gateway connections**.

Each step is explained in full, with what to do when it does not work, in [AI Connections](https://docs.ankra.ai/platform/ai-connections.md).

**2. Link your account and let Ankra AI act**

Mention the bot once in any channel it is in (**@Ankra** in Slack, **@Ankra AI** in Teams), press **Connect Ankra account** in its reply, and sign in. Its next answers run with your own Ankra permissions.

Then, on the workspace's or tenant's row on **Gateway connections**, switch the AI mode from **Ask** to **Agent**. The row is now marked **Can act**.

> [!WARNING]
>
> In **Ask** mode, Ankra AI only reads, and the buttons that change something are refused. **Agent** lets it make changes with the permissions of the person who asks. Every change still waits for a person to confirm it in the thread.

**3. Add the channel as a destination**

> [tab] Portal
>
> Open **Integrations & alerts → Notification destinations** (`/next/organisation/notification-destinations`) and press **Add destination**.
>
> 1. Set **Kind** to **Slack** or **Microsoft Teams**.
> 2. Under **How Ankra posts**, choose **To a channel**, then pick the **Channel**.
> 3. Give it a **Name**, such as `on-call`, and press **Add destination**.
>
> The destination shows in **Destinations**. Open its options menu and press **Send a test**: the page says **Test sent to on-call**, and the test arrives in the channel.

> [tab] CLI
>
> Find the channel, then add it as a destination. For Slack, use `--provider slack` and leave out `--teams-tenant-id`.
>
> ```bash theme={null}
> ankra alerts destinations channels --provider teams
> ankra alerts destinations create --name on-call --type teams \
>   --channel-id "19:...@thread.tacv2" --teams-tenant-id <tenant-id>
> ```
>
> The new destination's ID is in the output. You need it in the next step.

In Teams, a team the bot is already in can list no channels. Mention **@Ankra AI** once in that team, then reload.

**4. Send an alert to the channel**

> [tab] Portal
>
> Open **Integrations & alerts → Alert rules**, open the rule's options menu and press **Change…**. Under **Tell these destinations**, tick `on-call` and press **Save**.
>
> The alert now goes to the channel each time the rule fires. To send every alert there instead, add a routing rule on **Integrations & alerts → Notification routes**: press **Add rule**, choose **A destination** under **Send to** and pick `on-call`, choose **Only these kinds** and tick **Alert firing**, then press **Add rule**.

> [tab] CLI
>
> Route every firing alert to the destination:
>
> ```bash theme={null}
> ankra alerts routes create --destination-id <destination-id> --organisation-wide \
>   --kinds alert_trigger_fired
> ```

Check where an alert would go, without sending anything:

```bash theme={null}
ankra alerts routes preview --kind alert_trigger_fired
```

The destination you added is listed. In the portal, **Where would it go?** on **Notification routes** answers the same question.

**5. Ask Ankra AI in the alert's thread**

When the alert fires, its card arrives in the channel with **Acknowledge** and **Snooze 1h**. Reply in the card's thread and mention the bot, for example:

```text theme={null}
@Ankra what is causing this alert, and what would fix it?
```

Ankra AI reads the thread it was mentioned in, so it starts from the alert you are looking at. In Slack it reads up to 50 of the thread's replies the first time it is mentioned there; in Teams the app reads the thread from version 1.1.0. Say `use cluster <name>` to point the thread at one cluster. Its answer is visible to everyone in the channel, and you can follow up in the thread without mentioning it again in Slack.

**6. Approve the fix from chat**

When Ankra AI proposes a change, the bot posts a **Confirmation needed** card with **Confirm** and **Deny**. Read what the card says it will change, then press **Confirm**. A decided card is replaced by its outcome.

Only the person who asked can decide the card. If the cluster changed in the meantime, the card shows what moved and offers **Confirm anyway**.

Fixes that Ankra AI starts on its own, from an alert, follow the level on **Ankra AI → Autonomy and approvals**. With **Ask first**, every fix waits for an organisation admin to approve or deny it, on a card the approvals Slack webhook posts with **Approve** and **Deny**, or in **Needs you**. See [AI Autonomy](https://docs.ankra.ai/platform/ai-autonomy.md).

## Verify

1. The alert's card in the channel reads its outcome where **Confirm** was.
2. Open **Identity & access → Audit log** (`/next/organisation/audit`). The change is recorded under your name, not the bot's.
3. Run `ankra alerts routes preview --kind alert_trigger_fired` again. The channel is still where a firing alert goes.

## What can go wrong

| What you see | What to do |
| - | - |
| **Alert actions are disabled for this workspace** (or AI actions, or ticket actions) | For AI or ticket actions the connection may be in **Ask** mode, where new connections start by default: switch it to **Agent** on **Gateway connections**. Otherwise an organisation admin turned the action off; ticket buttons follow the alert-actions switch. |
| **Your Ankra role cannot confirm AI actions in this organisation** | Your role does not allow the change. Ask someone whose role does to ask, and confirm, in the thread. |
| A connect prompt every time you mention the bot | Your own account is not linked. Press **Connect Ankra account** and sign in once. |
| **The test to on-call did not arrive** | Ankra could not post to the channel. In Slack, check the app is in the workspace; in Teams, check the bot was added to the team. Then send the test again. |
| The bot does not answer in the thread | Mention it by name: in a channel it answers only messages that mention it. |
| **This Teams workspace is not linked to an Ankra organisation yet** | The tenant is not connected. Do step 1 for Microsoft Teams. |
| The alert never reaches the channel | Run `ankra alerts routes preview --kind alert_trigger_fired`. If the destination is not listed, tick it on the alert rule or add the routing rule in step 4. |

More answers for each chat app are in [AI Connections](https://docs.ankra.ai/platform/ai-connections.md#if-something-does-not-work).

## Where to go next

* [Notification routing](https://docs.ankra.ai/guides/notification-routing.md) - send other notifications, such as failed pipelines, to the same channel, or one channel per project.
* [AI Autonomy](https://docs.ankra.ai/platform/ai-autonomy.md) - choose which fixes Ankra AI may run on its own and which wait for a person.
* [Set up the AI Gateway](https://docs.ankra.ai/platform/ai-guided-setup.md) - connect pull requests and email alongside chat.


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