Slack Channel Setup
OpenCrust connects to Slack via Socket Mode - no public URL or webhook needed. The bot receives messages over a WebSocket and responds with streaming edits.
Prerequisites
- A Slack workspace where you have permission to install apps.
- A Slack app created at api.slack.com/apps.
Step-by-step Setup
1. Create a Slack App
- Go to api.slack.com/apps and click Create New App.
- Choose From scratch.
- Name your app (e.g. "OpenCrust") and select your workspace.
2. Enable Socket Mode
- In the left sidebar, go to Socket Mode.
- Toggle Enable Socket Mode on.
- You will be prompted to create an app-level token. Name it anything (e.g. "opencrust-socket") and add the
connections:writescope. - Copy the token - it starts with
xapp-. This is your App Token.
3. Subscribe to Events
- In the left sidebar, go to Event Subscriptions.
- Toggle Enable Events on.
- Under Subscribe to bot events, add:
message.im- messages in direct messagesmessage.channels- messages in public channels (if you want group support)message.groups- messages in private channels (if you want group support)
4. Set OAuth Scopes
- In the left sidebar, go to OAuth & Permissions.
- Under Bot Token Scopes, add:
chat:write- send messagesfiles:read- download shared files (needed for document ingestion)users:read- look up user info (optional, for display names)
5. Install to Workspace
- In the left sidebar, go to Install App.
- Click Install to Workspace and authorize.
- Copy the Bot User OAuth Token - it starts with
xoxb-. This is your Bot Token.
Configuration
Add the slack channel to your ~/.opencrust/config.yml:
channels:
slack:
type: slack
enabled: true
bot_token: "xoxb-your-bot-token"
app_token: "xapp-your-app-token"
You can also use environment variables: SLACK_BOT_TOKEN and SLACK_APP_TOKEN.
Using the Setup Wizard
Run opencrust init and select Slack when prompted for channels. The wizard will ask for both tokens and validate the bot token against the Slack API before saving.
Features
Streaming Responses
The bot posts an initial message and edits it as the LLM streams tokens, giving a real-time typing effect.
Groups and Channels
The bot can operate in public and private channels. In group contexts:
- It responds to all messages by default.
- Session IDs are scoped per channel (
slack-C12345), so each channel has its own conversation history. - DMs use the same session scoping (
slack-D12345).
Document Ingestion
Users can share files in Slack and use !ingest to add them to the bot's memory:
- Share a file in a message - the bot will download it and prompt you.
- Send
!ingestto ingest the pending file. - Or share a file with "ingest" in the caption for immediate ingestion.
Files are capped at 10 MiB.
Security
- Allowlist/Pairing: Configure
dm_policyandgroup_policyper channel to control who can interact with the bot. - Rate limiting: Per-user rate limits and token budgets apply.
Diagnostics
Use the opencrust doctor command to verify your Slack configuration:
opencrust doctor
It will test the bot token against auth.test and confirm your workspace connection.