Skip to content
Docs

Text Expression

Text Expression evaluates one expression against the run’s context and emits the result. Use it to extract, compute, or forward exactly one value, for example pulling a field out of a large API response before handing it to a node that expects a scalar. You find it on the node picker’s Transform & data shelf.

The Text Expression node's settings form, with the fields described below
The Text Expression node's settings form, with the fields described below
FieldTypeDefaultDescription
Expression (expression)string ✦ (required) — The text or expression to evaluate; the resolved value is returned as the node output under a “result” key.

Fields marked ✦ accept expressions.

Try this node — run it once against your own workspace, with your credentials, without building a flow first.

Whatever the expression resolves to is wrapped as a result key and emitted as JSON. Downstream nodes read it through $prev->result.

Expression Output
$prev->quantity * $prev->unitPrice {"result": 62.5}
{{ $prev->user->email }} {"result": "alice@example.com"}
jsonpath($prev, '$.items[*].id') {"result": [1, 2, 3]}
$kv->lastSyncCursor {"result": "<cursor value>"}

Bare expressions preserve the value’s native type (number, boolean, array, object). Echo tags ({{ }}) and directives always produce a string, so reserve them for when the downstream node expects one. See How-to: Use expressions for the full syntax.

The TextExpression template in the gallery (Automation → Templates) computes a derived value from an upstream order:

$prev->quantity * $prev->unitPrice

With {"quantity": 5, "unitPrice": 12.50} upstream, the node emits {"result": 62.5}, a number rather than a string.

For multi-step computations, use an assignment-only @php block and emit the result at the end:

@php
$items = jsonpath($prev, '$.data[*]');
$total = array_sum(array_map(fn($x) => $x->amount, $items));
@endphp
{{ sprintf('%d items totalling %.2f', count($items), $total) }}

The emitted value is a string here, because the template ends in an echo tag. When the downstream node needs a document rather than one value, build it in a Transformer instead.

An Agent can call a connected Text Expression node as a tool, which makes it a way to hand an agent one precomputed lookup.