# Slack

> Put your agent in Slack so teammates and customers get answers in channels and DMs. Connect with a bot token and the Events API webhook.

The Slack channel lets your agent answer inside Slack — in DMs, in channels it's invited to, and when it's @-mentioned. It's ideal for internal help desks (HR, IT, ops) and for shared customer channels.

> **PREREQUISITES:** A Slack app in your workspace with a Bot User OAuth token and the Events API enabled.

## Connect Slack

1. **Create a Slack app** — At api.slack.com/apps, create an app, add a bot user, and install it to your workspace to get a Bot User OAuth token.
2. **Enable the channel in Bookbag** — On the agent's Deploy tab, open the Slack card, choose Connect, and paste the bot token (and optionally a default channel).
3. **Point the Events API at Bookbag** — In your Slack app's Event Subscriptions, set the Request URL to the Slack inbound webhook URL shown on the channel card.
4. **Subscribe to message events** — Add the `message.channels`, `message.im`, and `app_mention` bot events, then reinstall the app if Slack asks you to.

## URL verification handshake

When you save the Request URL, Slack immediately POSTs a `url_verification` challenge. Bookbag detects it and echoes the `challenge` value straight back, so the URL is verified automatically — no manual step on your side.

```json
{
  "type": "url_verification",
  "challenge": "3eZbrw1aB..."
}
```

## How replies are sent

When a message arrives, Bookbag ignores bot echoes and subtype events, runs the agent on the message text, and replies by calling Slack's `chat.postMessage` API with your bot token. Replies go to the originating channel or DM, or to the default channel you configured.

> **AVOIDING LOOPS:** Bookbag automatically skips messages from bots and message edits/deletions, so your agent never replies to its own messages.

## What's next

- [Slack integration](/docs/integrations/slack) — Token scopes and connection details.
- [Deploy overview](/docs/deploy/overview) — Connect the rest of your channels.
- [Help Desk](/docs/help-desk/overview) — Route escalations to your team.
