Your First Workflow
Build Invoice intake with one flow called Check invoice. It accepts an invoice ID and amount. It returns the ID and whether the amount exceeds 1000. Declaring outputs does not supply their values. A Return response node must map them.
The workflow starts in development. This example has no provider call, trigger, or publication. Its rule and samples are teaching examples.
Define what Check invoice receives and returns
Section titled “Define what Check invoice receives and returns”| Direction | Display name | Type | Output name |
|---|---|---|---|
| Input | Invoice ID | text |
— |
| Input | Amount | number |
— |
| Output | Invoice ID | text |
invoice_id |
| Output | Review needed | boolean |
review_needed |
Keep both inputs Required. For manual Dev tests, supply both. If you omit an input, the run uses its saved test value. Without saved values, it uses "" for text and null for number. Required does not reject that omission.
In the app: open Workflows → New workflow, then rename it Invoice intake using the workflow name. Rename its initial Flow 1 to Check invoice. Under that flow, select Inputs to open Flow inputs, then choose Add new input. Select Outputs to open Flow outputs, then choose Add new output. Expand each row, enter its Display name, and select its type. For inputs, leave Required on. Output labels generate the names above.
With an assistant: complete setup. Every workflow-scoped tool call carries an explicit workflowId. Replace angle-bracket placeholders with returned values.
Repeating create/add calls makes additional objects. When resuming, reuse IDs. Before creating anything again, inspect the workflow list, then the flow list and flow readback.
Call workflow_list, called with { "limit": 100 }, then create one with workflow_create to get its ID.
{ "name": "Invoice intake" }Before treating the list as complete, check its data.hasMore. Note creation’s data.id as <workflowId>. Creation through the assistant tools starts without a flow.
List flows with flow_list, called with { "workflowId": "<workflowId>" }, then create the flow with flow_create for an ID.
{ "workflowId": "<workflowId>", "name": "Check invoice" }Note data.flowId as <flowId>. Add the two inputs with flow_input_add.
{ "workflowId": "<workflowId>", "flowId": "<flowId>", "display": "Invoice ID", "type": "text" }{ "workflowId": "<workflowId>", "flowId": "<flowId>", "display": "Amount", "type": "number" }Add the two outputs with flow_output_add.
{ "workflowId": "<workflowId>", "flowId": "<flowId>", "display": "Invoice ID", "name": "invoice_id", "type": "text" }{ "workflowId": "<workflowId>", "flowId": "<flowId>", "display": "Review needed", "name": "review_needed", "type": "boolean" }Read back their definitions with flow_get, called with { "workflowId": "<workflowId>", "flowId": "<flowId>" }. Save each data.flowInputId as <invoiceInputId> or <amountInputId> for tests. Each data.jsBinding names the input in expressions.
Bind the returned values
Section titled “Bind the returned values”In the app: choose Add action, search Return response, and add it. In Invoice ID, use Insert dynamic data → Flow Inputs → Invoice ID. In Review needed, select Dynamic data → Flow Inputs → Amount, then the adjacent +, choose >, and set Greater Than → Value to 1000.
Use one Return response here. If several complete, their results merge. In those merged results, overlapping output names overwrite earlier values.
With an assistant: find the action’s slug and component key with integration_action_list.
{ "query": "Return response" }Select Return response in data.items. Note its nodeSlug as <slug> and key as <componentKey>.
Inspect the action with integration_action_get, called with { "integration": "<slug>", "key": "<componentKey>" }. Add it with node_add to get its node ID. flow takes the flow ID and node the action slug.
{ "workflowId": "<workflowId>", "flow": "<flowId>", "node": "<slug>", "key": "<componentKey>", "name": "Return response" }Note data.nodeId as <nodeId>.
Read properties with node_prop_list, called with { "workflowId": "<workflowId>", "nodeId": "<nodeId>" }. Check the bindings with expr_context, once per prop.
{ "workflowId": "<workflowId>", "nodeId": "<nodeId>", "prop": "invoice_id" }{ "workflowId": "<workflowId>", "nodeId": "<nodeId>", "prop": "review_needed" }Confirm the bindings are invoiceID and amount. After renaming an input, reread context.
Write each expression with node_prop_set, passing inline js.
{ "workflowId": "<workflowId>", "nodeId": "<nodeId>", "prop": "invoice_id", "js": "flow.invoiceID" }{ "workflowId": "<workflowId>", "nodeId": "<nodeId>", "prop": "review_needed", "js": "flow.amount > 1000" }Arrange the flow with flow_layout and read it back with flow_get, each called with { "workflowId": "<workflowId>", "flowId": "<flowId>" }. Check validation with workflow_validate, called with { "workflowId": "<workflowId>" }, and reread the mappings with node_prop_list.
Proceed when validation reports no errors, flow_get shows both inputs and outputs, and node_prop_list shows both mappings. The flow readback omits node properties.
Validation does not verify that every output is mapped. For an unresolved output, an executed Return response supplies null. Without any completed Return response, the flow result is {}.
Test both invoice amounts
Section titled “Test both invoice amounts”These tests return values without storing an invoice. Each end-to-end Dev flow test incurs the base workflow-run charge.
In the app: select Dev, then Test (tooltip: Test current flow). Enter INV-104 / 120 and choose Test flow. In Run history, select Return response → Process and inspect Configurations and Result. Repeat with INV-105 / 1500.
With an assistant: list the accepted inputs with run_inputs to check their IDs.
{ "workflowId": "<workflowId>", "nodeIdOrFlowId": "<flowId>", "flow": true }For either method, match the rows’ IDs to the saved input IDs. Supply every used: true input. Unused inputs are accepted and ignored. The assistant tools reject unknown keys.
Run both samples with run_flow for their status and output.
{ "workflowId": "<workflowId>", "flowId": "<flowId>", "target": "dev", "inputs": { "<invoiceInputId>": "INV-104", "<amountInputId>": 120 }, "waitSeconds": 60 }{ "workflowId": "<workflowId>", "flowId": "<flowId>", "target": "dev", "inputs": { "<invoiceInputId>": "INV-105", "<amountInputId>": 1500 }, "waitSeconds": 60 }For either method, accept each sample only when data.status is completed and data.output matches the expected result.
Check the first sample for this output.
{"invoice_id":"INV-104","review_needed":false}Check the second sample for this output.
{"invoice_id":"INV-105","review_needed":true}A successful tool call can contain a timed-out, paused, or failed execution. Note its workflow execution ID as <workflowExecutionId>. Before rerunning, read back the execution result with execution_get.
{ "workflowId": "<workflowId>", "workflowExecutionId": "<workflowExecutionId>" }Keep both execution results with the workflow link. These samples prove the calculation for two valid invoices. Before accepting arbitrary invoices, define how missing inputs and invalid amounts are handled.
Extend Check invoice
Section titled “Extend Check invoice”Define flow contracts to extend Check invoice, then Store workflow data for durable records.