react-chat-widget
react-chat-widget copied to clipboard
Seed chat history
Is there a way to Seed/save/rehydrate/keep/preserve the chat history from local storage or a cookie or something?
I'm thinking of a use case where the user is browsing from page to page and the chat history has to be preserved across page reloads so the user isn't presented with a clear chat every time.
use google firebase
@Dobby89 - I'm currently trying to do the same with Amazon Lex. Did you manage to figure this out?
@tabrza I ended up making my own chat bot because it had too many custom requirements, so not exactly.
But I did use localstorage to persist certain state properties between page refreshes. For the conversation history I'm using a dynamo DB, but obviously any DB would suffice.
Got it! Would you feel comfortable sharing the code/repo? As you probably saw, I'm trying to get this working with Amazon Lex - just trying to finish the final step of front-end interaction..
we can assume that we already have his backend / database part, so we just need to know how we can fill the chat with previous messages with things (like timestamp).
we can assume that we already have his backend / database part, so we just need to know how we can fill the chat with previous messages with things (like timestamp).
From this PR #275 we can active a history by
messages.forEach(({ who, message, messageId, date }) => {
if(who == 'client')
addUserMessage(message, messageId, date);
else
addResponseMessage(message, messageId, date);
});