Skip to content
Misar.io

How to Create a Slack Bot with AI in 2026 (Step-by-Step Guide)

All articles
Guide

How to Create a Slack Bot with AI in 2026 (Step-by-Step Guide)

Build a Slack bot with slash commands, interactive messages, and AI responses using Bolt for JavaScript — deploy in one afternoon.

Misar Team·Aug 27, 2025·3 min read
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.

slack-botbolt-jsai-codingblock-kitautomation
Enjoyed this article? Share it with others.

More to Read

View all posts
Guide

How to Train an AI Chatbot on Website Content Safely

Website content is one of the richest sources of information your business has. Every help article, FAQ, service description, and policy page is a direct line to your customers’ most pressing questions—yet most of this d

9 min read
Guide

E-commerce AI Assistants: Use Cases That Actually Drive Revenue

E-commerce is no longer just about transactions—it’s about personalized experiences, instant support, and frictionless journeys. Today’s shoppers expect more than just a website; they want a concierge that understands th

11 min read
Guide

What a Healthcare AI Assistant Needs Before Launch

Healthcare AI isn’t just about algorithms—it’s about trust. Patients, clinicians, and regulators all need to believe that your AI assistant will do more than talk; it will listen, remember, and act responsibly when it ma

12 min read
Guide

Website AI Chat Widgets: What Converts Better Than Generic Bots

Website AI chat widgets have become a staple for SaaS companies looking to engage visitors, answer questions, and drive conversions. Yet, most chat widgets still rely on generic, rule-based bots that frustrate users with

11 min read

Explore Misar AI Products

From AI-powered blogging to privacy-first email and developer tools — see how Misar AI can power your next project.

Stay in the loop

Follow our latest insights on AI, development, and product updates.

Get Updates