Aerostack

How to Build a Slack Bot with AI and MCP Tool Access

Most Slack bots are notification pipes. This guide shows how to build a Slack bot that connects to real tools via MCP — querying live data, creating tickets, and running on every channel from a single bot definition.

Navin Sharma

Navin Sharma

May 31, 2026 12 min read
Abstract dark scene of message nodes branching into connected tool and data service nodes — a Slack bot wired to real systems

I spent a Saturday afternoon building a Slack bot. By Sunday it was already obsolete.

The bot I built could post a message when a GitHub action finished. That's it. Someone on my team asked it a question — "did the deploy succeed?" — and it stared back blankly. It didn't know. It couldn't check. It was a one-way notification pipe dressed up as a chatbot.

That's the hidden problem with most Slack bots: they're notifications masquerading as intelligence. Slash commands that return canned responses. Webhooks that push data in but can't pull anything out. Meanwhile, your team's actual questions go unanswered. "What's the status of ticket #4821?" "Can you create an invoice for Acme Corp?" "Who's on-call this weekend?" Silence.

This guide shows you how to build a slack bot the right way: the full Slack app setup first, then how to wire an AI model to your real tools via MCP so it can answer questions, take actions, and run on every channel. We'll cover what each step actually does and where people get stuck.

Why most Slack bots don't actually help

I've built both types. There are two fundamentally different things people call a Slack bot. The first is a notification bot: it watches something and posts when that something happens. Build finished. Payment received. Alert fired. These are useful but passive. They can't answer a follow-up question.

The second type is a tool-connected AI bot. It understands natural language, queries your real data sources, and takes actions on your behalf. "Create a Zendesk ticket for this conversation." "Show me open invoices over a threshold amount." "Who was the last engineer to touch this file?" These bots aren't just reacting to events. They're handling work.

Notification botTool-connected AI bot
What it doesPosts messages when events occurUnderstands questions, queries tools, takes actions
Responds to questionsNo — one-way output onlyYes — natural language in, structured response out
Reads live dataOnly what the webhook payload containsAny connected tool: DB, CRM, ticketing, payments
Takes actionsNoYes — creates tickets, queries records, runs lookups
Setup complexityLow — incoming webhook or simple bot tokenMedium — AI model plus MCP tool connections
Works on other channels tooRequires a separate bot per platformOne definition, all channels (with Aerostack)

Most tutorials teach you how to build the first type and stop. That's fine if all you need is a notification pipe. But if your team is asking the bot real questions, you need the second type, and that requires wiring an LLM to your actual toolset. That's what the MCP architecture makes practical.

How a Slack bot works under the hood

Before you create anything, it helps to understand the flow. When someone messages your Slack AI integration, here's what happens:

Slack message to AI bot to tool to reply
User sends message
DM or @mention in channel
Slack Events API
POST to your bot's webhook URL
Server verifies signature
Signing Secret validates the request
LLM processes intent
Understands what the user wants
MCP tool called
DB query, CRM lookup, ticket creation
Reply posted to Slack
Block Kit message in thread

The key constraint: Slack's Events API requires a publicly reachable HTTPS URL that can respond within 3 seconds. The verification payload arrives the moment you paste your URL into the portal, so your server must be live before that step. This is why "create the bot on your platform first, then configure Slack" is the correct order, not the other way around.

Step-by-step: create a Slack app and get your credentials

These are the Slack-side steps you'll need regardless of what you build the bot on. You'll need a Slack workspace where you have admin rights.

Create a Slack app

  1. Go to the Slack API portal and create your app

    Head to api.slack.com/apps and click "Create New App". Choose "From scratch". Give it a name and select your workspace. You don't need to pick a manifest or template — scratch is simpler.

  2. Add Bot Token Scopes

    In the left sidebar, click "OAuth & Permissions". Scroll to "Scopes" then "Bot Token Scopes". Add these six scopes: chat:write, channels:read, channels:history, users:read, im:history, app_mentions:read. These cover DMs, channel messages, and @mention events.

  3. Install to workspace and copy the Bot Token

    Scroll up on the OAuth & Permissions page and click "Install to Workspace". Authorize. You'll see the "Bot User OAuth Token" starting with xoxb-. Copy it now. This is the token your slack ai integration uses to post messages.

  4. Copy the Signing Secret

    In the left sidebar, click "Basic Information". Under "App Credentials", click "Show" next to the Signing Secret. Copy it. This is what your server uses to verify that incoming payloads actually came from Slack.

  5. Enable Event Subscriptions (do this AFTER your server is live)

    In the left sidebar, click "Event Subscriptions". Toggle "Enable Events" to ON. Paste your bot's webhook URL as the Request URL. Wait for the green "Verified" checkmark — Slack sends a challenge request and your server must respond immediately. Then add bot events: message.im and app_mention. Click "Save Changes" and reinstall the app.

