deep-jade
deep-jade16mo ago

I need the chatbot to start the conversation without the user sending the first message.

How can I configure my chatbot so that when the user opens it, the chatbot immediately welcomes them without the need for a first message from the user?
2 Replies
Tico | Voiceflow Assistant
To configure your chatbot to start the conversation automatically when a user lands on your website, you need to modify the code snippet slightly. The function that opens the chatbot is window.voiceflow.chat.open(). You also need to add a slight delay so it can render properly. Here's what the code should look like:
(function(d, t) {
var v = d.createElement(t), s = d.getElementsByTagName(t)[0];
v.onload = function() {
window.voiceflow.chat.load({
verify: { projectID: 'xxxxxxxxxxxxxxxxxxxxx' },
url: 'https://general-runtime.voiceflow.com/',
versionID: 'production'
}).then(() => {
setTimeout(function() {
window.voiceflow.chat.open();
}, 1000);
});
}
v.src = "https://cdn.voiceflow.com/widget/bundle.mjs"; v.type = "text/javascript"; s.parentNode.insertBefore(v, s);
})(document, 'script');
(function(d, t) {
var v = d.createElement(t), s = d.getElementsByTagName(t)[0];
v.onload = function() {
window.voiceflow.chat.load({
verify: { projectID: 'xxxxxxxxxxxxxxxxxxxxx' },
url: 'https://general-runtime.voiceflow.com/',
versionID: 'production'
}).then(() => {
setTimeout(function() {
window.voiceflow.chat.open();
}, 1000);
});
}
v.src = "https://cdn.voiceflow.com/widget/bundle.mjs"; v.type = "text/javascript"; s.parentNode.insertBefore(v, s);
})(document, 'script');
In this code snippet, window.voiceflow.chat.load() is used to load the chatbot, and window.voiceflow.chat.open() is used to open it. The setTimeout function is used to add a delay of 1000 milliseconds (or 1 second) to allow the chatbot to render properly before it opens. Please replace 'xxxxxxxxxxxxxxxxxxxxx' with your project ID. You can find more information about other functions that the webchat can do here.
xenophobic-harlequin
xenophobic-harlequin15mo ago
Did Tico answer your question? Did you want the chatbot window to start automatically when the user navigates to the webpage that the chatbot is running on? => Ticos answer where you modify the javascript. Or did you want the chatbot start talking first after the chatbot window has already opened? => Use a talk-text-element right after the green start button.
No description

Did you find this page helpful?