Skip to content

Integration Input Expressions

Every input on an Integration node has a Value / Expression toggle in the editor. In Value mode the widget's content is sent as the input value. In Expression mode the widget becomes a JavaScript editor, its content is evaluated when the node runs, and the result is sent as the input value. {{ }} placeholders are resolved first in both modes.

Expression mode is set per input, so one node can mix expression inputs and plain values.

Not the Expression node runtime

This page documents the Integration node input contract only. It is not the runtime described in Expression Context: integration input expressions have a much smaller set of bindings, and several things that page teaches (return, io, await, libraries, $ globals) do not work here.


When to use an expression input

Use an expression input when the value is not a design-time constant — when it has to be computed from the data flowing through the workflow at the point the node runs:

  • pass the total an upstream HTTP node returned into a payment integration,
  • build a recipient list from the models that triggered the workflow,
  • normalise an email address before it goes to a mailing integration,
  • pick a template or a folder based on a field of the triggering document.

Value mode is still the right choice for anything fixed: a channel name, a static template, a literal amount, a folder name.

The expression does not have to evaluate to a string. Its result is sent as the input value, so it can be a number, a boolean, an array or an object when the integration's input type expects one.


What is in scope

An integration input expression is evaluated with these bindings, plus plain JavaScript:

Binding Contents
input The node's input data: the trigger payload, plus the result of every node that has already run, keyed by that node's name.
models / model input.models / input.model — the documents that triggered the workflow, as the documents' own fields. models is null — or an empty array on a custom event sent without records — when the trigger carried no documents (a Recycle run, for example), so use models?.length or model != null to check. model is set only when exactly one document triggered it.
component_uuid The component the workflow runs on. For a project-level workflow it is the workflow's UUID.
project_uuid The project the workflow belongs to.
env The environment: "dev" or "live".

input contains more than the values you need

Alongside the data your integration needs, input carries the node's own settings, the component config on lifecycle events, the project's global environment variables on custom-triggered runs, and other trigger internals. Several of those can hold secrets. Send the individual fields the integration expects, not input or a copy of it, so credentials are not handed to a third-party service.

Reading upstream results

A node that has already run appears in input under its name, with the result it stored:

// piped data of the node named "Fetch Order"
input["Fetch Order"].pipedData.total

pipedData is what that node passed downstream; debugData holds anything it added for debugging. This is the same result shape downstream nodes receive, and it covers every node that has already run, not just the one directly above.

Note

_input also exists as a binding here, but it is not populated with previous node results in an integration input. Read them from input as shown above.

Examples

// total from an upstream node with a 20% markup
input["Fetch Order"].pipedData.total * 1.2
// recipient list from the documents that triggered the workflow
models.map(doc => doc.email)
// normalise a single address
models[0].email.trim().toLowerCase()
// an object payload assembled from several sources
({
    order_id: models[0].uuid,
    environment: env,
    amount: input["Fetch Order"].pipedData.total
})

An object literal must be wrapped in parentheses so it is parsed as an expression rather than a block.


What is not available

This is the important half of the contract. Each of these is a reasonable thing to try after reading Expression Context, and each one fails in an integration input expression.

  • No return. The expression is the value — write input["A"].pipedData.total * 1.2, not return input["A"].pipedData.total * 1.2. A top-level return is a syntax error.
  • No libraries. There is no _ (Lodash), moment, Handlebars, Buffer, crypto, jwt, bcrypt, uuid, nanoid, otp, btoa, atob or $sdk, and no console — console.log is a reference error.
  • No $ globals. There is no $models, $args, $context, $event, $initiator, $config, $globalEnv or $currentEnv. On lifecycle triggers (Create, Update, Delete and their Before:: variants) the same data sits under input: $config is input.config, $args is input.args, $context / $event / $initiator are input.context / input.context.event / input.context.initiator, and $currentEnv is env. $globalEnv is input.global_env_vars, which only workflows started through the custom event API carry; on those runs input is the caller's own payload, so input.config and input.args are whatever the caller sent rather than component settings. $models is models — plain documents, without the Model helpers Expression nodes get (getRefObj(), getRevisions()); a _RefObj field such as doc.customer_RefObj is read directly.
  • No io. There is no io.pipe(), io.each() or io.getPipedDataOf(), and no Debug, Decorator or RetryableError. Read upstream data through input instead.
  • No async/await, no platform calls. An integration input expression can only reshape data that is already in scope; it cannot fetch anything. await is not available, and an async expression does not fail loudly: the input receives a promise object instead of its value — it reaches the integration as an empty {} — and errors thrown inside it are lost.

Compute it in an Expression node upstream

If you need any of the above — a library, io, await, the SDK, another platform call — compute the value in an Expression node upstream and read it here through input. This is the supported pattern.

Upstream, in an Expression node:

io.pipe({ total: $models.reduce((sum, doc) => sum + doc.total, 0) })

Then, in the integration input on a node downstream of Compute Total:

input["Compute Total"].pipedData.total

Mustache templates are resolved first

{{ }} placeholders are substituted in all of the node's inputs, in both modes, before any expression input is evaluated. In an expression input the substituted text lands in the JavaScript source, and only then is the expression parsed.

The placeholders read from the trigger payload through input / _input, and from what upstream nodes piped through node / _node. An expression input written as 100 * {{input.rate}} with input.rate set to 1.2 is parsed as 100 * 1.2.

Warning

Do not put {{ }} in an expression-mode input. The substitution is text, not data:

  • A missing or misspelled key renders as empty text, so 100 * {{input.rate}} can become 100 * and fail with a syntax error.
  • Values are HTML-escaped, so a quote in a substituted value becomes an entity and the value is silently corrupted.
  • In code position the substituted text is JavaScript. A value that comes from data — a document field, for example — is executed as part of the expression, including anything it wants to do with the node's bindings.

Read data through input instead; it arrives as values, not as source text.


Failure behaviour

  • If an expression throws, times out or exceeds the evaluation bounds, the node fails and the integration is not called with partial inputs.
  • A malformed {{ }} placeholder fails the node during the template pass, before any expression is evaluated.
  • Switching an input to Expression makes whatever is already in the widget JavaScript source: a value-mode number, boolean or tag list is not text, so the node fails, and leftover plain text such as general or a raw JSON object is read as code and fails too.
  • Expression input failures are not retried. The expression runs on the same data every time, so a retry would fail the same way; the failure is final for that node.
  • All expression inputs on one node share a single evaluation time budget — the same evaluation timeout an Expression node gets, 60 seconds by default — rather than one budget each. A node with four expression inputs gets 60 seconds in total, not four times 60. Unlike an Expression node, a timeout here is not retried.
  • The result has to be a value the integration call can carry: NaN and ±Infinity fail the node when the request is built, and an expression that evaluates to undefined is sent as null.