FredrikOseberg / react-chatbot-kit

MIT License
301 stars 141 forks source link

Keeping messagens even by changing context #10

Closed sinetoami closed 3 years ago

sinetoami commented 3 years ago

Hi, Fredrik. So I will give a little explanation about what I want to do.

Let's think that an user start a conversation with the chatbot inside the "Home" with my website, and they exchange some messages (the user and the chatbot). Now, this fake user wants to switch to the "About" page of my website. In the "About" page the chatbot keeps maintain the previous messages that they was sent to each other.

So, how can I implement this behavior using this library? I'm trying to do something with localStorage, but I don't know if it have a better way to do. Can you help?

Thanks a lot.

FredrikOseberg commented 3 years ago

Hi. I'm working on making this available in the next update.

FredrikOseberg commented 3 years ago

@sinetoami #11 takes care of this.

Here's a link to a working implementation with local storage:

https://gist.github.com/FredrikOseberg/8b3cfadeb1980bdb7b52cd4138d64542#file-app-js