Creating a function node
- Drag a Function node onto your decision graph
- Connect it between other nodes
- Click Edit Function to open the code editor
Basic structure
Every function node exports a handler that receives input and returns output:input parameter contains data from the previous node in your graph.
Accessing previous nodes
Useinput.$nodes to access outputs from any upstream node in your graph:
input.$nodes.NodeName.field to reference any field from an upstream node’s output. Node names are case-sensitive and must match exactly.
Example: Calculate loyalty points
Supported libraries
Function nodes include several built-in libraries:Using dayjs
Using big.js for precision
Making HTTP requests
Async/await
Function nodes support async operations. Useasync/await for any asynchronous logic:
Debugging
Useconsole.log to debug your functions. Output appears in the simulator:
Execution limits
Function nodes have these constraints:
If your function exceeds the timeout, evaluation fails with an error.