I’m trying to add a feature to my Voiceflow chatbot where I can save as a variable the website URL. I need it for the chatbot flow so it should be saved as a variable inside the flow.
I tried using the javascript module:
websiteURL = window.location.href
It says that window is not defined.
I also asked to the AI Voiceflow Assistant an it told me to modify the launching code to get the url as a variable, it didn’t work neither.
<script type="text/javascript">
(function(d, t) {
var v = d.createElement(t), s = d.getElementsByTagName(t)[0];
v.onload = function() {
window.voiceflow.chat.load({
verify: { projectID: 'XXXXCURRENT_IDXXXX' },
url: 'https://general-runtime.voiceflow.com',
versionID: 'production',
variables: {
websiteURL: window.location.href
}
}).then(() => {
setTimeout(function() {
window.voiceflow.chat.open();
}, 200);
});
}
v.src = "https://cdn.voiceflow.com/widget/bundle.mjs"; v.type = "text/javascript"; s.parentNode.insertBefore(v, s);
})(document, 'script');
</script>```
New contributor
Level5 Automate is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.