What Is a Workflow?
At its simplest, a workflow is a JSON object with two top-level properties:name— a human-readable label you assign to the workflow (e.g.,"Monthly Promotions Campaign").graph— an object containing anodesarray and anedgesarray that together describe the automation pipeline.
Minimal workflow structure
TRIGGER node — this is the entry point that kicks off execution when you enqueue a run. From there, nodes are connected in sequence (or in parallel branches) using edges.
Nodes and Edges
Nodes
Each entry in thenodes array represents a single unit of work. A node object always contains:
Example node definitions
Edges
Edges define the directed connections between nodes. Each edge object has:Example edge definitions
source to target. A node may have multiple outgoing edges (fan-out) or multiple incoming edges (fan-in), enabling parallel branches and merge patterns.
Flowmatic executes nodes in topological order. A node will not begin executing until all of its upstream dependencies have completed successfully.
How Data Flows Through the Graph
When a run starts, Flowmatic walks the graph from theTRIGGER node and executes each subsequent node in dependency order. Each node type produces a well-defined set of output fields that downstream nodes can reference.
For example:
- A
DATA_SOURCEnode reads a CSV and exposes arowsarray. - An
AInode receives those rows, processes them with an LLM, and exposes custom named fields (e.g.,customers,messageBody). - A
FILTERnode filters the AI output and exposes a filtereditemsarray. - An
OUTPUTnode iteratesitemsand sends one email per row.
Template Variables
Template variables let you embed dynamic values from upstream nodes directly into a downstream node’s configuration. They use double-curly-brace syntax:{{nodeId.outputField}}.
Referencing Upstream Node Outputs
Use{{nodeId.outputField}} anywhere in a node’s data object to inject the value that nodeId produced for outputField:
Referencing a DATA_SOURCE output in an AI prompt
ds is the id of the DATA_SOURCE node and rows is the field it outputs. At runtime, Flowmatic substitutes the actual array before passing the prompt to the LLM.
The {{item.*}} Variable Inside forEach Loops
The OUTPUT node’s forEach field tells Flowmatic to iterate over an array and send one action per element. Inside the to, subject, and body fields, you use {{item.fieldName}} to reference a property of the current iteration’s element:
OUTPUT node with item variables
Complete Workflow Example
Below is a full workflow that loads customer data from a CSV, uses AI to identify high-value customers, filters for those with a rating above 4, and sends each a personalized email.Complete workflow definition
Workflow Lifecycle
Working with a workflow follows a straightforward three-phase pattern:1
Create the workflow
Send a
POST /api/workflows request with your name and graph. Flowmatic validates the graph structure and returns a workflowId. The workflow is stored but not yet executed.2
Enqueue a run
Send a
POST /api/workflows/:workflowId/run request to start an execution. Flowmatic immediately returns a 202 Accepted with a runId and an initial status of PENDING. Execution happens asynchronously in the background.3
Monitor the run
Poll
GET /api/workflows/runs/:runId to track progress. The response includes the overall run status (PENDING, RUNNING, SUCCESS, or FAILED) as well as a per-node status breakdown so you can pinpoint exactly where things stand.Multiple Runs Per Workflow
A single workflow definition can be run any number of times. Each run is independent — it gets its ownrunId and its own status lifecycle. This makes it easy to:
- Re-run a workflow after fixing upstream data.
- Batch test a workflow with different CSV uploads by swapping the
DATA_SOURCEnode’suploadId. - Schedule recurring executions by enqueuing a new run on a cron schedule.
Runs for the same workflow are queued and executed one at a time. If you enqueue a second run while the first is still
RUNNING, the second will remain PENDING until the first completes. See the Runs guide for details.Next Steps
Node Types
Deep-dive into every node type — what each one does, its configuration fields, and what it outputs.
Runs
Learn how asynchronous runs work, how to poll for status, and how to handle failures.