load history of the message in sdk while navigating the pages and maintain the state of the bot


(meem khan) #1

How to maintain the state of the bot while navigating between the pages? If state is open/minimized i want it to be in the same state when moving to the next page.
How to load the previous conversation while navigating to the next page? (i am using unique user id function to generate new uuid for every user an d store it in botOptions.UserIdentity . )
Please help me in this

(Swagat) #2

For your use case you can use local storage to maintain the state (is conversation in progress). You can toggle state from a custom script based on events like bot message user message, close of chat window, timeout after half an hour etc.
You will need to look into our web-sdk to see how you can load chat window automatically in all target pages if your state is in progress. Go through the code carefully to play with it and tweak it as your use case.

If you are using a unique identifier in each page, platform will treat the user as a new user and will never load chat history even if you configure web-sdk to do so. You need to pass same user id. May be from session etc.
Hope this helps.

(meem khan) #3

thanks for the reply @swagata.sengupta. It would be a great help if you help me to point out the exact code that copies the state of the bot across the pages.

(Swagat) #4

Copying state is a custom requirement and we do not have it off the shelf. So, you will need to use a cookie or something in combination with updating our SDK.

(Priyanshu Shukla) #5

Hi @swagata.sengupta,

I am also getting the same issue of keeping the same state while navigating the pages of that website in which it is integrated with sdk.
So when we are navigating the pages of a website, chatbot state should remain open & the conversation should not closed. This is the general behaviour of any bot with a website.

(Swagat) #6

@meem.khan @priyanshuwwg
Did you try minimizeMode:false (kore-config.js) while opening the chat window on other pages?

(Priyanshu Shukla) #7

Hi @swagata.sengupta,

Currently in kore-config.js minimizeMode= true
I set it as false, we get bot in open state on browser.
Clicked on close button of bot, bot is closed.
Refreshed the same page, you will get bot in open state, because minimize =false is there.
Again click on close button of bot.
This time bot will disappear. Even the chat icon will also be disappeared.

Please check it once form your side. whether you are also getting the same issue or not.

Thanks for your suggestion!

(Swagat) #8

You need to have minimize mode on either in kore-config or change the code to have it in index.html. I would advise against having it in both. It will create issues.
If you see our latest web-sdk, index.html is controlled by kore-config.js. I can open and close bot, refresh page any number of times in latest web-sdk. Bot does not crash/ disappear.