Skip to content

How to understand a Slack app (Bolt for JavaScript) codebase

Bolt apps register listeners on an `App` instance for slash commands, events, interactive actions and modal submissions. Every interaction must be acknowledged quickly with `ack()`; the real work happens after.

How to tell it's Slack app (Bolt for JavaScript)

  • @slack/bolt in package.json
  • new App({ token, signingSecret, socketMode })
  • app.command, app.event, app.action, app.view listeners

Where things usually live

src/app.ts
Creates the app, registers listeners, starts it.
src/listeners/
Listeners grouped by type: commands, events, actions, views.
src/views/ or blocks/
Block Kit layouts for messages and modals.
manifest.json or manifest.yml
The app's scopes, commands and event subscriptions.

Conventions, not rules. Real projects rename and move things, so confirm against the repository.

Where to start reading

  1. The listener registration in app.ts
  2. The manifest, for scopes and subscriptions
  3. The action_id and callback_id strings that link blocks to listeners

How a request moves through the code

  1. 1Slack delivers a request over a socket or HTTP.
  2. 2Bolt verifies it and finds the matching listener.
  3. 3The listener calls ack() immediately.
  4. 4It then does the work, often calling client.chat.postMessage or opening a modal with client.views.open.
  5. 5A modal submission arrives as a view_submission, handled by app.view with its callback_id.

Questions to ask about the repository

  • List each command, event and action with its listener.
  • Which OAuth scopes does the app use, and why?
  • Which listeners do slow work after ack()?

What trips people up

  • If ack() isn't called within about three seconds, Slack shows an error to the user even if the work succeeds.
  • Interactive components connect to listeners by ID strings, so search for them in both places.