Workflow JSON
Read and edit the JSON of a copied workflow.
Copying a workflow gives you a JSON object containing its steps, input types, declared variables, and visual layout. You can edit that object outside Middle and paste it back to create a workflow or a new version. Pasting creates a draft version.
This page describes the copied-workflow format. For the expressions inside steps, see Workflow parameters. Workflow triggers are configured separately and are not included in this JSON.
Top-level fields
name: the workflow's name.description: a description of what the workflow does.variables: an array of declared workflow variables and their types. Use[]when the workflow does not need to save values in declared variables.steps: an array of step objects, including one Begin step.
The example at the end of this page shows all four fields together.
Step fields
Every step has these fields:
step_number: a unique integer identifying that step within the copied workflow. Use0for Begin and positive integers for the other steps.description: the text shown on the step. For a Decision, name the specific check, such asHas an email address?, so its result is clear in workflow history.node_type: the step type, using one of the values below.A settings object whose key matches the step type, such as
rootorfilter.
Steps can also include position_x and position_y for their canvas positions.
Step
node_type
Settings key
Begin
root_node
root
Decision
filter_node
filter
Action
action_node
action
Bulk Workflow Execution
bulkwfexec_node
bulkwfexec
File Export
file_export_node
fileexport
Create or update record
record_upsert_node
recordupsert
Set variable
set_variable_node
setvariable
Return
return_node
returnnode
The settings object belongs inside the step. For example, a Decision's condition is at filter.filter_condition, not directly on the step.
Connections between steps
Connections refer to another step's step_number. They determine execution order; the order of objects in steps and their canvas positions do not determine it.
Begin, Action, Bulk Workflow Execution, File Export, Create or update record, and Set variable use next_step_number inside their settings object. For example, "root": {"next_step_number": 1, ...} connects Begin to step 1.
A Decision has two connections in filter:
next_step_number_on_true: the step to run when the condition is true.next_step_number_on_false: the step to run when the condition is false.
A null or omitted connection ends that path. Return ends the path with the value in output_np and has no next-step connection.
When adding or renumbering steps, update the connections that refer to them. Each non-null connection must identify a step in the same steps array. Type references that use step_number must also follow the new numbering.
To make eligibility checks visible in history, give each reason for stopping its own Decision. Connect each true branch to the next check and leave each false branch null. The example below checks email and attendance separately.
Inputs and declared variables
Begin's root.input_attribute describes the workflow's input object. Its children array defines the top-level input fields. Each field's key becomes an available variable throughout the workflow.
For example, an input field named input_record is read with "expression": "input_record" in a global_var_selector. Its props selects fields within that record. Begin inputs do not need entries in the top-level variables array or assignments copying them from ROOT_INPUT.
Use variables for values that steps save or update. Each declaration contains a key and an attribute describing its type. A declared variable starts as null. Its key must start with a letter, contain only letters, numbers, and underscores, and be unique among declared variables and Begin input fields.
An assignment has a key identifying the declared variable and a node_parameter that calculates its new value. Assignments are ordered in the step's variable_assignments array. This array is available in Begin, Action, File Export, and Set variable settings.
Begin assignments can read ROOT_INPUT; Action output assignments can read ACTION_OUTPUT; File Export output assignments can read FILE_OUTPUT. Save the output fields you need later into declared variables. An unused output does not need a declaration or assignment.
Older copied workflows may contain declarations such as WORKFLOW:0 and selectors with "props": ["input_record", "email"]. To replace a legacy Begin-output copy, change those selectors to "expression": "input_record" and "props": ["email"], then remove its declaration and Begin assignment once nothing references them. A saved Action output needs its own output assignment if later steps use it.
See Defining workflow variables for declarations and assignments, and Variables for selector examples.
Attribute types and references
Input fields, declared variables, and Return outputs use attribute objects to describe their types. Common fields are:
key: the field name used by selectors and input or output objects.display_nameanddescription: labels and help text.type:string,number,boolean,iso_date,iso_datetime,object,foreign_key,other_type, ortyped_object.is_array: whether the value is a list of that type.children: the fields of an object.foreign_key_entity_uuid: the app record type referenced by a foreign key.
Copied attributes may also include reference_id and other_type_reference. reference_id identifies an attribute within the copied definition. An other_type_reference can refer to an object type defined in the same workflow version, such as a declared variable or Begin or Return type, or the output of an Action used in that version. Types from other workflows, app record schemas, Action inputs, and outputs of unused Actions cannot be selected as Other types. Keep local references consistent when editing a copied workflow so Middle can reconnect them on import. Making a new version preserves existing references even when they do not pass the current type validation.
Use a fresh copy from Middle as the starting point when working with app-specific types and references.
Step settings
Begin: root
input_attribute defines the input object. next_step_number selects the next step. variable_assignments optionally saves values in declared variables.
Decision: filter
filter_condition is a parameter that returns a boolean. The two connections select the true and false paths. The JSON name is filter_node even though the editor calls the step a Decision.
Action: action
action_external_id is the Action's UUID. app_connection selects the connection. action_input is a parameter that constructs the Action's input, often using construct_object. variable_assignments optionally saves fields from ACTION_OUTPUT. next_step_number selects the next step.
Bulk Workflow Execution: bulkwfexec
workflow_to_execute_id identifies the called workflow. app_entity_uuid identifies the record type, and app_connection selects its connection. input_key_record names the called workflow's input field that receives each record. input_parameter provides additional input values. pk_filter and only_after can restrict which records are selected. next_step_number selects the next step.
The called workflow ID belongs to the destination account or module. Update it when copying to a destination with a different called workflow.
File Export: fileexport
app_entity_uuid and app_connection identify the records to export. fields_to_export configures the exported fields; only_after can restrict the records by date. variable_assignments optionally saves values from FILE_OUTPUT. next_step_number selects the next step.
Create or update record: recordupsert
app_entity_uuid and app_connection identify the record type and connection. input_parameter constructs the record payload. next_step_number selects the next step.
Set variable: setvariable
variable_assignments calculates and saves values in declared variables. next_step_number selects the next step.
Return: returnnode
output_type describes the returned value's type. output_np calculates that value. Return has no next-step connection.
App connections
Action, Bulk Workflow Execution, File Export, and Create or update record settings must include app_connection. It can be null for an unconfigured connection. Otherwise, the object contains all three of these keys:
app_connection_id: the account's connection ID, or null for a module connection.module_app_connection_id: the module's connection ID, or null for an account connection.app_external_id: the app's UUID.
Exactly one of the two connection IDs must be non-null. Use the IDs and UUIDs from a copied workflow rather than app names or connection labels.
On import, Middle resolves the connection within the destination account or module. If the copied connection ID does not match there, it uses the destination's first connection for that app. Check the selected connection after copying between accounts or modules, especially when the destination has more than one connection to the app.
Canvas positions
position_x controls left/right placement; position_y controls placement down the canvas. Larger X values move a step right, and larger Y values move it down. These optional fields control layout only. Moving a step does not change its connections or execution order.
For a vertical chain, keep X the same and increase Y for each step. A gap of roughly 160–170 canvas units is a useful starting point; adjust it for the sizes of the steps. The example below places Begin at (0, 0), the first Decision at (0, 145), and later steps 170 units apart. Use different X values to separate true and false branches.
Complete example
This workflow checks email and attendance in separate Decisions, then calculates and returns ten points. It uses an ordinary input object and requires no app connections. For an email of sally@example.com and attended: true inside input_record, it returns {"points": 10}. An empty email ends the path at step 1; false attendance ends it at step 2. Those paths do not reach the calculation or Return step.
Last updated
Was this helpful?

