Skip to content
BrainRoad BrainRoad

How to Connect Slack to Your AI Agent — Setup and Configuration Guide

BrainRoad ·
Beacon the lighthouse character shining light on a Slack bot setup interface on a dark navy background.
Share
On this page

One team is searching three tools to answer every internal question — Notion for docs, Linear for tickets, GitHub for code. Forty questions a day. Five minutes each. That’s over 3 hours of team time burned daily just chasing information that already exists somewhere.

Another team types @agent in Slack. Gets the answer in ten seconds. Moves on.

The difference isn’t headcount. It’s whether their AI agent lives inside Slack — where the work actually happens — or sits on a separate tab that people forget to open. If you’re exploring AI automation seriously, Slack integration is usually the first place it pays off.

Getting there requires a few specific things: the right Slack app configuration, the right OAuth scopes, and a decision about how your agent connects to Slack’s infrastructure. There are two connection modes, and the choice matters more than most setup guides admit. I’ll explain which one to use and why — but first, let’s make sure you have what you need to start.

What You Need Before You Start

Before touching any configuration, confirm you have these. Missing one will stall you mid-setup.

Slack Workspace Admin permissions

Required to install third-party apps. If you don't have this, you'll need your workspace admin to approve the install — or grant you the specific permission to install apps.

An AI agent platform account

Whether you're using OpenClaw, a managed platform like BrainRoad, or building with Bolt for Python — your agent needs to exist before you can connect it anywhere.

Python 3.7 or later (if building with Bolt)

Required for the official Slack SDK. Also requires an Anthropic or OpenAI account with API credits and a generated secret key.

A decision about connection mode

Socket Mode or HTTP Events API. This shapes your entire infrastructure setup. See the next section before creating your Slack app.

Socket Mode vs. HTTP Events API — Pick This First

Most setup guides bury this choice in the middle of step 4. It shouldn’t be there — it should be the first decision you make, because it determines whether you need a server, a public URL, and SSL certificates, or none of those things.

Here’s the difference.

Socket Mode

Your agent connects outbound to Slack via WebSocket. No public URL. No inbound firewall rules. No SSL certificates to manage. Slack sends events through the persistent connection your agent opens. Works behind a corporate firewall or on a laptop.

✅ Recommended for most setups

HTTP Events API

Slack sends HTTP POST requests to a URL you expose. Requires a public endpoint with SSL. You configure Slack to point at that URL. More infrastructure overhead, but gives you a stateless, horizontally scalable receiver.

⚠️ Best for production server deployments

Socket Mode is the default recommendation for most setups — including OpenClaw’s own documentation. The infrastructure burden is nearly zero: you create an App Token with connections:write scope, and your agent uses it to establish and maintain the WebSocket connection. No server configuration required.

HTTP Events API makes sense if you’re deploying to a cloud server that already has a public endpoint and you need stateless scaling. But for most agent setups — especially personal agents, small team bots, or managed platforms — Socket Mode removes three infrastructure problems at once.

Creating Your Slack App

One important thing before you build: each AI agent needs its own dedicated Slack app. Don’t share a single app across multiple agents. Each bot requires its own OAuth scopes and permissions, posts messages under its own name and avatar, and can be independently mentioned in channels — @ResearchAgent, @SupportBot, or whatever you’ve named them. Sharing an app creates permission conflicts and makes debugging painful.

1

Create the app

Go to api.slack.com/apps and click 'Create New App'. Choose 'From scratch'. Give it a name that matches your agent (not 'MyBot' — use something your team will recognize in the channel). Select your target workspace.

2

Enable Socket Mode (if using it)

Under 'Settings → Socket Mode', toggle Socket Mode on. Slack will prompt you to generate an App-Level Token. Give it the `connections:write` scope. Save this token — your agent will use it to open the WebSocket connection.

3

Add a Bot User

Under 'Features → App Home', enable your bot user. Set the display name and username. This is what appears in Slack when your agent posts a message.

4

Configure OAuth scopes

Under 'Features → OAuth & Permissions → Scopes', add the Bot Token Scopes you need. At minimum: `app_mentions:read`, `chat:write`, `channels:history`, and `im:history`. See the permissions breakdown in the next section for the full list.

5

Enable Events API

Under 'Features → Event Subscriptions', toggle on. If using Socket Mode, no URL is required. If using HTTP mode, paste your public endpoint URL here. Subscribe to bot events: `app_mention` and `message.im` at minimum.

6

Install to workspace

Under 'Settings → Install App', click 'Install to Workspace'. You need workspace admin permissions for this step. After authorization, copy your Bot User OAuth Token — this is what your agent uses to post messages.

OAuth Scopes — What Permissions Your Agent Actually Needs

This is where most setups either under-scope (agent can’t do what you want) or over-scope (your security team asks questions). Here’s a breakdown of what each scope does and when you need it.