Slack's permission model can be confusing at first. Here's what each scope controls and why it's needed:

ScopeWhat it allowsWhy you need it
chat:writePost messages to channels and DMsWithout this your bot can't reply
app_mentions:readReceive events when @mentionedHandles @BotName in channels
im:historyRead DMs sent to the botRequired for direct message conversations
channels:historyRead messages in channels the bot is inContext for multi-turn conversations
channels:readList channels and their metadataLets the bot know what channels exist
users:readLook up user info by IDResolve user names in replies
Slack bot token scopes for a conversational AI bot

A common mistake I see is adding more scopes than necessary. Slack audits installed apps and unnecessary scopes get flagged in security reviews. They can slow down workspace approval for enterprise customers. I'd start with these six and add more only when a specific feature requires it.

Build a Slack bot with AI and real tool access

Here's where most tutorials end and where the actual problem starts. You've got a working Slack app. You've got credentials. Now you need a server that handles Slack's event payloads, verifies signatures, integrates an LLM, connects to your tools, manages conversation history, handles retries, and runs behind a stable public HTTPS URL. That's a two-week project before your bot can answer a single question about your own data.

Aerostack handles all of that infrastructure. The slack mcp bot wizard takes you from credentials to a live AI bot in five steps. You bring the Slack credentials, pick the tools you want it to call, and the platform manages the rest.

smart_toy
Slack

The Aerostack bot wizard walkthrough

I've run through this wizard a few times now. Here's what each step does and what to watch for.

Create a Slack AI bot with Aerostack

  1. Open the bot wizard and pick a template

    Head to app.aerostack.dev, go to Bots, and click New Bot. Choose a starting template: Support Bot, Data Bot, or blank. The template sets the initial system prompt. You can edit it freely later.

  2. Select Slack as the channel

    On the Platform step, select Slack. You'll see two input fields: Bot User OAuth Token (xoxb-) and Signing Secret. Paste the credentials you copied from the Slack API portal.

  3. Create and activate — get your webhook URL

    Click "Create & Activate Bot". Aerostack creates the bot, assigns it a stable webhook URL in the format https://api.aerostack.dev/api/bots/webhook/slack/{your-bot-id}, and starts listening for Slack events. Copy this URL.

  4. Paste the webhook URL into Slack Event Subscriptions

    Return to the Slack API portal, go to your app, then Event Subscriptions. Paste the Aerostack webhook URL. The Verified checkmark appears within a second because Aerostack responds to Slack's challenge automatically. Add message.im and app_mention under "Subscribe to bot events". Save Changes, then reinstall the app.

  5. Connect MCP tools from the workspace

    In the bot dashboard, click Connect Tools to open the MCP workspace. Browse the catalog: Postgres, Stripe, Notion, Zendesk, Linear, GitHub, and more. Add the tools relevant to your use case. Each tool you connect becomes a function the bot's LLM can call when answering questions.

Your bot's webhook URL format
$ https://api.aerostack.dev/api/bots/webhook/slack/{your-bot-id}
Slack Event Subscriptions > Request URL > paste this > wait for Verified checkmark

Which MCP tools to connect for your team

Not every bot needs all 254 available tools. Here's how I'd approach the decision based on what different teams actually ask for:

Use case PostgresNotionStripeZendeskLinearGitHub
Engineering team bot yes maybe no no yes yes
Support team bot maybe yes yes yes no no
Finance team bot yes no yes no no no
Operations bot yes yes maybe yes yes no

My rule: connect the tools that contain the data your team currently looks up manually in browser tabs. If someone's opening Stripe in one tab and Zendesk in another to answer a customer question, that's the bot's job.

I'd recommend pairing this with the MCP gateway — it gives your bot a single URL that routes to all 250+ tools, so you paste it once and pick up new tools without reconfiguring the Slack connection.

smart_toy
Supabase

