Hi to everyone,
I should build a functionality form my bot that clears the conversation when webchat is closed or when the user opens the bot from another page of the website.
How can i do this?
Thanks
f
fresh-fireman-491
03/21/2024, 12:13 PM
Hey there,
You could do something like this:
window.botpressWebChat.onEvent(
function (event) {
if (event.type === 'UI.CLOSED') {
sessionStorage.clear();
localStorage.clear();
}
},
['UI.CLOSED']
)
fresh-fireman-491
03/21/2024, 12:13 PM
You would either clear the session storage or the local storage, it depends on where its stored for you