xoxb-...) and an App Token (xapp-...).
Step 1: Create a Slack App
Create the App
Go to api.slack.com/apps → Create New App → From scratch.Name it whatever you want and select your workspace.
Enable Socket Mode
In your Slack app settings, go to Socket Mode and toggle it on.You’ll be prompted to create an App-Level Token. Give it a name (e.g., “spacebot”) and add the
connections:write scope. Click Generate.Copy the token — this is your App Token.Step 2: Add Bot Scopes
In your Slack app settings, go to OAuth & Permissions → scroll to Bot Token Scopes → add all of:| Scope | What it’s for |
|---|---|
chat:write | Send and edit messages |
reactions:write | Thinking indicator |
reactions:read | Read reactions |
channels:history | Read message history in public channels |
channels:read | Read public channel metadata (for channel names) |
groups:history | Same, for private channels |
groups:read | Read private channel metadata (for channel names) |
im:history | Same, for DMs |
im:read | Read DM metadata (for conversation names) |
mpim:history | Same, for group DMs |
mpim:read | Read group DM metadata (for conversation names) |
users:read | Resolve display names |
files:write | Upload file attachments |
files:read | Read file metadata |
Step 3: Subscribe to Events
In your Slack app settings, go to Event Subscriptions and make sure it’s toggled on. Under Subscribe to bot events, verify these are listed (add any that are missing):message.channels— public channelsmessage.groups— private channelsmessage.im— DMsmessage.mpim— group DMs
Step 4: Install to Workspace
Install the App
In your Slack app settings, go to Install App → Install to Workspace → Authorize.Copy the Bot User OAuth Token — this is your Bot Token. It starts with
xoxb-.Step 5: Add Tokens to Spacebot
- TOML Config
config.toml
config.toml
Verify It’s Working
Send a message in one of the channels you invited the bot to. You should see:- A 🤔 reaction appear while it processes
- A reply from the bot
Filtering
Restrict to Specific Channels
By default the bot responds in every channel it’s been invited to. To limit it, add channel IDs to your binding.config.toml
Finding Your Workspace ID
The workspace ID is theT-prefixed string in your Slack URL:
DM Filtering
By default, all DMs are ignored. To allow specific users, add their Slack user IDs.config.toml
Slash Commands
You can route Slack slash commands to specific agents.Create a Slash Command
In your Slack app settings, go to Slash Commands → Create New Command.
- Command:
/ask(or any name) - Request URL: Leave this empty (Socket Mode handles it)
- Short Description: “Ask the AI agent”
/ask question here, Spacebot routes it to the main agent.
Rich Messages
Slack supports rich message features:Block Kit
Structured messages with sections, dividers, buttons, and select menus. Spacebot automatically convertsOutboundResponse::RichMessage to Block Kit layout.
Ephemeral Messages
Send messages visible only to the triggering user withOutboundResponse::Ephemeral. Useful for confirmations or error messages.
Scheduled Messages
Schedule messages for future delivery withOutboundResponse::ScheduledMessage. Uses Slack’s native chat.scheduleMessage API.
Threads
Threads get their own separate conversation with isolated history. Messages in the main channel share one conversation.Troubleshooting
| Symptom | Cause | Fix |
|---|---|---|
invalid_auth on startup | Wrong app token | Must start with xapp-, not app- |
invalid_auth on API calls | Wrong bot token | Reinstall app, copy fresh xoxb- token |
| Connects then immediately drops | Socket Mode not enabled | Slack app settings → Socket Mode → toggle on |
| Bot doesn’t respond in channel | Not invited | /invite @YourBot in the channel |
| Bot doesn’t respond to DMs | DM filtering | Add user ID to dm_allowed_users |
| Slash command doesn’t work | Not configured | Add command to messaging.slack.commands array |
Next Steps
Configure Permissions
Set up workspace and channel filters
Slash Commands
Route commands to different agents
Block Kit Messages
Send rich interactive messages