Execute Cloud Script Action
Last updated
Last updated
Use this action to execute standard Javascript code on our cloud side. The Javascript code can contain any construct and will have available all of the conversation objects.
The action uses the following settings:
Setting | Description | |
Source | The Javascript source to be executed | |
Engine Settings | Select on what engine you would like your script to run | |
Enable Execution Optimization | Optimize execution for the legacy engine |
Xenioo cloud scripting action uses Javascript as a server side scripting language to extend even further your chatbot functions.
The conversation object, injected in every execution, exposes multiple methods that can be used to interact and alter the current conversation results and variables as well as manage database connections.
The Javascript source is evaluated as a single block. You are free to use functions and standard object methods. ECMAScript 3 and ECMAScript 5 functionality, including ES5 strict mode are supported by the current runtime.
A fixed 3 seconds timeout is applied to every script execution. If your script exceeds this time, it will be forcefully terminated. The script has also a 4096 statements execution limit, meaning that a single script execution cannot exceed 4096 statements, loops included.
Legacy Engine mode is offered as a legacy support for the basic Xenioo scripting engine and should not be used unless specifically required. The V2 Native option is pre-selected and should be the go to choice.
When using the legacy engine, script execution flow can be automatically optimized by Xenioo by adjusting statements execution. Since the actual flow of your code might be altered by Xenioo (while maintaining the expected results of course) Execution Optimization is optional and can be enabled by the toggle displayed when selecting Legacy Engine mode.
Flow optimization happens automatically with simpler scripts. Scripts containing functions or complex for/while flows must activate the optimization flag.
Execution Optimization flag is not available for V2 Native engine since it has these optimizations built-in and it is going to be faster by default than any optimized legacy script.
This action does not trigger any event.
This action produces the following variables:
Variable | Description |
script_result | This variable will hold the standard script result for each execution. |
After execution, script_result may hold one of the following values:
Value | Description |
<empty> | If the variable is empty, no execution exception has been found. The code has been executed successfully. |
TIME_OUT | Your script execution has exceeded the maximum allowed execution time of 5 seconds |
COMPILE_ERRORS | The script has found compile or runtime errors. You can check your chatbot Execution Diagram for details. |
Channel specific availability follows the table below:
Channel | Availability |
Fully Available. | |
Fully Available. | |
Telegram | Fully Available. |
Web | Fully Available. |
Alexa | Fully Available. |
Google Assistant | Fully Available. |
Slack | Fully Available. |
API | Fully Available. |
This action can be used only inside interactions and not as child of other actions. This action requires a Premium Account to be used on a live chatbot.