Overview
The Custom Code Node lets you run JavaScript within your conversations for advanced data processing, calculations, API calls, and business logic—all securely on Bland’s infrastructure, with fast performance and no need for outside services. Prerequisites:- A Bland Enterprise account with Custom Code Node access (reach out to Bland support to get access)
- A Bland Pathway configured for your use case
- Basic knowledge of JavaScript programming
- Understanding of JSON data structures
Overall Call Flow
The custom code node follows this execution flow:- Agent enters the custom code node during pathway execution
- Variables from the conversation are extracted and made available to your code
- Your custom JavaScript code executes with access to these variables
- The code processes the data and returns a JSON response
- Returned data becomes available as variables in subsequent pathway nodes
- Agent continues to the next node in the pathway
The Custom Code Node
Node Configuration
When you add a Custom Code Node to your pathway, you’ll see a comprehensive interface for configuring your code execution:
Reference Variables
The first section allows you to define variables to be used wihtin your custom code execution. These variables can be of two types:- Static Variables: Constants that are definied in this section, and will be the same throughout all your calls.
- Dynamic Variables: Variables that are defined based on variables extracted previously in the pathway.

Example
Example
For instance, in the example shown, any caller under 25 will have their request automatically rejected.To easily generate extraction code for your pathway variables, you can click the “Generate variable extraction code” button, and it will automatically insert into the editor. In the example above, the following will be inserted:
Code Editor
The main code editor provides:- Syntax highlighting for JavaScript
- Auto-completion and IntelliSense
- Error detection and debugging support
- Code formatting and indentation
Test Mode
The Custom Code Node includes a robust testing environment: Test Mode Toggle: Switch between normal editing and test mode- Normal Mode: Configure actual variables that will be extracted from conversations
- Test Mode: Set mock values for testing your code logic Mock Test Variables: In test mode, you can provide sample data to test your code: Run Test Button: Execute your code with the mock data to see returned variables immediately
Response Handling
The response from your custom code becomes available as variables in subsequent pathway nodes. Your code must return a JSON response usingResponse.json()
.
Example response:
processed_total
, discount_applied
, final_price
, customer_tier
) become available as variables you can reference in later nodes using {{processed_total}}
, {{discount_applied}}
, etc.
For additional questions or advanced use cases, please reach out to hello@bland.ai or through our support channels.