Connect Slack to your agents for messaging, channels, and events.
Overview
Slack credentials let your agents send messages, read channels, respond to events, and interact with your Slack workspace.
Why "Bring Your Own Key" (BYOK)?
By using your own Slack app, you get complete control over events and triggers. Events only come from workspaces where your app is installed—no noise from other users.
Benefits:
- Isolated events — only receive events from your workspaces
- Full control — configure exactly which events to subscribe to
- Bot tokens — send messages as your custom bot
- Webhook verification — secure event delivery with your signing secret
Prerequisites
Before connecting, you'll need:
- A Slack workspace where you have admin permissions (or can request app approval)
- A Slack account to create the app
Step 1: Create a Slack App
- Go to the Slack API portal
- Click Create New App
- Choose From scratch
- Name your app (e.g., "Inference Agent")
- Select your workspace
- Click Create App
Pick From scratch, not the "AI agent" or "Starter app" templates — those scaffold slash commands and event listeners you do not need for sending messages.
Faster: create it from a manifest
From a manifest on the same screen sets the name, bot user, scopes and redirect URL in one step, so you can skip Steps 2 and 3. Paste this, then adjust the name and scopes:
1display_information:2 name: inference agent3 description: Agent messages from inference shell4features:5 bot_user:6 display_name: inference agent7 always_online: false8oauth_config:9 redirect_urls:10 - https://app.inference.sh/settings/secrets/oauth/slack11 scopes:12 bot:13 - chat:write14 - chat:write.public15 - channels:read16settings:17 org_deploy_enabled: false18 socket_mode_enabled: false19 token_rotation_enabled: falseThose three scopes cover posting: chat:write to post and edit, chat:write.public to
post to a public channel the bot has not been invited to, channels:read to list
channels. Add more from Common scopes for reading history, reactions or
files. Use the staging or local redirect URL from Step 3 if you are not connecting to
production.
After creating it, Install to Workspace, then continue from Step 4.
Step 2: Configure OAuth Scopes
- In your app settings, go to OAuth & Permissions
- Scroll to Scopes section
- Add Bot Token Scopes based on what you need:
Common scopes
| Scope | Allows |
|---|---|
channels:read | View basic channel info |
channels:history | Read channel messages |
chat:write | Send messages as your bot |
users:read | View user profiles |
reactions:read | View emoji reactions |
files:read | Access files shared in channels |
- Add User Token Scopes if you need to act as the user:
| Scope | Allows |
|---|---|
channels:read | View channels the user is in |
chat:write | Send messages as the user |
Step 3: Configure OAuth Redirect URL
- In OAuth & Permissions, scroll to Redirect URLs
- Add the callback URL:
| Environment | Callback URL |
|---|---|
| Production | https://app.inference.sh/settings/secrets/oauth/slack |
| Staging | https://app.staging.inference.sh/settings/secrets/oauth/slack |
| Local dev | http://localhost:3000/settings/secrets/oauth/slack |
- Click Save URLs
Step 4: Get Your Credentials
- Go to Basic Information in your app settings
- Copy these values:
| Credential | Location | Purpose |
|---|---|---|
| Client ID | App Credentials | OAuth authentication |
| Client Secret | App Credentials | OAuth authentication |
| Signing Secret | App Credentials | Webhook verification |
Bot token
A bot token lets an app post to Slack directly, with no OAuth round trip per user. It is what you want for one-way messaging: alerts, build results, digests, an agent that reports into a channel.
It does not exist until the app is installed, and it is not on Basic Information:
- Sidebar → Install App → Install to Workspace → Allow
- Sidebar → OAuth & Permissions → Bot User OAuth Token, at the top, starting
xoxb-
Then give it to inference shell, either way:
| Where | How | Use when |
|---|---|---|
| Team secret | belt secrets set SLACK_BOT_TOKEN xoxb-... | One workspace, your own team |
| Slack credential | Paste into the bot token field when connecting Slack | The token belongs with the same app's client id and secret |
Both arrive in an app as SLACK_BOT_TOKEN. Use a team secret when the bot posts to a
different workspace than the OAuth app serves — keeping two workspaces in one credential
record reads as a mistake later.
Adding scopes after installing does not update the token's permissions: reinstall the app,
or calls fail with missing_scope.
Step 5: Connect in inference shell
Configure credentials
- Go to vaults → credentials
- Find Slack and click Configure
- Enter your credentials:
- Client ID
- Client Secret
- Signing Secret (for webhook events)
- Bot Token (optional, for sending messages)
- Click Save credentials
These are stored securely as encrypted secrets.
Authorize the connection
- Click Connect
- You'll be redirected to Slack to authorize
- Select your workspace and review permissions
- Click Allow
- Done! Your Slack credential is now active.
Event Subscriptions (agent chat)
To let users message your agent from Slack, point Slack event subscriptions at your agent's channel webhook. Each agent has its own endpoint. Replace {agent_id} with the agent ID from the web app.
| Environment | Request URL |
|---|---|
| Production | https://api.inference.sh/agents/{agent_id}/channel/slack |
| Legacy (still supported) | https://api.inference.sh/agents/{agent_id}/slack |
The endpoint verifies requests with your Signing Secret (no API key). Inbound messages start an agent chat; replies are delivered back to the same Slack thread, including streaming and typing indicators when supported. The platform records channel_context (channel_type: slack plus thread metadata) on the chat so later turns route replies without you resending routing fields.
→ Agents API — Messaging channel webhooks · Channel context
- In your Slack app, go to Event Subscriptions
- Toggle Enable Events to On
- Set the Request URL to your agent's channel webhook (table above)
- Subscribe to bot events you want:
| Event | Trigger |
|---|---|
message.channels | New message in a channel |
message.im | Direct message to your bot |
app_mention | Someone @mentions your bot |
reaction_added | Emoji reaction added |
member_joined_channel | User joins a channel |
- Click Save Changes
Capabilities
| Capability | Description | Required Scopes |
|---|---|---|
slack.channels.read | Read channel info | channels:read |
slack.channels.history | Read channel messages | channels:history |
slack.channels.write | Send messages | chat:write |
slack.users.read | Read user profiles | users:read |
slack.reactions.read | Read emoji reactions | reactions:read |
slack.files.read | Read shared files | files:read |
Using in apps
Declare Slack requirements in your app:
1# inf.yml2credentials:3 - key: slack.channels.write4 description: Send notifications to Slack56 - key: slack.channels.history7 description: Read channel messages8 optional: trueAt runtime, your app receives:
1SLACK_ACCESS_TOKEN=xoxp-user-token2SLACK_BOT_TOKEN=xoxb-bot-token3SLACK_TEAM_ID=T01234567Example: Send a message
1from slack_sdk import WebClient2import os34client = WebClient(token=os.environ["SLACK_BOT_TOKEN"])56client.chat_postMessage(7 channel="#general",8 text="Hello from my AI agent! 🤖"9)Example: Read channel history
1from slack_sdk import WebClient2import os34client = WebClient(token=os.environ["SLACK_ACCESS_TOKEN"])56result = client.conversations_history(channel="C01234567", limit=10)78for message in result["messages"]:9 print(f"{message.get('user')}: {message.get('text')}")Security
- Your app — you control the Slack app and its permissions
- Signing secret — webhook events are verified using your secret
- Encrypted storage — all credentials are encrypted at rest
- Revocable — uninstall the app from your workspace anytime
Revoking access
- From inference shell: vaults → credentials → disconnect
- From Slack: Workspace Settings → Manage Apps → Remove
Troubleshooting
"Callback URL mismatch"
- Ensure the redirect URL in your Slack app matches exactly
- The URL is case-sensitive
"Invalid signing secret"
- Verify you copied the Signing Secret from Basic Information
- Make sure there are no extra spaces
"Missing scopes"
- Add the required scopes in OAuth & Permissions
- Reinstall the app to your workspace after adding scopes
"Channel not found"
- Your bot needs to be invited to private channels
- Use
/invite @YourBotNamein the channel
Next
→ Discord