slack_bot.py
Install the dependency:
uv pip install 'agno[slack]'Setup
1
Create a Slack App
- Go to api.slack.com/apps and click Create New App
- Choose From scratch, give it a name, and select your workspace
- On the Basic Information page, copy the Signing Secret
2
Enable Agents & AI Apps
This is required for streaming task cards and suggested prompts.
- In the sidebar, click Agents & AI Apps
- Toggle Agent or Assistant to On
- Under Suggested Prompts, select Dynamic
- Click Save
Enabling this automatically adds the
assistant:write scope.3
Add OAuth Scopes
- In the sidebar, click OAuth & Permissions
- Under Scopes > Bot Token Scopes, add:
- Click Install to Workspace and authorize the app
- Copy the Bot User OAuth Token (
xoxb-...)
4
Set Environment Variables
- Bot User OAuth Token: OAuth & Permissions
- Signing Secret: Basic Information > App Credentials
5
Subscribe to Events
- In the sidebar, click Event Subscriptions
- Toggle Enable Events to On
-
Set Request URL to your tunnel URL:
Your app must be running for Slack to verify the URL.
- Under Subscribe to bot events, add:
- Click Save Changes
- Go to Install App and click Reinstall to Workspace
6
Enable App Home
- In the sidebar, click App Home
- Under Show Tabs, enable Messages Tab
- Check Allow users to send Slash commands and messages from the messages tab
7
Start a Tunnel
Slack needs a public HTTPS URL to deliver events:Copy the
https:// forwarding URL and paste it into the Event Subscriptions Request URL (Step 5). The free ngrok tier gives you a random subdomain that changes on restart.8
Run the App
Scopes Reference
Add scopes based on the features your bot uses.Minimum (streaming bot that responds to mentions and DMs)
File handling
SlackTools methods
Other features
Event subscriptions
Developer Resources
Slack Interface
Streaming, sessions, file handling, and behavior details.
Interface Reference
All parameters, endpoints, and event handling.
SlackTools
Give agents outbound Slack actions: messaging, search, files.
Deployment Templates
Production deployment guides for AWS, GCP, and Docker.