Slack Integration
This guide shows you how to integrate Slack with Solace Agent Mesh, enabling your team to interact with AI agents directly from Slack channels and direct messages.Overview
The Slack integration provides:- Real-time conversations with agents via Slack
- File uploads and downloads through Slack
- Threaded conversations with context retention
- Status indicators and typing notifications
- Markdown formatting and rich messages
- Feedback buttons for response quality
- Multi-user support with identity management
Prerequisites
Before starting:- Install Solace Agent Mesh
- Create a new project
- Admin access to a Slack workspace
Quick Start
Go to Slack API and create a new app:
display_information:
name: Agent Mesh Bot
description: AI assistant powered by Solace Agent Mesh
features:
app_home:
home_tab_enabled: false
messages_tab_enabled: true
messages_tab_read_only_enabled: false
bot_user:
display_name: Agent Mesh
always_online: false
oauth_config:
scopes:
bot:
- app_mentions:read
- channels:history
- channels:join
- channels:read
- chat:write
- chat:write.public
- files:read
- files:write
- groups:history
- groups:read
- im:history
- im:read
- im:write
- mpim:history
- mpim:read
- reactions:read
- reactions:write
- users.profile:read
- users:read.email
- users:read
settings:
event_subscriptions:
bot_events:
- app_mention
- message.groups
- message.im
interactivity:
is_enabled: true
org_deploy_enabled: false
socket_mode_enabled: true
token_rotation_enabled: false
xapp-)xoxb-)Slack Gateway initialized successfully
Connected to Slack via Socket Mode
Listening for Slack events...
Complete Configuration
Here’s a production-ready Slack gateway configuration:slack_gateway.yaml
Usage Patterns
Direct Messages
Users can DM the bot directly:Channel Mentions
Mention the bot in channels:Threaded Conversations
Continue conversations in threads for better context:File Uploads
Upload files for analysis:Customization
Custom Status Messages
Change the thinking indicator:Agent Selection
Route to specific agents by name:Markdown Formatting
Disable automatic markdown correction:Feedback Buttons
Disable feedback buttons:Identity and Permissions
User Identity
The Slack adapter automatically extracts user identity:- Slack user ID
- Email address
- Display name
- Real name
Role-Based Access Control
Integrate with SAM’s RBAC system:Advanced Features
Multiple Channels
The bot can be added to multiple channels:- Invite the bot:
/invite @Agent Mesh - The bot will join and respond to mentions
Private Channels
Add the bot to private channels:- Go to channel settings
- Select Integrations
- Click Add apps
- Choose Agent Mesh
Reactions
The adapter can use reactions for quick feedback:File Downloads
Agents can upload files to Slack:Troubleshooting
Enable Debug Logging
Verify Tokens
Test tokens with Slack API:Check Event Subscriptions
Ensure these events are subscribed:app_mentionmessage.groupsmessage.im
Monitor Logs
Best Practices
Example Interactions
Data Analysis
Multi-Agent Workflow
File Processing
Integration with Other Systems
Slack + Database
Query databases from Slack:Slack + Web Search
Research from Slack:Slack + Workflows
Trigger complex workflows:Security Considerations
Performance Optimization
Caching
Cache user information to reduce API calls:Streaming
Enable response streaming for faster perceived performance:Concurrent Requests
Handle multiple concurrent Slack users efficiently (built-in).Monitoring and Analytics
Usage Metrics
Track gateway usage:Error Tracking
User Activity
Next Steps
- Building Gateways - Create custom gateways
- Creating Custom Agents - Build Slack-optimized agents
- SQL Database Integration - Query databases from Slack
- Workflow Development - Trigger workflows from Slack