Skip to main content

Sequences

A job is a sequence of steps in the order they happen. Each step has a time (when), a channel, a title, the message that goes out, and a gate that says whether the step runs on its own or waits for the owner's OK. Ask Dash, the Agents page and the mobile app all show the same sequence.

Read a sequenceโ€‹

GET /v1/agents/{id}/sequence
{
"data": {
"agent_id": 42,
"when": "Every day at 6:00pm",
"mode": "ask",
"messages_complete": false,
"steps": [
{ "tool": "get_late_returns", "when": "Every day at 6:00pm", "channel": "check", "title": "Look up late returns", "message": null, "gate": "none", "locked": true, "ask_reason": null, "branch": null },
{ "tool": "send_sms_template_to_booking", "when": "Then", "channel": "text", "title": "Text the customer about a booking", "message": null, "gate": "ask", "locked": true, "ask_reason": "goes to your customers", "branch": null }
]
}
}

An agent whose sequence has never been edited still returns one, built from the agent's tools, approval modes and trigger.

Step fieldsโ€‹

FieldValuesNotes
whenfree text, up to 60 charactersThe first step carries the trigger ("Every Monday at 8:00am"); later steps usually read "Then"
channeltext, email, chat, charge, check, update, filtercheck is a look-up; update is a change to a record. filter is read-only, see below
titleup to 120 charactersIn the owner's words
messageup to 1000 characters, or nullThe words that go out on a text, email or chat step. Placeholders like {{first_name}}, {{start_time}} and {{supplier_name}} are filled at send time
gateauto, ask, nonenone is set on check and filter steps; a look-up can't be made to ask
lockedbooleanA locked step keeps its gate whatever you send
ask_reasonmoney, cannot be undone, goes to your customers, or nullWhy a locked step always asks
branch{ "if": "...", "steps": [...] } or nullAt most one branch per sequence, one level deep
tooltool nameOptional on write: a step without a tool keeps the tool the built step had in that position
viaemail, whatsappOnly on a send_to_owner step: how the owner gets it. Its channel is always email

messages_complete is true when every text, email and chat step has a message. The Agents page and Ask Dash won't turn a job on until it is. PUT /v1/agents/{id} does not check this, so read the sequence before you send "is_enabled": true.

Steps that always askโ€‹

Any step that takes or returns money, can't be undone, or sends something to a customer is locked with gate set to ask. That covers every customer text and email. These steps wait for an OK in both modes, and a "gate": "auto" you send for one is ignored.

The filter stepโ€‹

An event or schedule agent limited to some items, or some bookings, gets a filter step first ("Only bookings for ..."). The filter comes from trigger_config.filter, not from the stored steps. Change the trigger with PUT /v1/agents/{id} to change it, and leave the filter step out when you write the sequence back: PUT /v1/agents/{id}/sequence rejects the filter channel.

Long sequencesโ€‹

A sequence shows at most 12 steps. When an agent has more, the extra look-ups fold into one check step titled "And 5 more look-ups" with tool null. Every step that sends, writes or takes money stays in the list.

Replace a sequenceโ€‹

PUT /v1/agents/{id}/sequence
{
"mode": "auto",
"steps": [
{ "channel": "check", "title": "Look up late returns" },
{ "channel": "text", "title": "Return reminder", "message": "Hi {{first_name}}, your {{what_they_booked}} was due back at {{end_time}}. We are open until 6:30 today." }
]
}
  • steps replaces the whole list (1 to 12 steps).
  • mode is optional. auto lets every unlocked step run on its own; ask puts every unlocked step that changes something behind an OK. Locked steps keep asking either way.
  • The agent's tool_approval_modes are rewritten from the gates, so the agent runs exactly the sequence you see.

The response has the same shape as the read.

Errorsโ€‹

StatusWhen
404The agent doesn't belong to this business
422No steps or more than 12, an unknown channel (including filter), a gate other than auto or ask, a title over 120 characters, a message over 1000 characters
403The key lacks agents:write