Skip to content
Developers

Workflows

The graph form of an automation (a workflow, also called a flow), its nodes, edges and exits, with a worked example.

A workflow is an automation sent as a graph: nodes (each a catalog type with its config) and edges (which exit of one node leads to which node). A trigger node starts it. Any automation the app draws on its canvas is one.

Build one

  1. Read the triggers and steps: get_automation_catalog with part=triggers and part=steps.
  2. Read each step's settings: list_automation_blocks with filter=key:eq:<key>&include=input,definition.
  3. Save it switched off: create_automation with name and graph. validation in the answer says what is still missing, each problem at <nodeId>.<field>.
  4. Change it: update_automation with ops (add_step, then connect) or the whole graph, with version from get_automation. Send dryRun: true first.
  5. Check, test and switch on as for any automation (Automations).

Edges and exits

An edge goes from source to target. sourceHandle names the exit it leaves by (a question's answer, a condition's paths, a step's error); null is the step's one plain exit. A step's exits are listed in the catalog (part=steps, exits).

Example

When someone messages PRICE: send the price, ask for their email, then tell the team.

json
{
  "name": "Price, email, tell the team",
  "graph": {
    "nodes": [
      { "id": "start", "type": "trigger", "config": { "triggerType": "inbound_message", "keywords": ["price"], "matchMode": "word" } },
      { "id": "price", "type": "message", "config": { "blocks": [{ "kind": "text", "text": "Full price list: https://shop.example.org/prices" }] } },
      { "id": "email", "type": "ask_question", "config": { "question": "What is your email? We will send you the details.", "format": "Email", "attribute": "email" } },
      { "id": "team", "type": "notify_team", "config": { "message": "{{contact.name}} asked the price and left their email.", "roles": ["owner", "admin"] } }
    ],
    "edges": [
      { "id": "e1", "source": "start", "target": "price", "sourceHandle": null },
      { "id": "e2", "source": "price", "target": "email", "sourceHandle": null },
      { "id": "e3", "source": "email", "target": "team", "sourceHandle": "answer" }
    ]
  }
}

Plain words make the same in one call: create_automation with name and request ("when someone messages PRICE, send the price list, ask for their email, then tell my team").

Try it on real customer chats

Connect Instagram, WhatsApp or any other channel and start replying today.