Can we refresh context manually using function or API?

Hi, wanna know if we can refresh context to clear up the chat history without the user have to refresh the page. So the refresh context is triggered by certain node, function or API.

There’s a use case where goal is to clear the chat history if the user do some action (like click a button or something) it’s clearing the chat history

@EgrianoA

Just to understand the use-case better — Based on an action by a user inside the chat bot flow, you want to completely reset the bot session

Is my understanding correct?

Correct @gautham, that’s the use case we’re facing

why is this needed ? Can you dive deeper - what is the purpose of clearing chat history in middle of session?

This could be useful when testing the bot within the preview. At times, when testing flows, the bot will store variables. And when trying to retest, the bot may already have the variables stored. It would be useful, especially for testing, if there was a method to clear the chat memory or cache, so we can properly test the bot as if it was a blank slate. Something like reseting chat session.

An example of how this could potentially be done is if the user types in the work “reset,” the bot would recognize that as a global function, and delete the session history and start the conversation over with all variables cleared out.