Create a new automation flow. A flow is a directed graph of nodes connected by edges. The graph MUST start with at least one trigger node (entry point). Edges connect nodes via output handles.
BEFORE BUILDING: call neuron_get_flow_catalog and read its `reference` — it carries the JSON shapes you cannot guess: the ConditionGroup + operator list for branch/filter/switch conditions, the `cases`/`assignments`/`weekdays` composite shapes, the handle wiring map, and copy-ready `examples`. Condition `field` on a logic node must be a {{template}} (e.g. '{{trigger.text}}'); on a trigger's config.conditions it is a raw payload path (e.g. 'text').
AFTER SAVING: the flow always saves, but the response includes a `warnings` array flagging likely bugs (unknown node type, missing required field, malformed conditions/cases/assignments, edges wired to a handle a node never emits, missing trigger). Always check it and fix any warnings — a warning means that part will silently no-op at run time.
TEMPLATE RESOLUTION: Node config values support {{…}} templates resolved at runtime:
{{trigger.text}} — the triggering message text
{{trigger.contactPhone}} — the sender's phone
{{trigger.senderName}} — the sender's name
{{vars.myVar}} — a variable set by logic.set_variable
{{nodes.n_abc.output.text}} — output from a previous node
{{= amount * 1.1 }} — inline expression (arithmetic, comparisons, ternary)
ERROR HANDLING: Any node's config can include __errorHandling: { continueOnFail: true, retryCount: 3, retryDelayMs: 1000 } to retry on failure with exponential backoff and/or continue on the 'error' handle instead of failing the run.
WIRING RULES:
- logic.branch: 'true' and 'false' handles
- logic.switch / logic.ai_router: one handle per case id, plus 'default'
- logic.wait_for_reply: 'default' (replied) and 'timeout'
- logic.wait_for_approval: 'approved', 'rejected', 'timeout'
- logic.wait_first_of: 'reply', 'event', 'timeout'
- logic.loop: 'loop' (body) and 'done'
- action.lookup_contact: 'found' and 'not_found'
- action.call_flow: 'default' (returned), 'timeout', 'error'
- All other nodes: 'default' handle (or 'error' when continueOnFail is on)