Proactive bot repeats message when closing and opening chat buble

Hi, i’m in the final steps of setting up the bot, I have created a proactive hook and message that is beign displayed correctly, however, when I close the chat and open it again, the message is shown again. This makes for a absurdly long chat history every time I close and open the bot window.
I need one of two solutions, erase the chat history every time the chat is closed or the page is refreshed.
Or, make the bot know that it is the same session and that it doesn’t have to show the welcome message again.


Please, if you care to reply, keep in mind i’m not a developer or programmer, I just know how to google and watch tutorials, so if you respond something like “you have to store a value and then read it” I will NOT know how to do it, and the documentation is very vage to someone whos knowloedge in coding is minimal.

Hie @makoto thank you for reaching out on the forum.

Unfortunately, you can only get away with so much as a non-dev using Botpress. You will only be able to implement built-in features and use well-documented, straightforward code and processes. This is because Botpress is a developer tool which is the only way we can make our product cater for every conceivable chatbot building use-case.

However, the built-in tools in Botpress which do not need a developer to understand and use match and exceed drag and drop chatbot building platforms currently available on the market.

To answer your question, you have conditional code which runs when the webchatOpened event is fired which gives rise to the behavior you are experiencing.

You can check which other events you can use in data/assets/modules/channel-web/examples/embedded-webchat.html or add a flag to that condition which is applied the first time the code is run and tested for every subsequent time.

Thanks, I suggest to implement this request, as is a behavior one would expect from a chatbot. It’s kind of weird to have to be a developer only to hide previous chat from an user.

I feel your pain @makoto. You can post this as a Github Issue and the engineering team will be sure to look at it and advise.

In the future please direct your questions to our community forums and, for GitHub issues & feature requests, please make sure your issues follow our contribution guidelines and that you use the provided issue templates.

To achieve this behaviour:
You can enable the useSessionStorage on the embedded webchat config with window.botpressWebChat.mergeConfig({ useSessionStorage: true }) this will persist the conversation only for the lifetime of the browser tab.

Another alternative is enable exposeStore on your config and to listen to the webchatLoaded event on the global window object. On that event, call or depending on the behaviour you want.

This was the response. I’m trying to figure out how to implement it and wasting time on this simple subject. I feel like it would take 2 minutes for someone to give me a hand.

Hie @makoto, thank you for your feedback.

I think the response is relatively straightforward for a developer with basic Javascript knowledge. As you might appreciate from my note before, we are hard-pressed for time to write code. Our role is to give insights and pointers to solutions.

Would you please rope in a Javascript developer to assist you or invest some time learning this programming language? If you do not take one of these two steps, you will have difficulty doing anything outside the built-in functionalities.