Supported language:
JavaScriptMaximum execution time:
60 seconds
The Code Node environment provides a limited set of functions and libraries.If you need additional functionality, please contact the Channel team.We will review your request and inform you whether support can be added.
requirecan only be used to import the following libraries:HTTP requests inside the node must use
axios.
All code must be written inside the function format shown above.
context: Provides read-only access to user and chat-related data.memory: Used to share and persist data between nodes.
User code memory interface.
The following methods are available:
Method | Description |
| Retrieves the value for the specified key. |
| Stores a value for the specified key. |
| Permanently saves the changes. (Must be called) |
If you only call memory.put() without calling save(), changes will not be saved.
context contains environment information where the code node is executed. It has the following structure:
user: Customer information
userChat: Consultation session information
All data is read-only. → Modifying values inside context will not affect the actual data.
Code nodes provide a single node testing feature. The test environment includes the following information by default:
Customer information (
user)Consultation information (
userChat)Memory (
memory)
Initially, memory starts in an empty state ({}).
Press the run button on the right side of the Sample Values tab to start testing.
After execution, check the success status in the Logs tab.
Click on the log to view the Result and Console log.
Use
console.log()in your code to check execution logs.In Result > In tab, you can view the actual
memory,userChat, anduserdata input during code execution in JSON format.In Result > Out tab, you can check the
memorystate after execution.
If memory.save() is not called, changed data will not be saved, and no changes will appear in Diff.
Let's access the test environment.
The test includes customer information (User), consultation information (UserChat), and memory (Memory) by default. As shown in the sample values, no values are currently stored in memory. It's an empty object.
You can run tests using the run button above the sample values. Upon execution, you will get success/failure logs as shown below. When clicking on the log, you can obtain the Result and Console log. Since we stored the value "bigResult" for the key "smallTalk", the following result appears in Diff.
You can also check the logs written in the code, which can be used for debugging.
In the In tab under Result, you can check the actual values of memory, userChat, and user that were input when the code was executed in JSON format.
As shown in the Out tab, the value "bigResult" is stored in the "smallTalk" key under "memory".
Services like admin panels often restrict access to specific IP ranges.Ask your development team to allow the public IP of the Code Node.You can obtain the IP information by contacting Channel Talk support.