メインコンテンツまでスキップ

Code node

A Code node lets you write custom JavaScript or Python code to perform complex data transformations, calculations, or logic that goes beyond what other nodes offer. Your code runs in a secure sandboxed environment, and the output becomes available to subsequent nodes in your flow.

Configure the Code node

Selecting a Code node opens a side panel with two tabs: Parameters and Test.

Add custom code

Select Edit code to open the code editor. Use the Language dropdown in the top-right corner to switch between JavaScript and Python.

Code node configuration

Accessing data from previous nodes

Your code can access data from all preceding nodes in the flow. The runtime automatically loads results from ancestor nodes into a variable:

  • JavaScript: Use $nodes — an object keyed by node name, where each entry contains the node's results.
  • Python: Use nodes — a dictionary keyed by node name, where each entry contains the node's results.

For example, to read a value from a preceding node named "Manually start":

const startTime = Number($nodes["Manually start"][0].results[0].startTime)

Accessing data from previous nodes in the code editor

Returning data

Your code must return a value that can be serialized to JSON. The returned data becomes the output of the Code node and can be referenced by subsequent nodes.

return { thirtyDaysAgo }

Referencing the output

Define how other nodes in your flow can reference the Code node's output:

  • Basic referencing: The output is referenced as a single field. Use this for simple return values.

  • Advanced referencing: Define a JSON schema so that specific fields in your output can be individually referenced by downstream nodes.

Included libraries

The Code node sandbox comes with pre-installed libraries for common tasks. You do not need to install them — they are available by default.

JavaScript (Node.js 22)

LibraryVersionDescription
axios1.13Promise-based HTTP client
zod4.3Schema validation
lodash4.17Utility functions
jmespath0.14JSON query language
dayjs1.11Date manipulation

Python (3.12)

LibraryVersionDescription
requests2.32HTTP library
pydantic2.12Data validation
PyYAML6.0.1YAML parser
toolz1.1Functional utilities
pandas2.3.3Data analysis

Execution limits

Code runs in a sandboxed environment with the following limits:

  • Maximum execution time: 60 seconds.

  • Network access: Disabled by default. Contact support if your use case requires making HTTP requests from the Code node.

Test the Code node

Use the Test tab to execute your code and validate the output before publishing your flow.