Tailflow
Skip to article
Browse documentation

Actions

Transform

Reshape data with a short JavaScript script.

Read input, return output

Use input.event for the triggering event and input.actions for earlier outputs on this path. Return a JSON-compatible value, usually an object with named fields.

Write JavaScript directly; do not insert {{ }} templates into the script. The script cannot make network requests or access files and has one second to finish. Keep its returned output below 64 KB.

Each run starts fresh. There is no persistent state for a running total across different events; calculations are limited to the event and earlier outputs supplied to this run.

Transform Input and Script Editor
Event shape
value_decimal
125000
token_symbol
USDC
Transform · Script
Example. Event fields and earlier action outputs are available through input. Return an object to expose named fields to the next action.Changes stay in this example. Nothing is saved or sent.

Example

This creates a concise summary while preserving amounts as text. It does not convert large token values to JavaScript numbers, which could lose precision.

Transform Action Configuration
Path 1
Every event
Transform
Selected action
1Transform
Sample output
actions.transform_1.summary
125000 tokens moved
Continue on error
A failure stops later actions on this path.
Example. Read the event through input.event and return an object. A test executes the script and lets you inspect the fields it returns.Changes stay in this example. Nothing is saved or sent.
JavaScript
return {
  summary: `${input.event.value_decimal} ${input.event.token_symbol} transferred`,
  link: input.event.explorer_tx_url
};

Use and test the result

A later message can read {{ actions.transform_1.summary }} and {{ actions.transform_1.link }}. The output key is shown in the inspector.

Transform executes during Test run, so you can inspect its actual result. A script error, excessive runtime, or oversized output fails the action and stops the path unless Continue on error is enabled.

Email Configuration with Transform Output
Transform · Output
actions.transform_1.summary
125000 USDC transferred
actions.transform_1.link
https://example.com/transaction
Email · Body
Rendered
125000 USDC transferred https://example.com/transaction
Example. Select an output from the earlier Transform action, then test the message. The action must be above the message on the same path.Changes stay in this example. Nothing is saved or sent.