bright-printer-40954
06/05/2025, 9:53 PMbillowy-electrician-32883
06/05/2025, 7:57 PMbrash-greece-44635
06/05/2025, 6:13 PMearly-zebra-570
06/05/2025, 3:35 PMfresh-motherboard-89246
06/05/2025, 3:05 PMabundant-arm-88602
06/05/2025, 2:01 PMincalculable-barista-24878
06/05/2025, 1:13 PMlittle-magazine-52744
06/05/2025, 7:41 AMlittle-magazine-52744
06/05/2025, 7:39 AMcrooked-xylophone-42186
06/05/2025, 7:19 AMorange-flower-53833
06/05/2025, 3:18 AMmammoth-journalist-66614
06/05/2025, 2:18 AMcreamy-pager-81097
06/04/2025, 11:54 PMgorgeous-forest-752
06/04/2025, 6:07 PMjs
// the lines below were removed
window.botpress.on("webchat:ready", () => {
window.botpress.open();
});
// the line below is added to the end of the script tag below the init call
setTimeout(() => {
window.botpress.open();
}, 1000)
Hi!
I'm trying to set up the bot in a way where the conversation automatically launches upon loading the host link.
Following the embed instructions provided in the HTML div section of the docs (https://botpress.com/docs/webchat/embedding-webchat), the webchat injection doesn't seem to automatically fire off in versions 2.3 and higher, where even if I have window.botpress.toggle()
(or window.botpress.open()
for that matter as well) within the window.botpress.on(webchat:ready...)
snippet, it still seems to only start the conversation when I click on the .bpFab
widget.
I am able to get the conversation to automatically open when using versions 2.2 or lower, but am concerned about functionality issues by using an older version of the injection. Just wondering if there was a way to get the window to automatically toggle on for 2.5 (or if I'm not really losing anything by using the 2.2 version)?
For reference here is the .html file in question below:
html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>The Title</title>
</head>
<body>
<div id="webchat-container" style="position: relative; width: 100%; height: 100%;">
<script src="https://cdn.botpress.cloud/webchat/v2.5/inject.js"></script>
<script>
console.log("Step 1") // This is logged in console
window.botpress.on("webchat:ready", () => {
console.log("Step 2") // Does not log in console unreachable?
// window.botpress.open();
window.botpress.toggle(); // both lines seem to not fire off on load for 2.3, 2.4, 2.5
console.log("Step 3") // Does not log in console either
});
window.botpress.init({
"bot init info here"
});
</script>
<style>
#webchat-container {
position: relative;
width: 100%;
height: 100%;
}
.bpFab {
display: none;
}
.bpWebchat {
position: absolute !important;
top: 0 !important;
left: 0 !important;
right: 0 !important;
bottom: 0 !important;
width: 100% !important;
height: 100% !important;
}
</style>
</div>
</body>
</html>
Thanks in advance!brash-greece-44635
06/04/2025, 3:49 PMbrainy-river-21984
06/04/2025, 2:59 PMfresh-ghost-16400
06/04/2025, 2:03 PMearly-cartoon-84199
06/04/2025, 1:20 PMwooden-beard-40210
06/04/2025, 10:31 AMagreeable-student-97100
06/04/2025, 9:14 AMloud-church-81275
06/04/2025, 7:43 AMfresh-baker-79506
06/04/2025, 5:22 AMchilly-pizza-70576
06/04/2025, 3:47 AMbreezy-exabyte-30591
06/04/2025, 12:18 AMmodern-van-806
06/03/2025, 11:06 PMbillions-nest-47670
06/03/2025, 8:48 PMripe-notebook-38378
06/03/2025, 8:44 PMmany-musician-33755
06/03/2025, 6:36 PMaloof-soccer-25347
06/03/2025, 6:02 PMglamorous-evening-33371
06/03/2025, 5:38 PM