The minimum viable set for a basic agent that reads channels and responds to mentions:

  • channels:read — See list of public channels in the workspace
  • chat:write — Post messages as the bot
  • files:read — Read files shared in conversations the bot is in
  • users:read — Look up user profiles (for personalized responses)
  • team:read — Access workspace name and basic team info

For an agent that needs to respond to direct messages and slash commands — closer to what most teams actually want:

  • app_mentions:read — Receive events when someone @mentions your bot
  • channels:history — Read message history in public channels the bot is added to
  • groups:history — Read message history in private channels
  • im:history — Read direct message history
  • commands — Register and respond to slash commands

If you’re using a platform like Elementum, the OAuth URL comes pre-scoped — you just click authorize. But if you’re building from scratch, you’re constructing that scope list yourself. Get it wrong and the OAuth flow will fail silently on specific actions.

The Part Most Slack Agent Guides Skip: Message Authentication

Your agent will receive events from Slack. But how does it know those events actually came from Slack and not from someone spoofing the endpoint?

Slack’s signing secret. Every incoming request includes an X-Slack-Signature header — a hash of the request body signed with your app’s signing secret. Your agent verifies this signature before processing any event.

This matters more if you’re using HTTP Events API mode, where your endpoint is public. But even in Socket Mode, most frameworks (Bolt for Python, OpenClaw’s gateway) handle this verification automatically. What you need to do: find your Signing Secret under ‘Settings → Basic Information → App Credentials’ and provide it to your agent’s configuration. If your framework asks for it and you skip it, your agent will either reject all events or accept forged ones. Neither is good.

MCP Tools and Native Slack AI Framework Support

Slack’s Agents & Assistants framework now supports a way to connect AI to your tools and data called Model Context Protocol (MCP). If your agent uses MCP-compatible tools, it can surface tool results directly in Slack threads — natively, without routing through an external interface.

What this means practically: your agent can query a tool, get a result, and post it inline in the Slack thread where the question was asked. No link-outs, no ‘check the dashboard’, no context switching. The thread IS the interface.

To enable this, look for MCP configuration in your agent platform’s Slack settings. In DjinnBot-style setups, there’s an explicit ‘Enable Model Context Protocol’ toggle in the Slack integration config. Toggle it on, select which tools the agent can use in Slack, and the platform handles the routing.

Where Slack Agent Setups Break

We’ve seen these specific failure modes come up repeatedly — not hypothetically, but in actual setups.

  • Missing app_mentions:read scope — Agent appears installed but never responds to @mentions. Slack silently drops the events. This is the single most common gotcha.
  • Signing secret not configured — Agent processes events in dev but rejects all events in production. Looks like a network issue. It’s a verification failure.
  • Multiple agents sharing one Slack app — Works until you need different permission sets or want agents to post under different names. Untangle this early.

Beacon the lighthouse illuminating a Slack logo, with amber glow and red stripe on dark navy background. Beacon says: your AI agent has been waiting for this introduction — let’s get Slack and smarts working together.

  • HTTP mode with no SSL — Slack’s verification step will reject your endpoint during setup. You need a valid certificate. Self-signed certs don’t work.
  • Socket Mode in high-volume environments — WebSocket connections occasionally drop and need reconnection. Most frameworks handle this automatically, but watch for it at scale.
  • Installing without workspace admin permissions — The OAuth flow completes, but the app doesn’t actually get installed. No error — just silence.

How to Know Your Slack Agent Is Working

Don’t trust ‘Installation successful’ as a confirmation. Verify the full chain.

  • Send a direct message to your bot. It should respond within a few seconds.
  • @mention the bot in a channel it’s been added to. Look for a reply, not just a reaction.
  • Check your agent platform’s logs — you should see the incoming event logged on the agent side.
  • Run a slash command if you configured one. Verify the response comes back in-channel or as a DM as expected.
  • In Socket Mode: check that your gateway shows an active WebSocket connection (not ‘connecting’ or ‘reconnecting’ in a loop).
  • Check the Slack app’s ‘Event Subscriptions’ page — it should show recent event deliveries with 200 status codes.

If direct messages work but channel @mentions don’t, it’s almost always the app_mentions:read scope or the bot not being added to that specific channel. Add the bot to the channel manually (/invite @yourbotname) and test again.

Tradeoffs Worth Knowing Before You Commit

  • Socket Mode vs. HTTP at scale — Socket Mode is simpler, but a single WebSocket connection has limits. For high-message-volume workspaces (thousands of events/minute), HTTP Events API with a horizontally scalable receiver is the more robust architecture.
  • OAuth-based platforms vs. manual token management — Managed platforms handle token refresh and server setup automatically. Building from scratch with Bolt for Python gives you more control but adds ongoing infrastructure responsibility.
  • One app per agent — Cleaner permissions and debugging, but managing 5+ Slack apps gets tedious. Some teams consolidate under one app with routing logic. That works until permission requirements diverge.
  • Slash commands vs. @mentions — Slash commands are discoverable (users see them in the Slack autocomplete). @mentions feel more natural in conversation. Most teams end up using both.
  • MCP tool access — Powerful, but every tool you expose through your agent is a potential attack surface. Audit which tools are accessible via Slack specifically.

