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

# Slack

> Connect OpenBunny to Slack using Socket Mode for real-time message processing.

OpenBunny connects to Slack using Socket Mode, which means no public URL or webhook is required. Messages are received in real time over a WebSocket connection.

## Prerequisites

* A Slack workspace where you have admin access
* A Slack app with Socket Mode enabled

## Create a Slack app

<Steps>
  ### Create the app

  Go to [api.slack.com/apps](https://api.slack.com/apps) and create a new app from scratch.

  ### Enable Socket Mode

  Go to **Socket Mode** in the sidebar and enable it. This generates an **app-level token** starting with `xapp-`.

  ### Add bot scopes

  Go to **OAuth & Permissions** and add these bot token scopes:

  * `channels:history` — read messages in public channels
  * `groups:history` — read messages in private channels
  * `im:history` — read direct messages
  * `mpim:history` — read group direct messages
  * `users:read` — read user profiles

  ### Enable event subscriptions

  Go to **Event Subscriptions** and enable events. Subscribe to these bot events:

  * `message.channels`
  * `message.groups`
  * `message.im`
  * `message.mpim`

  ### Install the app

  Go to **Install App** and install to your workspace. Copy the **bot token** starting with `xoxb-`.

  ### Configure environment

  ```bash .env theme={null}
  SLACK_APP_TOKEN=xapp-1-your-app-token
  SLACK_BOT_TOKEN=xoxb-your-bot-token
  ```
</Steps>

## How it works

The service uses `@slack/socket-mode` to maintain a persistent WebSocket connection. When a message is received:

1. The message is normalized and stored in the conversations/messages tables
2. The debounce timer resets for that conversation
3. After the debounce period, the scheduler picks up the conversation for LLM processing

## Channel selection

By default, OpenBunny listens to all channels the bot is invited to. Invite the bot to specific channels using `/invite @OpenBunny` in Slack.
