Inference Logoinference.sh

Slack Integration

Connect Slack to your agents for messaging, channels, and events.


Overview

The Slack integration lets 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:

  1. A Slack workspace where you have admin permissions (or can request app approval)
  2. A Slack account to create the app

Step 1: Create a Slack App

  1. Go to the Slack API portal
  2. Click Create New App
  3. Choose From scratch
  4. Name your app (e.g., "Inference Agent")
  5. Select your workspace
  6. Click Create App

Step 2: Configure OAuth Scopes

  1. In your app settings, go to OAuth & Permissions
  2. Scroll to Scopes section
  3. Add Bot Token Scopes based on what you need:

Common scopes

ScopeAllows
channels:readView basic channel info
channels:historyRead channel messages
chat:writeSend messages as your bot
users:readView user profiles
reactions:readView emoji reactions
files:readAccess files shared in channels
  1. Add User Token Scopes if you need to act as the user:
ScopeAllows
channels:readView channels the user is in
chat:writeSend messages as the user

Step 3: Configure OAuth Redirect URL

  1. In OAuth & Permissions, scroll to Redirect URLs
  2. Add the callback URL:
EnvironmentCallback URL
Productionhttps://app.inference.sh/settings/secrets/oauth/slack
Staginghttps://app.staging.inference.sh/settings/secrets/oauth/slack
Local devhttp://localhost:3000/settings/secrets/oauth/slack
  1. Click Save URLs

Step 4: Get Your Credentials

  1. Go to Basic Information in your app settings
  2. Copy these values:
CredentialLocationPurpose
Client IDApp CredentialsOAuth authentication
Client SecretApp CredentialsOAuth authentication
Signing SecretApp CredentialsWebhook verification
  1. (Optional) Go to OAuth & Permissions and copy the Bot Token (xoxb-...) if you want to send messages without OAuth

Step 5: Connect in inference.sh

Configure credentials

  1. Go to Settings → Secrets → Integrations
  2. Find Slack and click Configure
  3. Enter your credentials:
    • Client ID
    • Client Secret
    • Signing Secret (for webhook events)
    • Bot Token (optional, for sending messages)
  4. Click Save credentials

These are stored securely as encrypted secrets.

Authorize the connection

  1. Click Connect
  2. You'll be redirected to Slack to authorize
  3. Select your workspace and review permissions
  4. Click Allow
  5. Done! Your Slack integration is now active.

Event Subscriptions (for triggers)

To receive real-time events from Slack:

  1. In your Slack app, go to Event Subscriptions
  2. Toggle Enable Events to On
  3. Set the Request URL to your webhook endpoint:
    code
    1https://api.inference.sh/webhooks/slack
  4. Subscribe to bot events you want:
EventTrigger
message.channelsNew message in a channel
message.imDirect message to your bot
app_mentionSomeone @mentions your bot
reaction_addedEmoji reaction added
member_joined_channelUser joins a channel
  1. Click Save Changes

Capabilities

CapabilityDescriptionRequired Scopes
slack.channels.readRead channel infochannels:read
slack.channels.historyRead channel messageschannels:history
slack.channels.writeSend messageschat:write
slack.users.readRead user profilesusers:read
slack.reactions.readRead emoji reactionsreactions:read
slack.files.readRead shared filesfiles:read

Using in apps

Declare Slack requirements in your app:

yaml
1requirements:2  integrations:3    - key: slack.channels.write4      description: Send notifications to Slack5 6    - key: slack.channels.history7      description: Read channel messages8      optional: true

At runtime, your app receives:

bash
1SLACK_ACCESS_TOKEN=xoxp-user-token2SLACK_BOT_TOKEN=xoxb-bot-token3SLACK_TEAM_ID=T01234567

Example: Send a message

python
1from slack_sdk import WebClient2import os3 4client = WebClient(token=os.environ["SLACK_BOT_TOKEN"])5 6client.chat_postMessage(7    channel="#general",8    text="Hello from my AI agent! 🤖"9)

Example: Read channel history

python
1from slack_sdk import WebClient2import os3 4client = WebClient(token=os.environ["SLACK_ACCESS_TOKEN"])5 6result = client.conversations_history(channel="C01234567", limit=10)7 8for 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

  1. From inference.sh: Settings → Integrations → Disconnect
  2. 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 @YourBotName in the channel

Next

Discord Integration

we use cookies

we use cookies to ensure you get the best experience on our website. for more information on how we use cookies, please see our cookie policy.

by clicking "accept", you agree to our use of cookies.
learn more.