Utility

Custom Node

Category
Utility
Node Type
Custom Code Execution

Overview

The Custom Node allows you to create and run your own custom logic inside a workflow. It’s designed for advanced users who need to perform specialized operations that are not covered by existing nodes — such as data manipulation, transformation, or custom API calls.

By writing a short function in a supported programming language, you can fully customize how this node behaves and what kind of output it produces.

Description

Execute custom logic.

The Custom Node gives developers the freedom to write and execute custom code directly within a workflow.

JavaScript (Node.js)

Run JS code for data processing or logic.

Python

Execute Python scripts for advanced operations.

This is especially useful when you want to process data in a unique way, connect to unsupported APIs, or apply custom business logic.

Input Parameters

The Custom Node accepts parameters that define the programming language and code you want to execute.

languagestringRequired
The programming language to use ('javascript' or 'python').
Example
"javascript"
functionCodestringRequired
The actual code function to execute.
Example
"function run(input) { return { result: input.value * 2 }; }"
Writing Code
  • Input Access: Use input.variableName to access data passed to the node.
  • Return Value: Your function MUST return a JSON object (e.g., { result: "value" }).

Output Parameters

This node does not have fixed output parameters. Instead, outputs depend entirely on what your custom function returns.

Dynamic OutputanyOptional
The JSON object returned by your custom function.

Accessing Outputs: Use variable references like {{customNode.output.result}} or {{customNode.output.status}}.

Output Type

Output Type: Dynamic

The output type depends on the return value of the custom function. It is typically a JSON object.

Example Usage

Example 1: Basic Calculation (JavaScript)

Double the input value.

{  "language": "javascript",  "functionCode": "function run(input) { return { result: input.value * 2 }; }"}
{  "result": 10}

(Assuming input value was 5)

Example 2: String Manipulation (Python)

Convert text to uppercase.

{  "language": "python",  "functionCode": "def run(input):\n    return { 'message': input['text'].upper() }"}
{  "message": "HELLO WORLD"}

(Assuming input text was "hello world")

How to Use in a No-Code Workflow

1

Add the Node

Add the Custom Node to your workflow.

2

Select Language

Choose JavaScript or Python.

3

Write Function

Add your logic in the functionCode field. Ensure it returns a JSON object.

4

Pass Inputs

Map data from previous nodes to be used in your code (e.g., {{previousNode.output.value}}).

5

Test

Run the workflow to verify your code works as expected.

Best Practices

  • Keep your function small and focused.
  • Always validate input data.
  • Return results in a consistent JSON structure.

Do / Don’t

Do
  • ✔️ Use try-catch blocks to handle potential errors.
  • ✔️ Test your code with edge cases.
  • ✔️ Use descriptive keys in your return object.
Don’t
  • ❌ Don’t write infinite loops.
  • ❌ Don’t depend on external libraries that aren't supported.
  • ❌ Don’t return non-JSON values (like raw strings or numbers) directly.

Common Errors

Invalid function codeErrorOptional
Syntax errors or missing return statement.
Runtime errorErrorOptional
Code failed during execution (e.g., invalid input).
No output generatedErrorOptional
The function executed but returned nothing.

Example Workflow Integration

Use Case 1: Data Transformation

Clean up AI-generated text before sending.

  1. Text Generation: Generates raw text.
  2. Custom Node (JS): Trims whitespace and removes special characters.
  3. Slack Message: Sends the cleaned text.

Workflow Data Flow:

{{textGeneration.content}} →  {{customNode.input.text}}
{{customNode.cleanedText}} →  {{slackMessage.message}}