Docs

Build a Workflow

Create a workflow, add a trigger and steps, set them up, test, publish and run it, all through the API.

Every endpoint below links to its reference page, which lists each field it takes and answers. The values a step reads from earlier in the run are on Workflow References.

How changes are saved

A workflow has a draft, which you change, and published versions, which run. Every change below goes to the draft, so nothing runs until you publish.

Each change to the draft takes the draft's revision in the If-Match header and answers the new one in meta.revision. Send the revision you read last. When someone else changed the draft first, the change is refused with 412 and error.details.revision holds the current revision: read the draft again, then retry. Read the first revision from Get Workflow Definition.

1. Create the workflow

Create Workflow makes an empty, disabled workflow. Send "type": "function" for one other workflows call.

2. Add a trigger

Add Workflow Trigger takes schedule, webhook, runWorkflow or an app slug. A webhook trigger's address is in its configuration: read it with Get Workflow Trigger Configuration. Set a schedule or an app event with Update Workflow Trigger Configuration. To capture a sample call to a webhook, use Listen Workflow Trigger.

3. Add steps

Find the app and action with List Universal Apps (includeBuiltins=true adds If/Else, Loop, Map and the other built-in steps) and List Universal Actions. Then add the step with Add Workflow Step. Its position puts it inside a loop or an If/Else lane; the slots are on Workflow References. Move steps later with Set Workflow Step Order.

4. Set each step up

Get Workflow Step Schema lists what a step takes: its arguments, options, the connection it needs and the output fields later steps can read. Set them with Update Workflow Step Configuration; its reference page shows the connection object. To check values first without saving them, send the same body to Validate Workflow Step Configuration. Choose from an app's own lists with Run Workflow Step Lookup.

5. Test

Test Workflow Step runs one step for real, with its saved connection: a step that creates a record creates it. Its output becomes the sample later steps read. To save a sample without running the step, use Update Workflow Step Output.

6. Publish and turn it on

Validate Workflow lists what would block publishing. Publish Workflow makes the draft the version that runs. Then turn the workflow on with "isActive": true in Update Workflow.

7. Run it

Call the trigger, or start a run with Run Workflow and follow it with Get Run. List Run Steps and Get a Run Step show what each step received and returned.