Skip to content

June 23, 2026

Building a Serverless Slack Bot with Bolt and Socket Mode — A Vibe Coding Guide

CommunitySlackEngineeringAI

Choosing the right architecture for a Slack Bot that “keeps running”

As mapped in What You Can Do with Slack Bot and API, Slack automation has two main paths: no-code (Workflow Builder) and custom-built (API/Bolt). Once you go the custom-built route, the next decision is where to run it.

Bolt (Bolt for JavaScript, Python, Java) is Slack’s official Bot framework and supports two execution modes:

ModeMechanismBest for
Socket ModeSlack opens a WS connection to youDevelopment, internal-only Bots, behind a firewall
HTTP EndpointsSlack POSTs to your public URLStateless deployments, serverless (Vercel, Cloudflare Workers, etc.)

This article covers both modes with implementation patterns and a vibe coding walkthrough.

3 problems Bolt solves for you

Without Bolt, using the Slack API directly requires implementing the following yourself:

  1. Signature verification: Confirming that requests actually came from Slack (HMAC-SHA256)
  2. Event routing: Dispatching different event_type values, command names, and button actions to separate handlers
  3. OAuth flow: Handling the app installation process for workspaces

Bolt takes care of all three, so you can focus on the logic — what to do and what to return.

Implementation example 1: Socket Mode (development / internal use)

Socket Mode requires no public URL, making it ideal for local development or running inside a corporate VPC.

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-level token for Socket Mode
});

// Respond to /hello slash command
app.command('/hello', async ({ command, ack, respond }) => {
  await ack(); // Must acknowledge within 3 seconds
  await respond({
    text: `Hello, ${command.user_name}!`,
    response_type: 'in_channel',
  });
});

// Respond to messages containing "thank you"
app.message('thank you', async ({ say }) => {
  await say('You are welcome!');
});

(async () => {
  await app.start();
  console.log('Bot is running in Socket Mode');
})();

.env file:

SLACK_BOT_TOKEN=xoxb-...
SLACK_SIGNING_SECRET=...
SLACK_APP_TOKEN=xapp-...

Implementation example 2: HTTP Endpoints (production / serverless)

When you want stateless execution (Vercel, Cloudflare Workers, or any serverless HTTP environment), use the HTTP Endpoints approach. It requires a public URL, but each request runs independently and terminates — no always-on process needed. Note that Cloudflare and Vercel do support WebSockets, but choosing HTTP Endpoints gives you a simpler stateless architecture and lower operational overhead.

import { App, ExpressReceiver } from '@slack/bolt';
import express from 'express';

const receiver = new ExpressReceiver({
  signingSecret: process.env.SLACK_SIGNING_SECRET!,
});

const app = new App({
  token: process.env.SLACK_BOT_TOKEN,
  receiver,
});

// Slash command returning a Block Kit message
app.command('/summary', async ({ ack, respond }) => {
  await ack();
  await respond({
    blocks: [
      {
        type: 'section',
        text: {
          type: 'mrkdwn',
          text: '*Today\'s Operations Summary* :bar_chart:',
        },
      },
      {
        type: 'section',
        fields: [
          { type: 'mrkdwn', text: '*Posts*\n42' },
          { type: 'mrkdwn', text: '*Active members*\n18' },
        ],
      },
    ],
  });
});

// Export for Vercel
export default receiver.app;

vercel.json:

{
  "functions": {
    "src/index.ts": {
      "memory": 256,
      "maxDuration": 10
    }
  },
  "routes": [
    { "src": "/slack/events", "dest": "src/index.ts" }
  ]
}

In your Slack App settings under “Event Subscriptions” and “Slash Commands”, set the Request URL to https://<your-vercel-url>/slack/events.

Step-by-step vibe coding implementation

Even without a dedicated software engineer, you can build a Bolt Bot using AI coding tools (Claude, etc.). Use the following prompt template as a starting point:

I want to build a Slack Bot using Bolt for TypeScript
with HTTP Endpoints (ExpressReceiver). Requirements:
- Respond to slash command /ask by echoing the argument
  text back as a Block message
