Starting, chaining and switching flows and loops
What starts a flow or a loop (events, schedules, dates, forms, API calls), what on and off mean, and how one runs another.
A chat flow runs inside one conversation with one bot. A loop runs in
the background, for the workspace. They start differently, chain differently,
and an agent turns them on and off with different tools. The node contract for
both is the node catalog (oalo pull writes it to .oalo/catalog/, or
oalo_node_catalog).
What starts a chat flow
A flow's trigger decides:
trigger | Starts when |
|---|---|
llm_tool (default) | the bot decides the conversation calls for it, guided by trigger_instructions ("when the customer asks for a quote") |
manual | only another flow (call_other_flow) or the API starts it. Customers never start it themselves |
on_media_upload | the customer sends a file |
conversation_start | legacy; use auto_start_on_open instead |
auto_start_on_open: true starts the flow as soon as a web chat opens. Only one
flow per bot may have it. A flow that is off never starts, whatever its trigger.
What starts a loop
A loop starts from its triggers, which are kept apart from its definition.
List, add and remove them with oalo_loop_triggers (action list, add,
remove). action=catalog lists every event with the fields it carries.
Trigger type | Starts the loop when | Settings |
|---|---|---|
event | that event happens (form.submitted, whatsapp.inbound, order.created, ...), once per event. order.created fires for Oalo checkout and for new paid orders in a connected WooCommerce, Tiendanube or Shopify store | event; optional filter on payload fields |
scheduled | the cron schedule matches, in UTC | cron (0 9 * * 1 is Mondays 09:00); batch_size caps how much a sweep step handles |
date_field | a date stored on a contact comes round (a birthday, a renewal), once per contact | event is the contact field; filter holds offset_days, recurring, at_hour |
widget_submit | one widget is submitted | widget_id |
api | the app's server calls it (POST /api/workflows/v1/<name>/run) and waits for its Output step's answer. At most one per loop. See Calling a workflow from your app | description, input, output (field name to type) |
exit | never starts a run. When event happens for a contact who is waiting in this loop, their wait is cancelled, which stops a drip once its goal is met (they booked, they paid) | event |
No reply from customer (conversation.no_reply) fires when we wrote last
in a WhatsApp, SMS, Instagram or email conversation (the bot, a teammate or a
workflow) and the customer hasn't answered in 24 hours. That includes a thread
a workflow opened that the customer never wrote in. It fires once per
unanswered message, within about 10 minutes, and tags the conversation "no
reply" until they write. The run's contact_id is the conversation's contact;
the payload has conversation_id, channel, hours, last_outbound_at and
bot_id (the bot's public id). Each bot can change the hours in its lead
watch settings (no_reply_hours; 0 or "off" turns it off).
Conversation started (conversation.started) fires on the first message
of a new conversation on every channel: WhatsApp, Instagram and SMS (and again
when a customer writes there after 24 hours of silence, unless a teammate has
the thread), web chat and email (once per conversation). The payload has
channel (whatsapp, instagram, sms, web, email), conversation_id,
bot_id, message and transcript. Filter on channel to choose where a
workflow runs: {"channel": "whatsapp"} for one, or a list for several,
{"channel": ["whatsapp", "instagram"]}. With no channel filter it runs for
web chats too. Workflows that used this trigger before web chat and email
fired it (2026-11-15) were given {"channel": ["whatsapp", "instagram", "sms"]}, so they kept doing what they did.
Any trigger filter value can be a list like that: it matches when the event's value is any of them.
A loop can also carry its own cron (set with the loop), which runs it on that
schedule. A loop with no trigger and no cron only runs by hand.
Triggers take events from the catalog, plus two kinds an app adds (see App events):
app.<name>(app.trial_ended): an app sent it toPOST /api/events/v1. A trigger may name one before the app first sends it.data.<model>.createdanddata.<model>.updated: the Sync API wrote a live row of a model that has them turned on in its table settings.
Any other made-up name in a schedule_event step only reaches a loop whose old
single trigger_event setting names it, and lint warns about it. Use a
catalog event, or enroll_in_loop.
What a loop's steps can read
{{trigger.payload.<field>}}: the event that started the run, in any step.{{loop.input}}is the same value.{{input}}: the previous step's output. After a branch, that is the branch's output, not the event.{{<step id>.<field>}}: an earlier step's output, with nostate.prefix.
On and off
| Chat flow | Loop | |
|---|---|---|
| Turn on or off | oalo flows on|off <bot> <flow>, or oalo_set_flow_enabled | oalo loops on|off <name>, or oalo_set_loop_enabled |
| While off | never starts, and a call_other_flow step can't run it | no trigger or schedule starts it, and no one can be enrolled in it |
| Still works while off | oalo qa ... --flow <name> tests it | oalo loops test <name> tests it. oalo run loop <name> refuses it (loop_off) until it's on |
An event starts a loop only when the loop is on and that trigger is on. Turning a loop off is the safe way to stop it; deleting can't be undone.
New and changed work should stay off until the person who owns the workspace
says to turn it on. The exception is a manual helper flow made for a
call_other_flow step: it must be on, or the call fails.
Chaining
A flow calling a flow. A call_other_flow step runs another flow of the
same bot, by its flow_name:
mode: "await"(the default) pauses until the other flow finishes. The call step's output is then the other flow's final state, by its step ids: read{{state.<call step id>.<helper step id>.<field>}}. Its outcome is{{state.<call step id>.__child_status}}(success,failed,halted_cost).mode: "fire_and_forget"starts it and carries on.args_templatesets the other flow's starting state.
Give a helper flow trigger: "manual" so customers never start it alone, and
turn it on. Its output step's text is sent to the customer like any flow's, so a
helper that only hands values back ends with an output step with no text.
A loop starting a loop. Three ways, from the loop node catalog:
function_callwithtool: "enroll_in_loop"andparams: {loop, payload}runs the other loop now for the current contact. It is skipped if that loop is already running, and refused if that loop is off.schedule_eventfires a catalog event after a delay, and every loop with that event trigger starts then, for every contact it applies to. The run carries on at once.- An
exittrigger on a drip loop stops a contact's waits when the event a later loop or flow produces arrives.
A loop and a conversation. A loop reaches conversations with steps like
write_to_conversation, send_chat_link (which can reopen the chat into a
flow, arrival_flow), send_whatsapp and hand_to_bot (which puts a
contact's thread with a bot, with context the bot reads). Conversations reach
loops through events: whatsapp.inbound, conversation.no_reply,
widget.submitted, lead.captured and others.
Testing without sending anything
- A loop:
oalo loops test <name> --sample latest(orexample, or--input), oroalo_test_loop. Every step runs, but steps that send messages, change records, enroll, schedule or wait are simulated, and their output says what they would have done. AI steps and the workspace's own code tools run for real. - A trigger:
oalo emit <event> --dry-run, oroalo_emitwithdry_run, lists the loops an event would start and changes nothing. Without the dry run they run for real. - A flow:
oalo qa <bot> "message" ... --flow <name>, oroalo_test_conversation. It talks to the bot for real. Nothing reaches a customer's phone, but the bot's tools and flows do their work.
Finding out what happened
- A loop's runs:
oalo loops runs <name>, oroalo_loop_runswithname. Each run has its status, what started it, its cost and its error. Add--id <run>(MCP:run_id) for every step's input and output. - A flow's runs:
oalo_flow_runson the bot, thenrun_idfor one run's steps. - One conversation:
oalo_get_conversationshows its messages, the tools the bot called, and the flow runs in it. These are real customers' messages.
Start from the run: the step that failed, or the condition that matched nothing, says what to fix.
Common mistakes
- A trigger names an event that doesn't exist. It is refused. Read the
catalog first. An
app.*name is the exception: it's accepted before any app sends it, so check the spelling against the app's code. - A
schedule_eventstep makes up an event name to start "the next loop". No trigger can listen for it. Useenroll_in_loop. - A step reads
{{input.payload.x}}after a branch. By then{{input}}is the branch's output. Read{{trigger.payload.x}}. - A helper flow is off, so the
call_other_flowstep fails. The same goes for a loop thatenroll_in_loopnames. - A loop is on but its trigger is off, or the other way round. Both must be on for an event to start it.
- Running a loop for real to see what it does. Test it instead.
How to script a chatbot conversation with a flow. The node types, how a flow starts, how steps pass data and branch, and how to check and repair one.
How Oalo automations (loops) and the ready-made recipes kits install work, and the one template step you set before a recipe sends.
A reference of every step type a loop automation can use, grouped by purpose, plus how steps connect (edges, conditions, fan-out, and templating).
Read, edit, check and save a chat flow or a loop as JSON from the CLI, an agent or the API, with worked examples and where flows and loops differ.
Sign up, install the CLI, and deploy your repo in a few minutes.