salmon-midnight-96260
08/01/2023, 4:05 AMhttps://cdn.discordapp.com/attachments/1135785341178085426/1135785341593325598/Screen_Shot_2023-08-01_at_1.56.19_pm.png▾
https://cdn.discordapp.com/attachments/1135785341178085426/1135785341970817054/Screen_Shot_2023-08-01_at_2.02.53_pm.png▾
helpful-vr-6699
08/01/2023, 6:22 AMjs
window.addEventListener("load", function () {
// Sends the pay load 2 secs later
setTimeout(function () {
window.botpressWebChat.sendPayload({
type: "trigger",
payload: {
text: "startConversation",
currentUrl: window.location.href
}
});
}, 2000);
// Opens the chat window
window.botpressWebChat.sendEvent({ type: "show" });
});
acceptable-kangaroo-64719
08/01/2023, 10:57 AMsendEvent()
sends a trigger, which is caught by the trigger nodes. sendPayload()
takes the same route as if the user sent a message, and that hits the start node not the trigger.
* You could be hitting both start and trigger nodes, depending on how you're catching the "trigger" payload in your bot. This might be the source fo your double messaginghelpful-vr-6699
08/01/2023, 11:00 AMhelpful-vr-6699
08/02/2023, 5:16 AMsalmon-midnight-96260
08/02/2023, 8:24 AMhelpful-vr-6699
08/02/2023, 10:09 AMsalmon-midnight-96260
08/02/2023, 10:59 AM