- Deploy to Vercel (serverless)
- Provide package.json, vercel.json, .env.example,
  and src/index.ts as a complete set
- Also tell me what to paste where in the Slack app
  settings after deploying

Also list all required OAuth scopes.

After receiving the code from the AI, verify the following:

  1. OAuth scope review: Ensure no unnecessary permissions are granted
  2. Signature verification: Confirm signingSecret is used in the setup
  3. Error handling: Confirm ack() is always called (failing to call it causes Slack to keep resending the request until timeout)

Bot ideas organized by use case

Use caseCommand / triggerLogic
Meeting notes summarizationapp.event('message') in a meeting channelSummarize with LLM and post to thread
Approval workflow/apply commandShow modal form, send DM to approver
FAQ auto-responseapp.message(keyword)Pattern match or LLM answer
Daily reportCron job + chat.postMessageAuto-post yesterday’s metrics to Slack
External DB lookup/lookup {ID}Fetch data from CRM/DB and display as Block

LLM integration (FAQ, summarization, moderation assistance) will be covered in detail in a future article. Also see Running Content Production with AI for a broader view on AI-driven workflows.

Raw Slack API vs. Bolt: a comparison

AspectRaw Slack APIBolt
Signature verificationMust implement manuallyAutomatic
Event routingMust implement manuallyClean with app.command() / app.event()
OAuth handlingMust implement manuallyHandled by Bolt’s InstallationStore
Learning curveRequires reading API specs directlyConsolidates into Bolt docs
Vibe coding friendlinessMore complex to explain to AINaming “Bolt” surfaces clean examples

For simple notification forwarding only, Incoming Webhooks are sufficient. When you need slash commands or modals, that is when Bolt pays off.

Summary

  • Bolt is Slack’s official framework that handles signature verification, routing, and OAuth for you
  • Use Socket Mode (no public URL needed) for development and internal tools; use HTTP Endpoints when you want stateless execution in serverless environments
  • For vibe coding, specifying “Bolt + TypeScript + HTTP Endpoints + Vercel” gives the AI enough context for accurate output
  • The two most common pitfalls are forgetting to call ack() and granting excessive OAuth scopes

If you need help designing or implementing Slack Bot automation, or community automation architecture more broadly, see Rokuse’s Community Development Service. We support everything from workflow design to vibe coding guidance.

Contact · Rokuse LLC

Continue this conversation about your community.

If a moment in this article made you wonder "what about ours?", send that exact question. It does not have to be polished — we will work the entry point out together.

Frequently asked questions

Q. What is the difference between Slack Bolt and the Slack Web API?
A. The Slack Web API is the collection of REST APIs that Slack provides for operations such as sending messages, managing channels, and fetching user data. Bolt (Bolt for JavaScript, Python, Java, etc.) is an official framework that wraps those APIs to make them easier to use. It handles event routing, signature verification, and OAuth automatically. With Bolt, you only need to write the business logic — what to return for which command.
Q. Should I use Socket Mode or HTTP Endpoints?
A. Use Socket Mode for development, internal tools, or Bots inside a firewall (no public URL required). Use HTTP Endpoints (Events API) when you want stateless execution — for example, on Vercel or Cloudflare Workers. Socket Mode maintains a persistent outbound connection to Slack. HTTP Endpoints run per-request and terminate, making them a natural fit for serverless HTTP environments. Note that Cloudflare and Vercel do support WebSockets, but HTTP Endpoints give you a simpler stateless setup with lower cost and operational overhead.
Q. When vibe coding a Slack Bot, what should I hand to the AI?
A. Be specific — for example, "I want to build a Slack Bot using Bolt for TypeScript with HTTP Endpoints. It should respond to /daily-summary by returning the number of messages posted in a channel that day. Please give me vercel.json, package.json, and src/index.ts all at once, targeting a Vercel deployment." After receiving the code, verify the required OAuth scopes (permissions) are correct and that ack() is always called.