Your Slack Agent Setup Checklist

Work through this in order. Each step depends on the one before it.

1

Confirm workspace admin access

Verify you have workspace admin permissions or the specific 'install apps' permission before starting. If not, get approval now — you'll need it at step 6 and there's no workaround.

2

Create a new Slack app at api.slack.com/apps

One app per agent. Name it something your team will recognize. Select your target workspace. Do not reuse an existing app unless the scopes are already correct.

3

Choose and configure your connection mode

Default to Socket Mode unless you have a specific reason for HTTP. If Socket Mode: enable it, generate an App-Level Token with `connections:write` scope, and copy the token. Store it securely — you'll add it to your agent platform config within the next 30 minutes.

4

Add OAuth scopes under Bot Token Scopes

Minimum: `app_mentions:read`, `chat:write`, `channels:history`, `im:history`. Add `commands` if you want slash commands. Add `groups:history` if the agent needs access to private channels. If unsure, start with the minimum and expand.

5

Enable Event Subscriptions and subscribe to bot events

Add `app_mention` and `message.im` at minimum. If using HTTP mode, your endpoint URL must be live and returning 200 to Slack's verification request before this step will save.

6

Install to workspace and copy your Bot Token

Click 'Install to Workspace'. After OAuth authorization, copy the Bot User OAuth Token (starts with `xoxb-`). This — combined with your App Token or Signing Secret — goes into your agent platform configuration.

7

Add the bot to at least one channel and test

Use `/invite @yourbotname` to add it to a channel. Send a DM first. Then try an @mention in the channel. Expect a response within 5 seconds for a properly configured Socket Mode connection.

Once the connection is stable, the next step is usually giving your agent context about your workspace — connecting it to the tools and documents your team actually uses. That’s where a personal AI assistant starts to feel less like a Slack bot and more like a team member.

If you want a Slack-connected agent without managing tokens, scopes, and WebSocket infrastructure yourself, BrainRoad handles the connection layer. You authorize via OAuth, configure what the agent can do, and the infrastructure runs behind the scenes. Worth knowing if you’ve just talked yourself out of the manual path above.

What This Means for Your Agent Setup

  • Socket Mode removes the public URL and SSL requirement — it’s the right default for most setups, not a compromise.
  • Each agent needs its own Slack app. Sharing apps creates permission conflicts that are hard to debug and harder to untangle later.
  • The minimum OAuth scopes for a working agent are app_mentions:read, chat:write, channels:history, and im:history. Start there.
  • Message authentication via signing secret is required in HTTP mode and best practice in all modes — don’t skip configuring it.
  • A team asking 40 questions a day across disconnected tools burns over 3 hours of time daily. That’s what a Slack-integrated agent addresses.
  • Verify the full chain after setup: DM test, @mention test, log check, slash command check. ‘Installation successful’ is not confirmation that the agent is working.

Start with the minimum scope set and expand as you identify what your agent actually needs in practice. The agents that work best in Slack aren’t the ones with the most permissions — they’re the ones with permissions scoped tightly to a specific, useful job.

Frequently Asked Questions

Do I need a public server to run a Slack AI agent?

Not if you use Socket Mode. Socket Mode uses a WebSocket connection where your agent connects outbound to Slack’s servers — no inbound firewall rules, no public URL, no SSL certificate required. HTTP Events API mode does require a public endpoint with SSL, but Socket Mode is the recommended default for most setups.

Can multiple AI agents share one Slack app?

Technically possible, but not recommended. Each agent should have its own dedicated Slack app because each bot needs its own OAuth scopes and permissions, can be independently mentioned in channels, and posts messages under its own name and avatar. Sharing an app creates permission conflicts and complicates debugging.

What OAuth scopes does a Slack AI agent need at minimum?

For a basic agent that responds to mentions and direct messages: channels:read, chat:write, files:read, users:read, and team:read. For full channel + DM + slash command coverage, also add app_mentions:read, channels:history, groups:history, im:history, and commands.

Why isn't my agent responding to @mentions even though it's installed?

Two most common causes: (1) the app_mentions:read scope is missing from your Bot Token Scopes, or (2) the bot hasn’t been added to the specific channel. Use /invite @yourbotname to add it to the channel, then test again. Also verify that the app_mention event is subscribed under Event Subscriptions.

How do I interact with a Slack AI agent once it's set up?

Three ways: direct message (send a message directly to the bot), slash commands (like /ask-bolty), or @mention in a channel the bot has been added to. Most setups support all three — which one to use depends on whether the question is private (DM), discoverable (slash command), or collaborative (channel @mention).

Sources

Topics

Personal AI Assistant

Stay updated

Get AI strategy insights delivered weekly. No fluff, no spam.

Related Articles