Setup
Follow the Slack deploy guide to create a Slack App and configure OAuth scopes, event subscriptions, and App Home.Install the Slack dependencies:
uv pip install 'agno[slack]'SLACK_TOKEN(Bot User OAuth Token)SLACK_SIGNING_SECRET(App Signing Secret)- Webhook URL set to
{prefix}/events(use ngrok for local development) - Agents & AI Apps enabled under App Home in your Slack App settings (required for streaming UI)
Example Usage
- Agent
- Team
- Workflow
basic.py
See more examples including streaming, teams, workflows, and multiple bots.
Sessions
Each Slack thread is a separate conversation. When running multiple bots on the same server, session IDs include the agent name to keep them separate.Session format:
{entity_id}:{thread_ts}. For example, an agent named “Basic Agent” produces session IDs like Basic Agent:1719000000.000100.Threads and Channels
How the bot responds depends onreply_to_mentions_only:
| Value | Behavior |
|---|---|
True (default) | Responds to @mentions in channels and all direct messages. Ignores unprompted channel messages. |
False | Responds to all messages in channels where it’s a member. The app_mention event is skipped in channels to avoid duplicate responses. |
Files and Media
Users can send files to the bot, and agents can upload files back. UseSlackTools for file operations:
SlackTools
SlackTools lets your agents interact with Slack: send messages, search history, and manage files. It works separately from the Slack interface.
Multi-Instance
Run multiple bots on the same server with differentprefix values:
User Identity
Enable with
resolve_user_identity=True to pass email-based user IDs to your agent instead of Slack user IDs like U0123ABC.- Canonical user ID: The user’s email address (falls back to Slack user ID if email is unavailable)
- Display name: Resolved via fallback chain:
display_name→real_name→username
metadata:
MemoryManager benefit from this. The same person gets the same memory whether they message via Slack, WhatsApp, or Telegram.
Security
Every incoming event is verified using HMAC-SHA256 signature verification:- The
X-Slack-Request-TimestampandX-Slack-Signatureheaders are extracted - Events older than 5 minutes are rejected (replay attack prevention)
- A signature is computed:
HMAC-SHA256(signing_secret, "v0:{timestamp}:{body}") - The computed signature is compared using constant-time comparison (
hmac.compare_digest)
Troubleshooting
No response from the bot
No response from the bot
Cause: Server not running or event subscription not configured.Fix: Check that the server is running, ngrok is active, and the Request URL in your Slack App settings matches your tunnel URL (e.g.,
https://your-tunnel.ngrok.io/slack/events).403 errors on events
403 errors on events
Cause: Invalid signing secret.Fix: Verify
SLACK_SIGNING_SECRET matches the value under Basic Information > App Credentials in your Slack App settings. The signing secret is different from the bot token.Bot ignores channel messages
Bot ignores channel messages
Cause:
reply_to_mentions_only=True (default).Fix: Mention the bot with @YourAppName or set reply_to_mentions_only=False to respond to all channel messages.Bot responds to its own messages
Bot responds to its own messages
Cause: Slack events missing
bot_id or misidentified bot user.Fix: The interface filters these automatically. If it still happens, verify your Slack app’s bot user has a bot_id in events. Reinstalling the app usually resolves this.Streaming UI not appearing
Streaming UI not appearing
Cause: App not configured for “Agents & AI Apps”.Fix: In your Slack App settings, go to App Home and enable the Agents & AI Apps feature. This is required for task cards, streaming text, and suggested prompts.
SLACK_TOKEN is not set
SLACK_TOKEN is not set
Cause: Missing environment variable.Fix: Export
SLACK_TOKEN with your Bot User OAuth Token before running the app. Find this under OAuth & Permissions in your Slack App settings.SSL certificate errors
SSL certificate errors
Cause: macOS system Python missing root certificates.Fix: Set the Or pass a custom
SSL_CERT_FILE environment variable:ssl context to the Slack interface.Response cut off or blank bubble
Response cut off or blank bubble
Cause: Message exceeds Slack’s 40K character limit, or
recipient_user_id mismatch in streaming.Fix: Stream rotation handles the character limit automatically. If you see blank bubbles, this is a known edge case with Slack’s streaming API when the recipient user ID doesn’t match the human user. Verify your Slack App configuration.Developer Resources
Interface Reference
All parameters, endpoints, and event handling details.
Deploy Guide
Create a Slack App, configure OAuth, and deploy step by step.
SlackTools Reference
Toolkit parameters and methods for messaging, search, and files.
Usage Examples
14 examples: agents, teams, workflows, streaming, multimodal, and more.