How to Connect Slack to Your AI Agent — Complete Workspace Setup Guide
On this page
When this is done, mention your agent in Slack and it responds instantly — answering questions, summarizing threads, connecting to your calendar, searching your knowledge base, or escalating to you when something requires a human decision. Your team messages the agent like a colleague. The agent handles context and complexity that a traditional bot can’t. This guide walks you through the exact setup.
If you’re evaluating whether an AI agent is right for your team’s workflow, start with the agent guides — this one assumes you’ve decided and are ready to integrate.
Before You Start: What You Need
Get these items ready before you begin configuration:
Slack workspace with admin access
You must be a workspace admin to install apps and configure permissions. If you're not an admin, ask one to run through this guide with you.
Your AI agent platform credentials
You'll need your agent's API key and webhook URL (or listen URL for Socket Mode). These are in your agent's settings panel. Keep them private — they're like passwords.
A Slack app development account
Go to api.slack.com and create a new app. You can create this from a template or from scratch — we'll cover both. Free account is fine.
Node.js 18+ (if using Socket Mode locally)
If you're running the agent on your local machine via Socket Mode, you'll need Node.js. Most managed platforms handle this for you.
10–15 minutes of uninterrupted time
You'll be navigating Slack's API dashboard, copying tokens, and connecting your agent. It's straightforward, but context switching breaks it.
Step-by-Step Setup
Step 1: Create a Slack App (3 minutes)
Go to api.slack.com/apps and click Create New App. Choose From scratch (not a template — we need full control).
Name your app something clear like “MyAgent” or “Workspace Assistant”. Select the workspace where you want to install it. Click Create App.
Step 2: Enable Socket Mode (2 minutes)
In your app’s settings, navigate to Socket Mode (left sidebar under Features). Toggle Enable Socket Mode to on.
Socket Mode lets your agent receive events from Slack without running a public server. Slack sends updates through a WebSocket connection — your agent listens and responds. Perfect for development and smaller deployments.
When you enable it, Slack generates an App-Level Token. Copy it immediately — you’ll paste it into your agent platform settings next. The token starts with xapp-.
Step 3: Define Bot Scopes (5 minutes)
Navigate to OAuth & Permissions (left sidebar under Features).
Under Bot Token Scopes, add these scopes:
chat:write— Allows the agent to send messageschat:write.public— Allows posting in public channelschannels:read— Read channel metadata and listim:read— Read direct messagesim:write— Write direct messagesmentions:read— Detect @mentions of the agentusers:read— Look up user info for personalizationreactions:write— Add emoji reactions (optional but useful)
Stop there. Don’t add scopes you don’t need. This follows the principle of least privilege — if an attacker compromises your token, they’re limited to what your agent actually needs.
Step 4: Generate the Bot Token (1 minute)
At the top of the OAuth & Permissions page, click Install to Workspace (or Reinstall if you already installed it). Slack asks for confirmation — you’re granting the bot access to your workspace with the scopes you defined.
After approval, you’ll see a Bot User OAuth Token (starts with xoxb-). Copy it. This is your second secret — your agent platform will use this to authenticate requests to Slack.
Step 5: Enable Event Subscriptions (3 minutes)
Navigate to Event Subscriptions (left sidebar under Features). Toggle Enable Events.
Under Subscribe to bot events, add these events:
message.channels— Messages in public channelsmessage.groups— Messages in private channelsmessage.im— Direct messages to the botapp_mention— When someone mentions the bot
These events fire when matching activity occurs. Slack sends them to your agent via Socket Mode.
Skip Request URL — that’s for server-based webhooks. You’re using Socket Mode, so Slack doesn’t need a URL.
Step 6: Configure Your Agent Platform (5 minutes)
In your agent platform’s Slack integration settings, paste:
- App-Level Token (the
xapp-token) into the Socket Mode connection field - Bot User OAuth Token (the
xoxb-token) into the API credentials field
Your agent platform will:
- Use the App-Level Token to open a WebSocket and listen for events
- Use the Bot User OAuth Token to authenticate its responses back to Slack
Hit Save or Enable — exact wording varies by platform.
Step 7: Test the Connection (3 minutes)
Go to your Slack workspace. In any channel, mention your bot: @MyAgent hello.
Your agent should respond within a few seconds. If not, check:
- Socket Mode connection active? Go back to api.slack.com, find your app, and check Socket Mode status. It should show a green dot and “Connected”.
- Event subscriptions enabled? Verify
app_mentionis checked under Event Subscriptions. - Bot token valid? Re-copy the bot token from OAuth & Permissions — tokens can expire or be revoked.
- Agent platform logs? Check your agent’s activity log for errors or connection issues.
If the agent replies, Socket Mode is working. Move to the next section.
What Your Agent Can Actually Do in Slack
Once connected, your agent can:
Answer Questions in Channels You mention it, it understands the question in context (including thread history), and replies with an answer. It’s like adding a knowledgeable colleague to your Slack.
Manage Direct Messages People DM the agent with requests. It processes requests, fetches information, or escalates to you when needed. You control whether the agent handles it solo or brings you in.
Connect to External Tools Use Slack’s Workflow Builder to trigger actions. Your agent can listen to workflow events, integrate with APIs, and report results back to Slack. Calendar lookups, database queries, document summaries — all possible.
Maintain Conversation Context Unlike a rule-based bot that matches keywords, your AI agent understands natural language and remembers context within the conversation. Ask a follow-up question and it connects the dots.
Set Reactions and Thread Replies The agent can add emoji reactions, start threads, and participate in threaded conversations — making it feel like a natural team member rather than a bot.
For a broader overview of what AI agents can and can’t do, see best AI agents.
Common Issues and Solutions
Issue: Agent doesn’t respond to mentions
- Check that Socket Mode shows “Connected” in api.slack.com
- Verify
app_mentionevent subscription is enabled - Confirm bot token is current (tokens can expire)
- Check agent platform logs for connection errors
Issue: Agent responds but can’t access channel history
- Add
channels:historyscope if you want to read past messages - Re-install the app in your workspace after adding scopes
- Note: Private channel history requires
groups:historyscope
Issue: “Socket Mode disconnected” errors
- Your agent platform lost its WebSocket connection to Slack
- Check network connectivity
- Verify App-Level Token is still valid
- Automatic reconnection typically restores within 30 seconds
Issue: Certain features don’t work (reactions, file uploads)
- You may need additional scopes:
reactions:write,files:write - Add the missing scope, re-install the app, and retry
Next Steps
Once your agent is responding in Slack:
- Configure intent-based routing — Set rules for which questions the agent handles solo vs. escalates to you
- Connect external tools — Link your calendar, CRM, or knowledge base so the agent can pull real information
- Set channel policies — Decide which channels the agent listens to and whether it auto-responds or waits for mentions
- Monitor and refine — Watch conversations and adjust the agent’s behavior based on misunderstandings or escalations
Your Slack workspace is now AI-augmented. The agent handles routine work. Your team focuses on what needs human judgment.
Ready to give your team an AI agent? Connect another channel or explore how AI agents work.
Related Articles
How to Set Up a Personal AI Assistant for Customer Follow-Ups Without Losing Approval Control
AI Assistant for Small Business Follow-Ups: Cost, Setup, and Approval Checklist