The Slack way
- Register a Slack app, configure OAuth scopes, and store bot tokens.
- Set up event subscriptions and handle Slack's URL verification challenge.
- Parse Slack-specific event payloads (message subtypes, blocks, attachments).
- Handle rate limits (Slack uses tiered rate limiting per method).
- Manage Socket Mode or configure a public webhook URL for events.
slack-agent.tsTypeScript
import { App } from "@slack/bolt"; const app = new App({ token: process.env.SLACK_BOT_TOKEN, signingSecret: process.env.SLACK_SIGNING_SECRET, socketMode: true, appToken: process.env.SLACK_APP_TOKEN, }); app.message(async ({ message, say }) => { if (message.subtype) return; const reply = await yourAgent(message.text); await say(reply); }); await app.start();
slack_agent.pyPython
from slack_bolt import App from slack_bolt.adapter.socket_mode import SocketModeHandler app = App(token=os.environ["SLACK_BOT_TOKEN"]) @app.message("") def handle_message(message, say): reply = your_agent(message["text"]) say(reply) handler = SocketModeHandler(app, os.environ["SLACK_APP_TOKEN"]) handler.start()
The RouteKit way
Configure Slack as a channel in the RouteKit dashboard. Your agent code is the same whether messages come from Slack or any other channel.
agent.tsTypeScript
import { RouteKit } from "routekit"; const routeKit = new RouteKit(); routeKit.on("message", async (msg) => { const reply = await yourAgent(msg.text); await msg.reply(reply); });
What you skip
No @slack/bolt, @slack/web-api, slack_sdk or slack_bolt dependency. No Slack-specific auth flow or message parsing. If you later add other channels, your code does not change.
Try it out
RouteKit is currently in beta. Join the waitlist to connect your agent to Slack and every other messaging channel with one integration. Or read more about why RouteKit.