Workflow transformations
Transformation Steps change the current input before later Steps use it. FastHook offers Formatter, an inline JSON Patch editor, and reusable JavaScript DSL transformations.
Choose the transformation type
Use Formatter for common date, number, text, and list operations without code. Use JSON Patch for deterministic JSON edits that can be expressed as a sequence of RFC 6902 operations. Use a JS Transformation for reusable logic, calculated values, or request-aware processing that is easier to maintain as code.
Formatter
Add Formatter from the Workflow Step picker, then complete three stages:
- Setup — choose Date / Time, Numbers, Text, or Utilities.
- Configure — choose a transform and bind every input to a fixed value, a template, or Trigger/ancestor Step data.
- Test — run the same engine used by Workflow runtime and inspect Data in and Data out.
The v1 catalog includes date formatting, time addition/subtraction and comparison; number/currency formatting and strict arithmetic; text splitting, cleanup, casing, extraction, URL encoding and measurement; and lookup/list conversion utilities. The dashboard loads the available operations and their fields from the versioned runtime catalog, so unsupported operations are not shown.
Every successful Formatter returns an object. Scalar and list operations expose their result under output, so a later Step can map steps.<formatter-step-id>.output. Compare Dates also returns normalized timestamps, signed duration totals, dates_swapped, and same_dates.
Date/time parsing is strict. Date format fields offer Zapier-compatible presets and a Static / Custom menu. Use From Format = X for Unix timestamps in seconds, such as Telegram's date; use To Format = X to return Unix seconds. Z renders an offset without a colon (+0000), while ZZ renders one with a colon (+00:00). v1 supports a bounded Moment-style token subset (YYYY, YY, MMMM, MMM, MM, M, DD, D, HH, H, hh, h, mm, m, ss, s, SSS, A, a, Z, ZZ, X, weekday names, and bracket literals), plus IANA timezone names. A time-only value is anchored to the event ingestion timestamp so retries remain deterministic. Invalid dates and daylight-saving gaps fail instead of silently using the current time.
Formatter does not call external services and never performs currency conversion. Number parsing rejects currency symbols and grouping separators. Text length uses Unicode code points. Lookup keys are case-sensitive. Custom list indexes are zero-based, and negative indexes count from the end. Resolved input and output are each limited to 1 MiB; line-item operations are limited to 10,000 items and lookup tables to 1,000 rows.
The authenticated Control API exposes GET /v1/workflow-formatter/catalog and POST /v1/workflow-formatter/test. The test endpoint is side-effect free and returns data_in, data_out, output_schema, and warnings.
JSON Patch
The builder supports six operations, executed from top to bottom:
addinserts a value or appends an array item.removedeletes an existing value.replacereplaces an existing value.moveremoves a value from one JSON Pointer and adds it at another.copycopies a value to another JSON Pointer.testfails unless the value at a JSON Pointer equals the expected value.
Example:
[
{ "op": "add", "path": "/processed", "value": true },
{ "op": "copy", "from": "/customer/id", "path": "/customer_id" },
{ "op": "remove", "path": "/internal_debug" }
]Paths use JSON Pointer syntax, not dot notation. Escape ~ as ~0 and / as ~1 inside a field name.
Test JSON Patch in the builder
The workspace shows Original, JSON Patch, and Result panels. Load the available trigger or previous-Step sample, add operations from the JSON tree or manually, and run the Patch before saving.
The preview validates syntax and operation order. A real run can still fail if its JSON shape differs from the sample—for example, when a required source path does not exist.
Reusable JS Transformation
Create reusable code under JS Transformations, then choose that resource in a Workflow Transformation Step. At runtime the selected Step input becomes the transformation body. The runtime also receives request headers, query string, path, method, and ingestion timestamp when available.
The successful transformed body becomes the Step output. A runtime exception produces a transformation error that can be handled through an error route.
Mapping after a transformation
Later Steps read the transformed output under steps.<transformation-step-id>. Use the field picker and verify the output preview in Audit before relying on newly created fields.
Transformation checklist
- Prefer JSON Patch for small structural edits.
- Prefer Formatter for common typed operations that do not need custom code.
- Prefer a reusable JS Transformation when logic is shared across Workflows.
- Test missing fields,
null, empty arrays, and alternate provider event shapes. - Keep provider-specific side effects in Actions, not transformations.
- Connect an error route when invalid input should be recorded or recovered instead of failing the whole run.
The existing Transformations reference covers reusable transformations used by direct Connections.