Skip to content
Docs

Connectors

Connectors are a special family of nodes that spawn child workflows. Unlike regular nodes — which hand their JSON output to the next node in a linear chain — connectors take an array or paginated source and run a sub-graph once per element or page.

Connectors live under app/Flows/Connectors/ and implement ConnectorInterface or PagerInterface, which is why they appear separately from regular nodes in the builder palette.

Every connector exposes an iteration handle instead of a plain output handle. You wire the sub-graph that should run per element into this handle. The sub-graph behaves like a miniature flow with its own entry point.

Anything downstream of the connector’s regular output handle only runs after every iteration has finished. This lets you aggregate or process the collected results once the fan-out is complete.

Start → [API call] → Connector ─── iteration ──→ [per-item sub-graph]
└── output ──→ [runs after all iterations]
A split on the canvas: Read the order feeds Each pallet, whose box holds Label the pallet, and Hand the labels to the printer runs after it
A split on the canvas: Read the order feeds Each pallet, whose box holds Label the pallet, and Hand the labels to the printer runs after it

Each iteration is a full activity in the Runs view, so you can inspect inputs and outputs for every single child run.

A run report where the Each pallet connector's combined output sits above its three child runs, each with its own Label the pallet step and output
A run report where the Each pallet connector's combined output sits above its three child runs, each with its own Label the pallet step and output

Class: App\Flows\Connectors\Split\Parallel

Split / Parallel splits an array into individual elements and runs the iteration sub-graph concurrently for each one.

Field Type Description
splitPath string JSONPath expression pointing at the array to split. Default: $ (the entire input).
outputMode enum What the output handle emits once every item has run: combine or summary. Default: combine.
  1. The connector evaluates splitPath against the upstream node’s output.
  2. For each element in the resulting array it spawns a child workflow.
  3. All children run in parallel. Inside the iteration sub-graph the current element is available as $prev, so the first node in the sub-graph reads the split item exactly as it reads the output of any upstream node.
  4. The connector’s output handle emits an aggregated array of every child’s output once they all finish. Results are collected in split order (the order of the elements in the source array), in the same shape as a pager’s output in combine mode. With outputMode set to summary it emits {"count": n} instead.
  5. The next node reads that result as $prev, and any later node can read it by the connector’s name with $workflow->node(). An empty array still emits [] (or {"count": 0}), so those nodes run.

An API returns a list of orders:

{ "orders": [{ "id": 1 }, { "id": 2 }, { "id": 3 }] }

Configure the connector with:

splitPath: $.orders

The sub-graph wired to the iteration handle runs three times in parallel — once for { "id": 1 }, once for { "id": 2 }, once for { "id": 3 }. Inside each run, the current order is $prev, so {{ $prev->id }} resolves to 1, 2, or 3 depending on the child. When all three children finish, the connector’s output handle emits their results as one array in the original order of orders.

See How-to: Parallel processing for a full end-to-end walkthrough.


Class: App\Flows\Connectors\Pager\OffsetBased

Pager / OffsetBased drives a paginated API using offset + size parameters. It runs the sub-graph once per page, advances the offset after each page, and stops when the end condition is met.

Field Type Description
startPage int The page number the first page requests. Default: 0.
startSize int How many records to request per page. Default: 10.
startOffset int The record offset the first page starts at. Default: 0.
nextPage int The page number for the page that is about to run. Default: $page->startData["startPage"] + $page->index.
nextSize int The page size for the page that is about to run. Default: $page->startData["startSize"].
nextOffset int The record offset for the page that is about to run. Default: $page->index * $page->startData["startSize"].
endCondition bool Pagination stops when this is true. Default: $page->index == 10.
outputMode enum What the output handle emits once every page has run: combine or summary. Default: summary.
nextPageProperty string Reserved. The engine does not read this field. Leave it empty.
nextSizeProperty string Reserved. The engine does not read this field. Leave it empty.

startPage, startSize, startOffset, nextPage, nextSize and nextOffset are integer fields and endCondition is a boolean field, so write their expressions bare, without {{ }} braces. Echo braces produce a string, which those fields reject.

Inside the iteration sub-graph, expressions reference the current page through $page:

