Table of Contents
Quick Answer
Use Slack's Bolt framework with Node.js, scaffold with Claude Code, and deploy to a VPS or Socket Mode for dev. Supports slash commands, shortcuts, events, and Block Kit interactive UI.
- Time to deploy: 3-5 hours
- Cost: $0 (Socket Mode) to $5/mo (HTTP + VPS)
- Stack: Bolt JS, Node.js, Block Kit
What You'll Need
- Slack workspace with admin rights
- Node.js 20+, pnpm
- Cursor or Claude Code
- VPS or Fly.io (or Socket Mode for no hosting)
Steps
- Create the app. Go to api.slack.com/apps↗ → Create New App → From scratch. Name it, pick workspace.
- Enable Socket Mode (easiest for dev). OAuth & Permissions → add scopes: commands, chat:write, app_mentions:read. Socket Mode → generate App-Level Token with connections:write.
- Scaffold with AI. pnpm add @slack/bolt dotenv. Prompt: "Create a Bolt JS app with Socket Mode. Add handlers for /ask slash command, app_mention events, and a button action using Block Kit."
- Build Block Kit UI. Use Block Kit Builder↗. Ask AI: "Generate a Block Kit JSON with a section, divider, and two buttons for approve/reject."
- Handle interactivity. Button clicks hit app.action('approve_btn', ...). Always await ack() within 3 seconds or Slack shows error.
- Add AI responses. Route /ask to your AI backend. Stream long responses as message edits (client.chat.update).
- Install to workspace. Install App → approve scopes. Token goes into your .env.
- Deploy. Socket Mode works from any laptop. For production, switch to HTTP mode, deploy to Fly.io, configure Request URL.
Common Mistakes
- Not acking within 3s: Slack retries and your handler runs multiple times.
- Blocking the event loop: Offload heavy work with setImmediate or a queue.
- Wrong scopes: Re-installation required when you add scopes.
- Ignoring retry headers: Handle X-Slack-Retry-Num to avoid duplicate processing.
- Public bot without verification: Slack requires marketplace review.
Top Tools
Tool
Best For
Price
Bolt JS
Official Slack framework
Free
Block Kit Builder
Visual UI designer
Free
Socket Mode
No hosting needed
Free
Fly.io
Free-tier hosting
$0-5
ngrok
Local HTTP dev
Free tier
FAQs
Q: Socket Mode vs HTTP?
Socket for dev/internal bots. HTTP for public/marketplace bots.
Q: Can the bot DM users?
Yes — client.chat.postMessage({ channel: userId }).
Q: How do I store per-user data?
Supabase (self-hosted) or Redis, keyed by Slack user ID.
Q: What scopes are minimum?
commands for slash, chat:write for replies, app_mentions:read for @ mentions.
Q: Can I sell on Slack Marketplace?
Yes — but review takes 2-4 weeks and requires security audit.
Q: Does Bolt work with Python?
Yes — Bolt for Python has near-identical API.
Conclusion
Slack bots automate team workflows that would otherwise cost hours. Start with Socket Mode, build one useful command, then iterate. Internal bots don't need marketplace review — ship today.