---
title: Slack
icon: slack
description: Set up a Slack Bot Token for the Slack resource.
---

## Credentials

### 1. Create a Slack App

1. Go to https://api.slack.com/apps
1. **Create New App** -> **From scratch**
1. Name it (e.g., "Mirage") and select your workspace

### 2. Configure Bot Permissions

1. **OAuth & Permissions** in the left sidebar
1. Under **Bot Token Scopes**, add:
   - `channels:history` - read messages in public channels
   - `channels:read` - list public channels
   - `groups:history` - read messages in private channels (optional)
   - `groups:read` - list private channels (optional)
   - `chat:write` - send messages (for write mode)

### 3. Install to Workspace

1. **Install App** in the left sidebar -> **Install to Workspace**
1. Authorize the requested permissions
1. Copy the **Bot User OAuth Token** (`xoxb-...`)

### 4. Optional: Enable Workspace Search

Slack's `search.messages` API does not accept bot tokens. To use `slack search` or workspace-level search push-down:

1. Add `search:read` under **User Token Scopes**.
1. Reinstall or reauthorize the app.
1. Copy the resulting **User OAuth Token** (`xoxp-...`).

Keep using the bot token for normal reads and writes. Mirage uses the optional user token only for Slack search endpoints.

### 5. Set Environment Variables

```bash
# .env.development
SLACK_BOT_TOKEN=xoxb-xxxx...
SLACK_USER_TOKEN=xoxp-xxxx...  # optional, only needed for workspace search
```

### 6. Invite the Bot

The bot must be invited to channels it needs to read:

```
/invite @Mirage
```

For Python configuration, see the [Python Slack Setup](/python/setup/slack) guide.
