Clear previous conversation history on Page refresh

Hello Community,
I am using Botpress Version 10.50.0 with the embedded web-channel.
is there a way to get rid of the previous chat history as soon as I refresh the Website where the chatbot is embedded.
So every new visit or revisit creates a new clean conversation.

Thanks for your suggestions

Another approach would be to create a new user on each refresh.
Is there an option for that?

There was relevant topic on this: Clean history of chat bot

Another approach would be to create a new user on each refresh.
Is there an option for that?

Yep, that’s also possible. For that to work you need to delete bp/token from local-storage so that user will be considered as a new one.

Hi @alex,
meanwhile already removed localStorage and cookies before the botpress init

    var reset_user = function(name) {
        document.cookie = name + '=;expires=Thu, 01 Jan 1970 00:00:01 GMT;';
        document.cookie = name+ '=; path=/; domain=.localhost:3000; expires=' + new Date(0).toUTCString();

but there is another localStorage entry to the URL of the API

Can you give me a hint how to reset this value?

Do you mean it doesn’t get removed?

to make it clear this is my init code:

<script src="http://localhost:3000/api/botpress-platform-webchat/inject.js"></script>
        host: 'http://localhost:3000',
        customStylesheet: 'http://localhost:3001/style_chatbot_iframe.css'

There is a localstorrage key-value pair at at the URL where the Bot ist embedded (localhost:3001) which i can remove by the code above.
But there is another key-value pair at the Botpress host (localhost:3000).
And i have no idea how to reset this one.

You can’t access localStorage of different domain…
What about manipulating history on the backend?

E.g. you could have smth like this in your bot:

bp.hear({ type: 'visit' }, event => {
  const userId = event.sessionId ||;
  const knex = await this.bp.db.get()
  await knex('web_messages').where('userId', userId).del()
  await knex('web_conversations').where('userId', userId).del()

Hi @safcgehrke,
I also having same problem.I want to clear my localstorage in botpress.
I used localstorage.clear(‘bp/socket/user’) command to clear my localstorage in index.js file.But in console it shows me error like localstorage is not defined.Please help me.Thankyou

Hi @alex,
In cant able to use localstorage command in my index.js file in botpress.Please explain me the solution.Thankyou

This won’t work since index.js is executed on server.

Thanks @alex How to publish my botpress on Azure server.When I trying to publish my botpress it showing an error like…Unknown compiler option ‘declaration map’ in tsconfig.json file…Please help me…Thank you

11.x isn’t stable yet, so deployment may not work for it, sorry.

Hello, is this method still working? I’ts not working in my case:

Can someone help me?