# Slack Integration for Biel.ai

> For the complete documentation index, see [llms.txt](/llms.txt)

> Connect your Biel.ai project to Slack so users can ask questions and get AI-powered answers directly from any Slack channel or DM.

# Slack integration

Connect your Biel.ai project to Slack and let users interact with your documentation bot from any channel or direct message.

![Slack Integration](./images/slack-integration.png)

## Prerequisites

- A [Biel.ai account](https://app.biel.ai) with at least one project and indexed documentation.
- A **Slack workspace** where you have permission to install apps.
- Admin access to your Biel.ai dashboard.

## Setup

### 1. Connect your Slack workspace

1. In the Biel.ai dashboard, open the project you want to connect.
2. Click **Settings**, then select **Integrations** in the settings sidebar.
3. On the Slack card, click **Connect**.
4. You will be redirected to Slack's authorization screen. Review the permissions and click **Allow**.
5. Once authorized, Slack redirects back to Biel.ai and the workspace is connected.

### 2. Invite the bot to a channel

After connecting, invite the bot to any channel where you want it to respond:

```text
/invite @Biel.ai
```

For direct messages, users can find the bot by searching its name in the Slack search bar.

## Advanced: use your own Slack app

Create your own Slack app to use a custom bot name and icon, such as **Support Assistant**. Use this setup instead of the standard **Connect** flow.

### 1. Create your Slack app

1. Go to [api.slack.com/apps](https://api.slack.com/apps) → **Create New App** → **From scratch**, and give it the name you want.
2. Under **OAuth & Permissions** → **Bot Token Scopes**, add: `chat:write`, `app_mentions:read`, `im:history`, `users:read`, `users:read.email`.

   `users:read` and `users:read.email` are optional. Include them to show the sender’s email in the dashboard. Without them, conversations show “Unknown”.
3. Under **Event Subscriptions**, set the **Request URL** to:
   ```text
   https://app.biel.ai/api/v1/slack/webhook/
   ```
   Slack verifies it automatically. Then, under **Subscribe to bot events**, add `app_mention` and `message.im`.
4. Go back to **OAuth & Permissions** and, in the **OAuth Tokens** section, click **Install to _(your workspace name)_**, then **Allow** on the confirmation screen. This adds the bot to your workspace and generates its **Bot User OAuth Token**. You need permission to install apps in the workspace. If you don't, an admin has to approve it.

### 2. Copy the two credentials

- **Bot User OAuth Token** (`xoxb-...`): from **OAuth & Permissions**.
- **Signing Secret**: from **Basic Information → App Credentials**.

### 3. Connect it in Biel.ai

1. In your project, go to **Settings → Integrations**.
2. On the Slack card, click **Use your own Slack app (advanced)**.
3. Paste the **Bot User OAuth Token** and **Signing Secret**, then click **Connect**.

After connecting, [invite the bot to a channel](#2-invite-the-bot-to-a-channel). Use your chosen bot name in place of `@Biel.ai` in the examples below.

:::note
A Slack workspace runs one Biel-connected app at a time. Your own app replaces the default app.
:::

## Usage

### Asking questions

In a channel, mention the bot followed by your question:

```text
@Biel.ai how do I authenticate with the API?
```

The bot replies in a thread anchored to your message.
To ask a follow-up with the same context, mention `@Biel.ai` again inside that thread, and Biel uses the thread's history. Mentions from the channel root always start a new thread with fresh context.

In a direct message, send your message directly, no mention needed:

```text
What are the system requirements?
```

### Resetting a conversation

Each thread keeps its own context for follow-up questions. To reset a thread, mention the bot with `clear` inside it:

```text
@Biel.ai clear
```

The bot confirms in the thread, and your next message there starts a fresh conversation. Other threads are unaffected.

:::tip[Not getting answers?]
Make sure your Biel.ai project has indexed content. Open the project dashboard and check that it shows **Sources loaded**.
:::

## Bot token scopes

Biel.ai requests these Slack bot token scopes. The default **Connect** flow lists them on Slack's authorization screen, and you add them by hand when you [use your own Slack app](#1-create-your-slack-app).

| Scope | Required | Access |
| ----- | -------- | ----------------- |
| `app_mentions:read` | Yes | Detects when users mention `@Biel.ai` in a channel so the bot can answer in a thread. |
| `chat:write` | Yes | Posts the bot's answers and confirmation messages back into channels and threads. |
| `im:history` | Yes | Reads direct messages sent to the bot so users can ask questions privately. |
| `users:read` | For attribution | Looks up the sender of each conversation so your dashboard shows who started it instead of "Unknown". |
| `users:read.email` | For attribution | Resolves the sender's email so conversations are attributed to that user in your dashboard. |

The two attribution scopes are optional. Leave them out and the bot still works, but conversations stay unattributed in your dashboard. See [Conversations show "Unknown"](#troubleshooting) if attribution isn't working.

To disconnect, open your project’s **Settings** > **Integrations**, click **Disconnect** on the Slack card, and confirm **Disconnect**. To reconnect, reinstall the bot in your workspace.

## Troubleshooting

**The bot does not respond to mentions**

Make sure the bot has been invited to the channel with `/invite @Biel.ai`. The bot can only see messages in channels it has been added to.

**The conversation won't reset**

Reset is per thread: mention the bot with `clear` (`@Biel.ai clear`) *inside the thread* you want to reset. There is no channel-wide or slash-command reset.

**The bot gives incorrect or outdated answers**

In your project’s dashboard, click **Refresh sources** and wait for **Sources loaded**. Check **Logs** if indexing fails.

**Conversations show "Unknown" instead of the user's email**

Email attribution needs the `users:read` and `users:read.email` scopes. If you connected Slack before these were added, reconnect the integration (or, for your own Slack app, add the two scopes and reinstall the app to your workspace) to grant them. Conversations started after reconnecting will be attributed. Older ones stay as they were.

---

Need help? [Contact us](https://biel.ai/contact) or visit the [support page](https://docs.biel.ai/support.md).
