Execute Cloud Script Action

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.

Settings

The action uses the following settings:

Setting

Description

Source

The Javascript source to be executed

Remarks

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 5 seconds timeout is applied to every script execution. If your script exceeds this time, it will be forcefully terminated. Given the speed of the Xenioo runtime, 5 seconds is more than enough to execute great a number of operations.

Flow Optimization

The script execution flow can be automatically optimized by Xenioo by automatically adjusting execution. Since the actual flow of your code might be altered by Xenioo (while maintaining the expected results of course) Flow Optimization is optional and can be enabled by just adding //#optimize at the very beginning of your script, like in the example below.

//#optimize
var a = conversation.GetVariable( "dummy" );
if( a = "hello" )
    conversation.Log( "world" );

Flow optimization happens automatically with simpler scripts. Scripts containing functions or complex for/while flows must optin by using the above keyword.

Trigger

This action does not trigger any event.

Variables

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.

Availability

Channel specific availability follows the table below:

Channel

Availability

Facebook

Fully Available.

WhatsApp

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.

Last updated