Setup
1. Create a Slack App
- Go to api.slack.com/apps and click Create New App
- Choose From scratch, name your app, and select a workspace
2. Enable Socket Mode
- Go to Settings → Socket Mode and enable it
- Generate an App-Level Token with the
connections:writescope (starts withxapp-)
3. Add Bot Token Scopes
Go to OAuth & Permissions → Scopes → Bot Token Scopes and add:4. Subscribe to Events
Go to Event Subscriptions → Subscribe to bot events and add:message.im— Direct messagesapp_mention— @mentions in channelsmessage.channels— Channel messages (if you want thread replies)
5. Install and Run
Install the app to your workspace, then copy the Bot User OAuth Token (starts withxoxb-).
Installation
slack-bolt and aiohttp as dependencies.
SlackInterface Parameters
Authentication
Receiver Mode
How the bot receives events.
"socket" for development (WebSocket, no public URL needed), "http" for production (Events API, requires public URL).HTTP Events API Settings
Channel Behavior
Typing Indicators
Emoji reaction added while the agent processes. Set to
"" to disable.Text Formatting
Automatically convert standard Markdown to Slack mrkdwn format (
**bold** → *bold*, [text](url) → <url|text>, etc.).Maximum message length. Messages exceeding this are split at paragraph/sentence boundaries.
Access Control
Rate Limiting & Timeouts
Slash Commands
Slash commands to register. Maps command name to description. Commands are routed through the agent pipeline by default.
Whether slash commands are sent to the agent. When
false, commands only dispatch to registered callbacks.Socket Mode (Development)
Socket Mode uses a WebSocket connection — no public URL, no HTTPS, no firewall configuration. Ideal for development.HTTP Events API (Production)
For production, use HTTP mode with Slack’s Events API. Events are pushed to your server over HTTPS.- A publicly accessible HTTPS URL
- The signing secret from your app’s Basic Information page
- Event subscriptions configured to point at your URL
Threading
The Slack interface automatically manages thread context:- Channel messages: Replies always go to a thread (when
thread_replies_in_channel=True) - Thread replies: When a user replies in a bot thread, the conversation continues in that thread with full history
- DMs: By default, replies appear as top-level messages (set
thread_replies_in_dm=Truefor threaded DMs)
Media Support
The interface handles Slack file uploads automatically:
Files shared in messages are downloaded from Slack and passed to the agent’s
images, audio, and files parameters.
Block Kit Interactions
Slash Commands
Register slash commands that route through the agent:You must also register slash commands in your Slack app settings at Features → Slash Commands. The
slash_commands parameter tells the interface to listen for them.Custom Command Handlers
Handle commands with custom logic instead of (or alongside) the agent:Buttons and Actions
Register handlers for interactive components:Modals
Open and handle modal dialogs:Shortcuts
Handle global and message shortcuts:Reactions
React to emoji reactions:App Home Tab
Publish a custom App Home tab:Block Kit Builders
Theformatter module provides pure-dict builders for Slack’s Block Kit — no SDK dependency needed:
Additional API Methods
The interface provides methods beyond basic messaging:Access Control
Restrict who can interact with the bot:Agent with Tools and Memory
Error Handling
The Slack interface maps API errors to the standard exception hierarchy:
When an error occurs during message processing, the configured
error_message is sent to the user, and all on_error hooks are invoked.