Launch the Chatbot after a delay

Learn how to run the Chatbot after a delay using Javascript

Start by retrieving the code needed to display the Chatbot from the platform. You will find the procedure in the following documentation: How to install my chatbot on my website

Next, remove the first line, namely :

<script type="text/javascript">

And the last one:


Insert the resulting code into a Javascript function:

function launchChatbot() {
(window as any).chatboxSettings = {
appKey: 'xxxx',
websiteId: 'xxx',
language: 'fr',

(function (d, s, id) {
let js: any, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {
js = d.createElement(s); = id;
js.src = '';
js.async = true;
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'chatbox-jssdk'));

This newly created function will launch the bot as soon as you call it. You can execute it when a button is clicked, after a certain delay or following any other Javascript action.

Example of Chatbot execution (via the launchChat function we’ve just created) following a 10s delay (10000ms):

setTimeout(launchChatbot, 10000);

How to install my chatbot on my website

➜ Discover Botnation and launch your chatbot easily!