absent-sapphire
absent-sapphire15mo ago

Integration with the website

Hi, I have a namespace in my global window object (on the web). I would like to trigger a javascript code from within Voiceflow using a button. Is this possible? Thanks
2 Replies
Tico | Voiceflow Assistant
Yes, you can interact with the Voiceflow Web Chat widget programmatically using JavaScript. Here’s how you can achieve this: 1. Load the Web Chat Widget: First, ensure that the Web Chat widget is loaded on your webpage. You can do this using the load method.
window.voiceflow.chat.load({
projectID: 'your_project_id',
url: 'https://general-runtime.voiceflow.com',
versionID: 'production'
});

window.voiceflow.chat.load({
projectID: 'your_project_id',
url: 'https://general-runtime.voiceflow.com',
versionID: 'production'
});

2. Interact with the Widget: You can use the window.voiceflow.chat namespace to interact with the widget. For example, you can use the open and close methods to open and close the widget window, or the show and hide methods to render or hide the widget. 3. Customizing the Widget: You can further customize the appearance and behavior of the Web Chat widget using additional settings and configurations. For more detailed information, you can refer to the Web Chat API documentation and the Customization & Configuration guide.
absent-sapphire
absent-sapphireOP15mo ago
I want to trigger another code when the user clicks on a button. This code must have access to the global window. For example if I have a namespace Tesla_Namespace, then I want to run a function that is in window.Tesla_Namespace

Did you find this page helpful?