Custom Node
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"javascript"functionCodestringRequired"function run(input) { return { result: input.value * 2 }; }"- Input Access: Use
input.variableNameto 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 OutputanyOptionalAccessing 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
Add the Node
Add the Custom Node to your workflow.
Select Language
Choose JavaScript or Python.
Write Function
Add your logic in the functionCode field. Ensure it returns a JSON object.
Pass Inputs
Map data from previous nodes to be used in your code (e.g., {{previousNode.output.value}}).
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
- ✔️ Use try-catch blocks to handle potential errors.
- ✔️ Test your code with edge cases.
- ✔️ Use descriptive keys in your return object.
- ❌ 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 codeErrorOptionalRuntime errorErrorOptionalNo output generatedErrorOptionalExample Workflow Integration
Use Case 1: Data Transformation
Clean up AI-generated text before sending.
- Text Generation: Generates raw text.
- Custom Node (JS): Trims whitespace and removes special characters.
- Slack Message: Sends the cleaned text.
Workflow Data Flow:
{{textGeneration.content}} → {{customNode.input.text}}
{{customNode.cleanedText}} → {{slackMessage.message}}
