JavaScript Module
Introduction
The JavaScript module allows you to define and execute arbitrary JavaScript code in the user’s browser. Ensure that the code does not contain any secrets, as it will be sent unencrypted.
Typical Use Cases
This module is useful for performing logical tasks using stored variables within the chat experience.
How to Use the Module
How to write variables from JavaScript
To write variables from JavaScript, define a function named evalFunction that returns an array of objects with key
and value
attributes.
Example:
function evalFunction() {
return [{"key": "somekey", "value": "testvalue"}];
}
Please Note
This variable will not be set directly with the key somekey
. The ID
of the process module will be appended to the given key as a safety measure.
So for example the variable define in the example above would have the key
somekey_e430ec70_3428_4616_a665_a2b4c68d3dec
if the process module’s ID is
e430ec70-3428-4616-a665-a2b4c68d3dec
. You can copy the ID directly when
configuring the module.
Security Considerations
- Testing Restrictions: This module cannot be tested in the Manager or on Publish.
- Platform Support: The JavaScript module is not supported on LoyJoy sites due to security reasons.
- Caution: Use this module with caution due to potential security risks.