Add the External Script Node
Place it on the canvas with a valid JSON input (e.g., {}
).
Define the Script in Embedding Code
Add the script to the externalScripts property in the embedding script.
External Scripts added to the Mavenoid Assistant embedding script for a website are not automatically available in the Sites. To enable these scripts in Sites, the external script must be defined in a separate script file and meet the following requirements:
Structure
window.mavenoidExternalScripts = {
async myExternalScript(input) {
// Insert logic here
}
}
Reference in Sites Touchoint: The script must be added in the Sites configuration.
Script hosting
The .js
file can be hosted on your own domain, OR
By Mavenoid, in which case Mavenoid controls the deployment/update of the script.
Input Format: JSON, with references to session info (e.g., $sessionId
, $language-iso
).
Output Format: Script can return form data objects to pass data back to the flow.
mavenoid.push({
event: "assistant-mount",
clientId: "YOUR_CLIENT_ID",
externalScripts: {
async sayHello(input) {
var customerName = input.customerName;
alert(`Hello ${customerName}!`);
return {
formData: [
{
id: "result",
value: {
type: "string",
value: "ok",
},
},
],
};
},
},
});