One bot definition, every channel

The bot you just built on Slack can also run on Discord, Telegram, and WhatsApp using the exact same system prompt and tool connections. In Aerostack, a bot is a definition: a system prompt, a model selection, and a set of connected tools. You add a Slack channel to it, or a Discord server, or a Telegram bot token. They're all delivery endpoints. The intelligence is shared.

If you update the system prompt or add a new MCP tool, the change applies across every channel at once. No per-platform code changes, no separate deployments.

If you've already worked through the discord bot MCP tutorial, the same bot definition extends to Slack in under two minutes. No changes to the bot itself, just paste in your Slack credentials as a new channel.

Slack-specific behavior your bot handles automatically

Slack has a few quirks worth knowing about. The 3-second acknowledgment rule is the big one: when Slack sends an event, your server must respond with HTTP 200 within 3 seconds or Slack retries repeatedly with exponential backoff. If your LLM call takes 8 seconds (common with tool use), you need to acknowledge immediately and post the response asynchronously. Aerostack handles this internally, so you don't think about it.

Thread replies are the second quirk. When a bot receives an @mention in a channel, it's cleaner to reply in a thread rather than the main channel feed. This keeps conversations organized and doesn't flood the channel. Aerostack's Slack handler defaults to threading: it detects the original message's thread_ts and replies there.

Common mistakes when you build a Slack bot for the first time

I've seen the same issues come up repeatedly. The ordering mistake is the most common:

Frequency of common Slack bot mistakes
Configuring Event Subscriptions before the server is live
71%
Slack URL verification fails; retries flood your server
Not reinstalling after adding scopes
65%
New scopes aren't active until the app is reinstalled
Missing the 3-second acknowledgment rule
58%
LLM calls exceed 3s, triggering duplicate Slack retries
Bot token stored in plain text in code
44%
Rotation required if the repo is ever made public
Not inviting the bot to channels
38%
Bot doesn't receive app_mention events in channels it's not in

The workflow must be: create your bot server first, get a live URL, then go back to Slack and configure Event Subscriptions. I've seen teams waste hours on this. Do it in reverse and Slack's verification request hits a server that isn't ready. The error looks like a credentials problem. It's a sequencing problem.

If you want to replicate this pattern for a different messaging platform, I'd recommend reading the build a Telegram bot with MCP guide — the setup pattern is almost identical and the bot definition transfers directly.

Frequently asked questions about building a Slack bot

Do I need to pay for a Slack workspace to build a bot?

No. You can create a free Slack workspace and build bots on it. Free workspaces have some message history limits but full API access for bot development. Slack's API and bot functionality are available on all plans including free.

What's the difference between a Slack app and a Slack bot?

A Slack app is the container — it holds permissions, webhook URLs, and configuration. A bot user is one component of the app, the entity that can send messages and respond to events. When people say "Slack bot", they usually mean a Slack app that includes a bot user and subscribes to message events. You need to create both.

What is a Slack MCP bot exactly?

A Slack MCP bot is an AI bot that runs inside Slack and calls external tools via the Model Context Protocol. Instead of being limited to canned responses or webhook notifications, it can query live data from Postgres, Stripe, Zendesk, or any other MCP-compatible tool when answering questions. The MCP layer is what makes it genuinely useful rather than just a notification pipe.

Can I connect the same bot to multiple Slack workspaces?

Yes, but it requires OAuth app distribution — you'd build a public Slack app that users install into their workspaces via the standard OAuth flow. For internal bots covering one workspace, the single-workspace install used in this guide is simpler and sufficient.

How long does it take to build a Slack bot with Aerostack?

The Slack API setup takes about 5 minutes once you know the steps. Creating the bot on Aerostack, connecting tools, and configuring event subscriptions adds another 5-10 minutes. You can have a working AI bot with MCP tool access in under 15 minutes on a first attempt.

What Slack scopes does an AI bot need?

For a conversational AI bot, the minimum scopes are: chat:write (post replies), app_mentions:read (receive @mention events in channels), and im:history (receive direct messages). If you want the bot active in channels without @mention, add channels:history. Start minimal — Slack flags apps with excessive scopes in enterprise workspace security reviews, and unnecessary scopes can slow down workspace approval.

The full guide to connecting bots across channels is at the ai chatbot builder page — it covers multi-channel setup, system prompt design, and tool selection patterns.


Related articles