Overview
The Slack integration enables your elizaOS agent to participate in Slack workspaces, responding to messages, managing channels, and facilitating team collaboration. Your agent can send messages, react to content, pin important items, and more.Prerequisites
Before setting up Slack integration, you need:- A Slack workspace where you have permission to install apps
- Access to create a Slack app in the Slack API Dashboard
Setup
chat:write- Send messageschat:write.public- Send messages to channels without joiningchannels:history- View messages in public channelschannels:read- View basic channel informationgroups:history- View messages in private channelsgroups:read- View basic private channel informationim:history- View messages in DMsim:read- View DM informationmpim:history- View messages in group DMsmpim:read- View group DM informationreactions:read- View reactionsreactions:write- Add reactionsusers:read- View user informationemoji:read- View custom emoji
Add additional scopes based on your agent’s needs:
pins:write/pins:read- Manage pinned itemsfiles:read/files:write- Handle file uploadschannels:manage- Create and archive channels
xapp-)xoxb-)Configuration
Environment Variables
The Slack integration requires the following environment variables:| Variable | Required | Description |
|---|---|---|
SLACK_BOT_TOKEN | Yes | Your bot user OAuth token (starts with xoxb-) |
SLACK_APP_TOKEN | Yes | Your app-level token for Socket Mode (starts with xapp-) |
SLACK_TOKEN→SLACK_BOT_TOKENSLACK_API_TOKEN→SLACK_BOT_TOKEN
Character Settings
Configure Slack-specific behavior and action permissions:Features
Message Management
Send, edit, and delete messages:Slack message IDs (timestamps) are in the format
1234567890.123456. You can get these from message context or by reading messages.Read Messages
Fetch recent messages from channels:Reactions
Add and view reactions:Pin Management
Pin important messages:User Information
Retrieve member details:Custom Emoji
List available custom emoji:Rich Formatting
Slack supports Block Kit for rich messages:Thread Replies
Reply in threads to keep conversations organized:Message Context
Your agent receives context with each message including:slack message id- The message timestamp for actionschannel- The channel ID where the message was sent- User information
- Thread context (if in a thread)
Socket Mode vs Events API
Socket Mode (Recommended for Development)
- No public URL required
- Works behind firewalls
- Easier to set up for testing
- Uses WebSocket connection
Events API (Recommended for Production)
- More reliable for high-traffic apps
- Lower latency
- Requires public HTTPS endpoint
- Better for distributed systems
Troubleshooting
Bot doesn’t respond
- Verify both
SLACK_BOT_TOKENandSLACK_APP_TOKENare set correctly - Check that Socket Mode is enabled in your Slack app settings
- Ensure the bot has been invited to the channel (
/invite @YourBot) - Check console logs for connection errors
Missing messages
- Verify OAuth scopes include appropriate
historyscopes - Check that the bot is a member of the channel
- For private channels, ensure the bot was explicitly invited
Permission errors
- Review your OAuth scopes in the Slack app settings
- Reinstall the app after adding new scopes
- Check that actions match available permissions
Reactions not working
- Ensure
reactions:writescope is added - Verify emoji name/Unicode is valid
- For custom emoji, use
:emoji_name:format
Best Practices
- Use threads - Keep channels organized by replying in threads
- React to acknowledge - Use reactions instead of “OK” messages
- Pin important info - Help users find key messages easily
- Be concise - Slack users value brief, actionable messages
- Use formatting - Make messages scannable with bold and lists
- Respect quiet hours - Consider user timezones and DND settings
- Test in a sandbox - Create a test workspace for development
- Handle rate limits - Implement backoff for API limits
Rate Limits
Slack enforces rate limits:- Tier 1 methods (posting messages): ~1 request per second
- Tier 2 methods (most reads): Varies by method
- Tier 3 methods (complex operations): More restrictive
- Tier 4 methods (rare operations): Most restrictive
Use Cases
Team Assistant
- Answer questions about projects
- Fetch information from external systems
- Schedule reminders
- Summarize discussions
Workflow Automation
- Monitor channels for keywords
- Create tickets from messages
- Update project management tools
- Send notifications from external systems
Collaboration Enhancement
- Pin decisions automatically
- React to messages based on sentiment
- Thread organization
- Archive summaries