Slack bot message flow
Bot receives command, processes, and sends formatted response.
Every Slack bot starts with a simple idea: user types a command, bot responds with data or an action. But the gap between the command and the response is where real complexity hides — API timeouts, rate limits, missing permissions, and the question of whether to respond immediately or follow up. This diagram lays out the seven-node path from command to response: the request hits your backend, you call an external API, format the result, and post it back to Slack.
The key insight is that Slack gives you exactly 3 seconds to respond after a command is typed — longer, and users see a timeout error. So this diagram forces the question of when to respond immediately (with "Looking it up...") and when to follow up asynchronously.
When to use this template
- Slack integration design — walk through the end-to-end flow before building, so the whole team agrees on where data comes from and how it's formatted.
- Error path planning — add branches for API timeouts, permission denied, data not found, and other failure cases so you're not debugging them in production.
- Bot capability specification — use the diagram to spec what commands your bot will support, and which external systems it depends on.
How to adapt it
Rename the backend service and API to your real systems, and add your custom logic:
- Add interactive buttons — after posting the message, add a loop where the user clicks a button to trigger a new command (e.g. "Show more details", "Approve", "Dismiss").
- Insert rate limiting — if you call an external API, add a decision diamond checking whether you've exceeded the rate limit, with a fallback response if so.
- Include authentication — add a step between receiving the command and calling the API where you verify the user has permission to run that command.
Visual edits regenerate clean Mermaid code, so you can add these branches by dragging nodes without touching the syntax directly.
Mermaid code
Copy it anywhere Mermaid is supported — GitHub, Notion, or your docs.
sequenceDiagram
participant User
participant Slack
participant App as Your Bot/App
participant API as Backend Service
User ->> Slack: /command args
Slack ->> App: POST /slack/events
App ->> App: Parse command
App ->> API: Fetch data
API -->> App: 200 OK
App ->> App: Format response
App ->> Slack: POST chat.postMessage
Slack -->> App: 200 OK
Slack ->> User: Display message
Frequently asked questions
- What is a Slack bot message flow diagram?
- It shows the journey from when a user types a Slack command to when a response appears in the channel. It traces the request from Slack to your backend, processes data from external APIs, and responds with formatted text, blocks, or interactive buttons. Teams use it to design command handlers, error states, and rich-message formatting.
- What's the difference between slash commands and message events?
- Slash commands (like /weather) are explicitly triggered by the user typing a forward slash, appear as a single request with immediate 3-second response deadline, and show a loading state. Message events are fired when someone posts or reacts in a channel, have no response deadline, and can chain into multiple actions. This diagram shows slash commands; for event-driven bots, add a loop for multiple sequential actions.
- How do I handle timeouts or slow API responses?
- Insert a timeout check after the API call: if it takes longer than 2.5 seconds, respond immediately with an acknowledgment (e.g. 'Looking that up, one moment...') and then send the real result in a follow-up message. This keeps the user experience snappy and prevents Slack from showing a 'timed out' error. Visual edits regenerate clean code, so you can sketch different error paths without syntax overhead.
- What do I put in the message blocks or formatting?
- Slack messages support rich formatting: plain text, markdown, card-like blocks with images, buttons that trigger new commands, and even input forms. Most bots start with simple formatted text, then add interactive buttons (e.g. 'Approve', 'Dismiss', 'More details') that trigger new slash commands and keep the conversation scoped to the bot.