[Question] How can I plug in my storage to store history messages?
With DirectLineJS we can get history messages using watermark. But Bot Connector does not keep the history messages of a conversation for very long time. To make sure all history messages can be fetched in webchat using watermark, is there a way to plug in my storage which stores messages (same way we can plug in storage for bot sessions)?
@bhushanvadgave Are you using .NET or Node SDK?
From the documentation article Manage state data:
By default, the Bot Framework SDK for .NET stores state data using the Bot Framework State service, which is intended for prototyping only and is not designed for use by bots in a production environment. For performance and security reasons in the production environment, you should either use the Bot Builder SDK Azure Extensions to store state data in your own Azure Table storage or Azure DocumentDB store or create a custom implementation of
IBotDataStoreto store state data in the destination that you specify.
To create your own Bot State Service, use the BotBuilder-Azure extensions library provided on GitHub.
The repository also contains sample implementations for both Azure Table Storage and DocumentDB integrations. (Note: DocumentDB implementation also supports CosmosDB, Microsoft's next generation version of DocumentDB)
@nwhitmont I am using NodeJS SDK.
@nwhitmont Documentation which you referred above only explains about storing sessions into persistent storage which I am able to do successfully. But how can I store history messages to enable my webchat get all history messages when it resumes the conversation using watermark.
@bhushanvadgave Thanks for the update. What you are asking about is specific to WebChat. Please post your question on Microsoft/BotFramework-WebChat repository.
Sorry, I know this issue has been closed, yet I have the same question as @bhushanvadgave. Did you find a solution to this? Thank you very much
@zubcomandante No, I didn't find any solution for this.
@zubcomandante @bhushanvadgave This project does exactly this https://github.com/JasonSowers/ChatHistoryBot-Public. I also suggest reading through this pull request on the WebChat repo https://github.com/Microsoft/BotFramework-WebChat/pull/615
@JasonSowers thank you very much, I'm giving a look at it. Our bot is implemented in Node.js with MongoDB persistency for state data, and we are connecting from custom directline-based clients (web and mobile): so I can't use your code directly, I rather have to understand the main facts and reproduce the whole thing in our scenario.
@zubcomandante While your implementation will be different the core functionality will be the same.
- Save
Activityto your persistent data store - Serve the activities up to the webchat control as it is rendering/before it renders.
Keep in mind the example I showed you is not a fully complete production level example. It does not, for example, have a way to handle a very high number of messages gracefully. The more messages it has to load into history the more time it will take. There are definitely ways to make it better. Good luck!