The "Code Module" is a code executor used to run JavaScript code. There are many modules available on Assistant. These modules provide solutions to most user requests, but sometimes specific demands may arise. With customizable code snippets, you can write code flexibly within the flow and provide solutions to problems.
Code snippets support Node version 18.16. You can utilize JavaScript features up until Node version 18.16.
Code Station
Each generated code block belongs to the respective company. Access to code blocks produced for different companies has been restricted.
You can find Code Station Tab in Company Profile:
You can list, delete, create new code snippets, and when you click on them, you can navigate to the editor page.
When creating a new code block, pay attention to naming it in a meaningful way that is understandable:
After creating a code block, you can perform the deletion process by following the steps below:

Using a code block in an Assistant will lead to errors if it's deleted. Please make sure it's not in use before proceeding with the deletion process
Code Station Editor
When the listed code blocks' links are clicked, they will redirect to the code block editor page. The code block editor page can be defined as the place where users can write and edit functions.
For a more detailed examination, the name of the code block is located at the top left of the page. Similarly, on the top right, just below the version that users can select, there are 'reset' and 'save' buttons. Users can choose the version they want to edit via the select box. The reset button allows the user to revert changes without saving. The save button enables the user to perform the save operation for that code block.

EACH ACTION PERFORMED FOR THE SAVE OPERATION GENERATES A NEW VERSION. USERS CANNOT MAKE UPDATES IN AN EXISTING VERSION.
Editor Tab
It is defined as the place where users enter their code snippets. There are 2 tabs. We will examine the first part, which is the editor.
The editor is a tool within itself that has rules for writing code.
There are predefined variables on the editor. By using the global variables listed below, you can provide support to your code blocks while writing functions.
- BOT_PARAMETERS: You can access the parameters entered by the user on the flow through these variables.
- MBSDK: Mindbehind custom development kit. It enables us to use Mindbehind modules through the SDK.
Rules
1. If the user wants to reflect a message, they should write this message on the module. Variables written on the last line will be returned as a response.
2. If it needs to be conveyed to the user, the type of the variable on the last line can be one of the following: String, Number, and Base Module (MBSDK Components).
3. Due to security measures, the usage of global keywords 'this' and 'constructor' is restricted.
4. The execution time of the Code Block should not impose a heavy load on the system. The maximum execution time is set to 3000 ms.
Parameters Tab
It is designed to specify the parameters that the functions used in the Code Block will take. This way, users who intend to implement the code module on Assistant will fill in the missing fields by seeing these parameters.

Code Station on Assistant
It is the module that enables the use of written code blocks.
Module detail:Function name: List of code blocks generated for 'Company'. After creating a code block, you can see them here.
Function version: A new version is generated with each code block update process. The selection of the generated version is made.
Parameters: The variables we input in the 'parameters' tab on the editor page are listed. If we want to input a parameter on the right side, it should start with the '#' character. For example, #name. If you want to input static data, you can directly add the data itself.
Function name: List of code blocks generated for 'Company'. After creating a code block, you can see them here.
Function version: A new version is generated with each code block update process. The selection of the generated version is made.
Parameters: The variables we input in the 'parameters' tab on the editor page are listed. If we want to input a parameter on the right side, it should start with the '#' character. For example, #name. If you want to input static data, you can directly add the data itself.