<<expression>> pattern, where expression is evaluated at runtime.
Where template expressions are used
The same template engine is used across superglue:- Integrations – connection strings and URL templates
- Step configuration –
urlHost,urlPath,headers,queryParams,body - Transforms – final transforms and data selectors
Template expression modes
There are two kinds of template expressions: simple expressions and arrow function expressions.Simple expressions (legacy)
Simple expressions resolve values directly from the context (payload, credentials, previous step results) without any JavaScript. Syntax:<<variable>><<variable.key>>for nested fields
Arrow function expressions (recommended)
Arrow function expressions use JavaScript arrow functions that receive the context as a single parameter (typically namedsourceData) and return the value to insert. superglue runs these functions in a sandboxed JavaScript VM.
Arrow function expressions are also used in places that are pure code (for example, the
finalTransform field), where you don’t wrap them in << >>. They still receive the same
sourceData context object and behave the same way.Template context
Template expressions evaluate against a context object that depends on where they’re used (step config, integration, or transform).- Arrow function expressions – context is passed as the function parameter (typically
sourceData) - Simple expressions – the string inside
<< >>is resolved against the same context object
Integration context
The context is built from the integration credentials (for example,username, password, access_token).
The sourceData might look like this:
Integration templates are only resolved at tool execution time and get merged
with tool-specific credentials.
Tool step context
The context is the aggregated step input, which includes:payload– workflow input payloadcredentials– resolved credentials for the integration- Previous step results keyed by step ID (for example,
getCustomers) currentItem– current iteration data when the step runs in a loop
sourceData object might look like this:
Pagination variables
When pagination is configured on a step, the following variables are available in the request configuration (urlPath, queryParams, headers, body):
| Variable | Description |
|---|---|
page | Current page number (starts at 1) |
offset | Current offset (starts at 0, increments by pageSize) |
cursor | Cursor value extracted from the previous response |
limit | Same as pageSize |
pageSize | The configured page size |
Stop condition
The stop condition is a JavaScript function that determines when to stop fetching pages. It receives two arguments:-
response– object containing:data– the parsed response bodyheaders– response headers
-
pageInfo– object containing:page– current page numberoffset– current offsetcursor– current cursor valuetotalFetched– total number of items fetched so far
true to stop pagination, or false to continue.
Examples:
Stop when no more pages (using response metadata):
Final transform context
The context is a combined view of the entire workflow execution:- All step results keyed by step ID
- The original
payload
sourceData object might look like this: