Skip to content

Function tool

The Function tool runs a small JavaScript function for each contact. Use it for light calculations, formatting, or branching data — not for hosting a full application.

Code runs in a sandbox on the runtime (not in the browser). console.log does not appear in Chrome DevTools; it appears in the pipeline journey and runtime logs.

Screenshot needed
Function tool step with the code editor showing main(params, context).
Where: Spinner builder → Function tool
Save as: src/assets/screenshots/21-function-tool.png

You must define:

function main(params, context) {
return { ok: true };
}

params is an object with:

  • Metadata fields from the data table (pipeline input)
  • Outputs from earlier steps (for example ai_response, disposition)
Field / methodPurpose
recordId, jobId, projectId, organizationIdIdentifiers
log(message, extra?)Write to journey / runtime logs
vault(label)Read a vault secret by label (async)

Return an object. Its keys merge into the record output for later steps. Avoid returning secrets.

The builder uses a real code editor: syntax colors, line numbers, and Tab to indent.