Remember session reset ?

Hello again. One last question for today: If I set typebot to remember user, can I somehow programmatically reset that session? So let's say Typebot.reload(); would also start from the beginning for example ? Or how do I start it clear?
1 Reply
Baptiste
Baptiste3mo ago
Here is how we do it internally:
const wipeExistingChatStateInStorage = (typebotId: string) => {
Object.keys(localStorage).forEach((key) => {
if (key.startsWith(`typebot-${typebotId}`)) localStorage.removeItem(key);
});
Object.keys(sessionStorage).forEach((key) => {
if (key.startsWith(`typebot-${typebotId}`)) sessionStorage.removeItem(key);
});
};
const wipeExistingChatStateInStorage = (typebotId: string) => {
Object.keys(localStorage).forEach((key) => {
if (key.startsWith(`typebot-${typebotId}`)) localStorage.removeItem(key);
});
Object.keys(sessionStorage).forEach((key) => {
if (key.startsWith(`typebot-${typebotId}`)) sessionStorage.removeItem(key);
});
};

Did you find this page helpful?