Slack Bots
Deploy AI-powered bots in Slack with @mentions, DMs, and streaming responses.
Slack Bots
Connect your Gravity Rail agents to Slack. Respond to @mentions, interact via DMs, and stream real-time AI responses directly in Slack channels and threads.
Quick Start
1. Create a Slack App
- Go to api.slack.com/apps
- Click Create New App > From an app manifest
- Select your workspace, paste the manifest below, and click Create
json
- Note your Signing Secret from Basic Information
- Note your Client ID and Client Secret from OAuth & Permissions
2. Add Bot in Gravity Rail
- Go to Settings > Slack
- Click Add Slack App
- Enter:
- App Name
- Agent (select the AI agent that will respond)
- Signing Secret
- Client ID
- Client Secret
- Save
3. Configure Slack App URLs
In your Slack app settings at api.slack.com:
-
Event Subscriptions > Enable Events > set Request URL to:
https://api.gravityrail.com/api/v2/w/{workspaceUuid}/app-connections/slack/events -
OAuth & Permissions > add both Redirect URLs:
https://api.gravityrail.com/api/v2/w/{workspaceUuid}/app-connections/slack/oauth/callback(bot)https://api.gravityrail.com/api/v2/w/{workspaceUuid}/app-connections/slack/oauth/user/callback(user)
Replace {workspaceUuid} with your workspace UUID. These URLs are also shown when you run gr slack-apps get.
4. Install to Slack
- Go to the Connect tab in your app configuration
- Click Install to Slack
- Authorize the requested permissions
Your bot is now live! Try @mentioning it in a channel.
Response Modes
| Mode | When Bot Responds |
|---|---|
| Mentions (default) | Only when @mentioned |
| Auto | AI decides based on context |
| Off | DMs and slash commands only |
Set in your app's Behavior tab.
Auto Mode
In Auto mode, the bot uses AI to decide when to respond. You can customize the decision criteria with the Respond When field.
Requirements for Auto mode:
- Subscribe to
message.channelsandmessage.groupsevents in Slack - Invite the bot to channels with
/invite @botname
Streaming Responses
Slack bots support real-time streaming with "Thinking..." indicators:
- Enable Agents & Assistants in your Slack app settings
- Add the
assistant:writescope - Reinstall the app to apply new scopes
Streaming works in threads. The bot shows a "Thinking..." status while generating, then streams the response word-by-word.
Account Linking
Link Slack users to Gravity Rail members for personalized responses.
Auto-Link: Matches users by verified email automatically.
Manual: Users can link their accounts through Settings > Slack > Connect.
Linked accounts get responses personalized with member data.
Required OAuth Scopes
All 16 scopes are needed for full functionality:
| Scope | Purpose |
|---|---|
app_mentions:read | Read @mentions |
assistant:write | Act as App Agent (streaming) |
channels:history | Read public channel messages |
channels:join | Join public channels |
channels:read | View public channel info |
chat:write | Send messages |
groups:history | Read private channel messages |
groups:read | View private channel info |
im:history | Read DM messages |
im:read | View DM info |
im:write | Start DMs |
mpim:history | Read group DM messages |
mpim:read | View group DM info |
mpim:write | Start group DMs |
users:read | View workspace users |
users:read.email | View user emails (for account linking) |
Settings Reference
General
| Setting | Description |
|---|---|
| App Name | Display name for this configuration |
| Agent | AI agent that handles interactions |
| Signing Secret | From Slack Basic Information |
| Client ID | For OAuth flows |
| Client Secret | For OAuth flows |
Behavior
| Setting | Description |
|---|---|
| Respond Mode | mentions, auto, or off |
| Respond When | Custom AI prompt for auto mode decisions |
| Reply in Threads | Whether responses go in threads |
| Allow DMs | Enable direct message interactions |
Advanced
| Setting | Description |
|---|---|
| Allowed Channels | Restrict bot to specific channel IDs |
| Socket Mode | Use WebSocket instead of HTTP (for firewalls) |
Tips
- Test in a private channel first before deploying widely
- Use threads to keep conversations organized
- Enable streaming for a better user experience
- One app, many workspaces - install the same app to multiple Slack workspaces
Common Issues
Bot not responding to messages
Check event subscriptions, verify the signing secret matches, and ensure the bot is invited to the channel
Thread messages not received in Auto mode
Subscribe to
message.channelsandmessage.groupsevents, then reinstall the app
Streaming not working
Enable Agents & Assistants in Slack, add
assistant:writescope, and reinstall
"Thinking..." indicator not showing
Requires
assistant:writescope and messages must be in a thread
Related
- Channels — Overview of all communication channels
- Discord Bots — Deploy AI bots in Discord
- Workflows — Build the conversation flows that power your bot