Path Type Description
$page->index int Zero-based page counter (0 for the first page, 1 for the second, and so on).
$page->startData["nextPage"] int The page number for the page currently running.
$page->startData["nextSize"] int The page size for the page currently running.
$page->startData["nextOffset"] int The record offset for the page currently running.
$page->startData["startPage"] int The pager’s configured start page.
$page->startData["startSize"] int The pager’s configured page size.
$page->startData["startOffset"] int The pager’s configured start offset.
$page->prevOutput mixed The output of the page that just finished. Only endCondition can read this (see below).

Inside a @json block the same values are reached as JSONPath strings: "$.page.startData.nextOffset" is the @json spelling of $page->startData["nextOffset"].

Use these in a Transformer to build the request parameters for each page:

@json
{
"offset": "$.page.startData.nextOffset",
"limit": "$.page.startData.nextSize"
}
@endjson

Pagination stops when endCondition evaluates to truthy. The page that produced the truthy value has already run, so nothing is lost.

End condition Stops when
$page->index == 10 After 10 pages (the default).
count($page->prevOutput) == 0 The last page came back empty.
$page->prevOutput->hasMore == false The API says there are no more pages.
$page->index == 50 || count($page->prevOutput) == 0 Either condition, with a hard bound as a safety net.

endCondition is the only pager field that can read $page->prevOutput. The next* fields are frozen into the page’s start data before that page runs, at which point the previous page’s output is not yet available to them. This is why the pagers cannot follow a cursor returned in the response body, and why nextPageProperty and nextSizeProperty do nothing.

outputMode decides what the pager’s output handle emits once every page has run:

Mode Emits
summary {"count": n}, the number of pages that ran. This is the default.
combine Every page’s output, in page order, as one JSON array.

Keep summary when the iteration sub-graph already did the work (wrote the rows, sent the messages, embedded the documents). The combined aggregate is stored in the run’s record, so on a long run dropping it saves a lot of space.


Class: App\Flows\Connectors\Pager\PageBased

Pager / PageBased is the page-number variant of the pager — it advances a page parameter instead of an offset. Use it for APIs that accept page=1, page=2, etc.

A page-based pager on the canvas: Every page of invoices holds Fetch a page in its box, and Report the import runs after it
A page-based pager on the canvas: Every page of invoices holds Fetch a page in its box, and Report the import runs after it

Identical to Pager / OffsetBased, minus startOffset and nextOffset:

Field Type Description
startPage int The page number the first page requests. Default: 0.
startSize int How many records to request per page. Default: 10.
nextPage int The page number for the page that is about to run. Default: $page->startData["startPage"] + $page->index.
nextSize int The page size for the page that is about to run. Default: $page->startData["startSize"].
endCondition bool Pagination stops when this is true. Default: $page->index == 10.
outputMode enum combine or summary. Default: summary.
nextPageProperty string Reserved. The engine does not read this field. Leave it empty.
nextSizeProperty string Reserved. The engine does not read this field. Leave it empty.

Same as Pager / OffsetBased above, with the offset entries omitted:

Path Description
$page->index Zero-based page counter.
$page->startData["nextPage"] The page number for the page currently running.
$page->startData["nextSize"] The page size for the page currently running.
$page->prevOutput The previous page’s output, readable only from endCondition.
startPage: 1
startSize: 50
endCondition: $page->index == 100 || count($page->prevOutput->data) == 0

The pager stops when the data array in the response is empty, with a 100-page bound so a misbehaving API cannot page forever. The iteration sub-graph reads $page->startData["nextPage"] and $page->startData["nextSize"] each round to build the request.


Connector Use when
Split / Parallel You already have a complete array and want to process elements concurrently.
Pager / OffsetBased The API paginates by offset + limit.
Pager / PageBased The API paginates by page number + size.

A connector’s iteration sub-graph can hold another connector. Each combination works:

  • A split inside a pager: fetch a page, then process each record on it in parallel.
  • A pager inside a pager: page through customers, then page through each customer’s orders.
  • A pager inside a split: for each account in a list, page through that account’s records.

The inner connector runs once per outer page or element, and an inner pager walks its own pages each time, starting again from its startPage or startOffset. Inside the inner pager’s sub-graph, $page is the inner pager’s current page.