AI Assistant for Slack

Local Development with Socket Mode

Copy page

Set up a personal Slack app for local development using Socket Mode — no tunnel required.

Local Development with Socket Mode

Socket Mode lets you receive Slack events over a WebSocket connection during local development — no tunnel (ngrok, Cloudflare Tunnel) needed.

Note
Note

Each developer should create their own personal Slack app with Socket Mode enabled. Socket Mode distributes events randomly across connected clients rather than broadcasting to all. Sharing an app means each developer receives roughly half the events.

Prerequisites

  • A Slack workspace where you can install apps (workspace admin or create-app permissions)
  • The monorepo set up: pnpm install
  • ENVIRONMENT=development set in your .env file — Socket Mode only starts in development

Run the guided setup script from the monorepo root:

pnpm setup-slack-dev

The script walks through four steps automatically:

  1. Config token — Opens api.slack.com/apps and prompts for your Slack App Configuration refresh token (one-time paste)
  2. Create app — Creates a personal Slack app named Inkeep Dev <random-id> (e.g. Inkeep Dev frost-ember) using the canonical manifest
  3. App-Level Token — Prompts you to generate a connections:write token in your app settings (the only manual step — Slack provides no API for this)
  4. OAuth install — Starts a temporary local server, opens the browser, and completes the OAuth flow automatically

All credentials are written to your .env file. State is saved to .slack-dev.json (git-ignored) so subsequent runs require zero pastes.

RunPastes required
First run2 (refresh token + app-level token)
Re-runs0
Tip
Tip

To start fresh (e.g. if you deleted your app), remove .slack-dev.json and re-run the script.

Manual setup

If you prefer to configure things yourself:

Create a dev Slack app

Go to api.slack.com/appsCreate New AppFrom an app manifest.

Use packages/agents-work-apps/src/slack/slack-app-manifest.json as your starting point. Make these changes:

  • Set settings.socket_mode_enabled to true
  • Remove all request_url and url fields from event_subscriptions, interactivity, and slash commands
  • Rename the app (e.g. Inkeep Dev - YourName)

Generate an App-Level Token

In your app settings → Basic InformationApp-Level Tokens:

  1. Click Generate Token and Scopes
  2. Name: socket-mode, Scope: connections:write
  3. Copy the token (starts with xapp-)

Install the app

Go to Install AppInstall to Workspace and authorize. Copy the Bot User OAuth Token (starts with xoxb-).

Configure environment variables

Add to your .env:

SLACK_APP_TOKEN=xapp-your-token-here
SLACK_BOT_TOKEN=xoxb-your-token-here

Verify it works

  1. Start the dev server:
    pnpm dev
  2. Look for the log message: Slack Socket Mode client started
  3. In your Slack workspace, @mention your dev bot in a channel — the event should be received and processed locally
Tip
Tip

If the bot hasn't been added to a channel yet, invite it first: /invite @inkeep-your-dev-id

How it works

Socket Mode and the production HTTP path share the same event dispatcher and handlers — only the transport differs:

Production (HTTP):  Slack → HTTPS POST → Hono route → dispatcher → handlers
Local Dev (Socket): Slack → WebSocket  → adapter    → dispatcher → handlers

The Socket Mode adapter:

  • Receives pre-parsed events over WebSocket (no signature verification needed — the connection is authenticated)
  • Calls ack() immediately instead of returning an HTTP 200
  • Routes events through the same dispatchSlackEvent() function used by the HTTP path
  • Creates OTel tracing spans with identical span names and attributes

Troubleshooting