Playbook
slack_message_with_hitl — Agent Guidance
What it does
Posts a message to Slack with buttons you define, pauses the workflow, and resumes when a human clicks a button. Use it whenever a workflow needs a human decision before proceeding.Mental model
- You define what the human sees (text, optional blocks, + buttons) and what data each button carries (emit).
- The system posts the message, pauses the workflow, and waits.
- A human clicks a button.
- The workflow resumes. The next step receives
selected_option(the button id) andevent_payload(the button’s emit data merged with Slack metadata).
blocks (Block Kit)
You can provide custom Slack Block Kit blocks to control the message layout. Whenblocks is provided, it replaces the default section block generated from text. The system always appends:
- A status context block (hourglass / checkmark)
- An actions block with your buttons (injected with routing metadata)
actions blocks in your blocks array — interactive buttons are managed via the buttons field.
When blocks is provided, text is still required — Slack uses it as the notification preview and accessibility fallback.
Example with blocks
Supported block types
All Slack Block Kit block types are supported:section, header, divider, context, image, rich_text, actions (non-HITL only), input, video, table, markdown, file, context_actions, task_card, plan.
See the Block Kit reference for full specifications.
Button schema
| Field | Required | Description |
|---|---|---|
id | yes | Unique identifier. Returned as selected_option when clicked. Cannot be "edit" (reserved). |
label | yes | Text shown on the button in Slack. |
style | no | "primary" (green) or "danger" (red). Omit for neutral gray. |
emit | no | Arbitrary key-value data merged into event_payload when this button is clicked. |
- 1–5 buttons required.
- Button ids must be unique.
"edit"is a reserved id — useallow_editinstead.- Unknown fields on buttons are rejected (
additionalProperties: false).
What the next step receives
When a human clicks a button, the workflow resumes with this output:selected_option— theidof the button that was clicked.event_payload— the button’semitdata merged with Slack signal metadata (selected_option,final_text,edited,slack_user_id,slack_channel_id, etc). If the button has noemit, event_payload only contains the signal metadata. Merge precedence:emitkeys overwrite signal metadata keys on collision — avoid usingselected_option,final_text,edited,slack_user_id, orslack_channel_idas emit keys.final_text— the message text at the time of the click (may differ from the original if the human used Edit).edited— whether the human modified the draft text before clicking.
selected_option in the next workflow step to decide what to do.
allow_edit
Set"allow_edit": true to add an Edit button that opens a Slack modal where the human can modify the text field. Editing does NOT resume the workflow — the human must still click one of your defined buttons after editing.
Defaults to false. Use it when the text field contains a draft the human should be able to revise (e.g., a draft email, a message template).
post_interaction
Controls what happens to the Slack message after any button is clicked:disable_buttons— remove all buttons from the message after a click (default: true).replace_message— replace the entire message text with this string.replace_blocks— replace the entire message with custom Slack blocks (advanced).
Timeout
timeout— how long to wait for a click (default: 24h). Examples:"30m","2h","24h".on_timeout—"return_null"(resume withtimed_out: true) or"error"(fail the workflow step).timeout_emit— data returned asevent_payloadon timeout.
Common patterns
Simple confirmation gate (1 button)
Approve / reject with editable draft
Multi-option CRM routing (5 buttons)
if selected_option === "skip" → end; otherwise event_payload.crm tells you which API to call.
Using HITL in a workflow
A Deepline workflow is acommands array. Each command has an alias, a tool, and a payload.
Important — row access differs by step type:
| Step type | Access pattern | Example |
|---|---|---|
HITL (slack_message_with_hitl) | row.<alias>.selected_option | row.qualify.selected_option |
JavaScript (run_javascript) | row.<alias>.result.your_field | row.draft_email.result.email_body |
.result wrapper. JS output is wrapped in { result, status, meta }.
Template interpolation in tool payloads uses {{...}} mustache syntax, NOT ${...} JS template literals:
How data flows between steps
- Step 1 posts to Slack with 3 buttons, pauses, resumes when human clicks.
- Step 2 is a
run_javascriptstep. It reads Step 1’s HITL output atrow.qualify.selected_option(flat — no.result). If the human disqualified the lead or it timed out, it returns{ skip: true }. Otherwise it constructs an email draft. - Step 3 is another HITL step. The
textfield uses{{row.draft_email.result.email_body}}(mustache template,.resultbecause it’s reading a JS step).allow_edit: truelets the human revise it. After approval,row.approve_email.final_textcontains the final email body.
Key patterns
Reading prior HITL output:row.<alias>.selected_option gives you the button ID. row.<alias>.event_payload gives you the button’s emit data. row.<alias>.final_text gives you the (possibly edited) text. No .result wrapper.
Reading prior JS output: row.<alias>.result.your_field — JS steps wrap output in { result, status, meta }.
Template interpolation in payloads: Use {{row.<alias>.field}} mustache syntax. For JS outputs: {{row.<alias>.result.field}}. For HITL outputs: {{row.<alias>.selected_option}}.
Branching: Use a run_javascript step between HITL steps to inspect the prior result and decide what to do next. Return a flag like { skip: true } that downstream steps can check.
Passing data forward: You don’t need to stuff lead data into every button’s emit. The workflow engine carries all step outputs in row. Any step can read any prior step’s output via the patterns above.