Installation
Environment Variables
Get these credentials from your Slack app dashboard.
Configuration Options
Setup
- Single-Workspace
- Multi-Workspace
For internal bots serving one workspace:
OAuth Flow (Multi-Workspace)
For multi-workspace apps, handle the OAuth callback:- Exchanges the authorization code for an access token
- Stores the installation via
StateAdapter.set() - Encrypts the token if
encryptionKeyis provided
Webhook Handler
Features
Supported Events
message- Regular messages in channels/DMsapp_mention- Bot mentions (@bot-name)reaction_added/reaction_removed- Emoji reactionsassistant_thread_started- Slack AI Assistant thread createdapp_home_opened- User opens bot’s Home tabmember_joined_channel- User/bot joins a channel
Slash Commands
Interactive Components
Button clicks are automatically routed tochat.onAction():
Modals
Home Tab
Publish a custom Home tab view:Slack Assistant API
For Slack AI features:Thread IDs
Slack thread IDs encode channel and message timestamp:- Channel message:
slack:C1234567890:1234567890.123456 - DM (top-level):
slack:D9876543210:(empty threadTs for DM roots) - DM reply:
slack:D9876543210:1234567890.123456
Platform Limits
- Message length: 40,000 characters (Block Kit) or 4,000 characters (plain text)
- Blocks per message: 50 blocks
- Rate limits: Tier-based (1+ requests/second for most methods)
- File size: 1 GB per file
Code Examples
Troubleshooting
Webhook verification fails
Webhook verification fails
- Ensure
SLACK_SIGNING_SECRETmatches your app configuration - Check that the request body is raw (not parsed JSON)
- Verify timestamp is within 5 minutes (check server clock)
Bot doesn't respond to messages
Bot doesn't respond to messages
- Add bot to the channel (
/invite @bot-name) - Verify bot has
chat:writescope - Check webhook URL is publicly accessible
- Enable
message.channelsevent subscription
Multi-workspace mode not working
Multi-workspace mode not working
- Use a persistent StateAdapter (Redis, not Memory)
- Ensure OAuth redirect URL is whitelisted in app settings
- Check that installations are being saved (debug logs)
Required Scopes
Add these OAuth scopes to your Slack app: Bot Token Scopes:chat:write- Post messagesreactions:write- Add reactionschannels:history- Read channel messagesgroups:history- Read private channel messagesim:history- Read DM messagesmpim:history- Read group DM messagesusers:read- Look up user info
message.channelsmessage.groupsmessage.immessage.mpimapp_mentionreaction_addedreaction_removed
Next Steps
Message Handling
Process messages and build conversation flows
Block Kit Cards
Create interactive UIs with buttons and forms
Multi-Workspace Apps
Build apps for public distribution
State Management
Persist data across requests