Is it possible to insert/inject user's past conversation history into chat window dialog?

Viewed 89

I'm trying to insert/inject a user's past conversation into the bot framework chat window. We are currently using bot v3 and v4 frameworks and in the LuisDialog, IDialogContext type context.ConversationData is where the conversation data is stored, we capture it from there and save it to storage. Then we are able to retrieve it back but the context.ConversationData property is read-only. So is there any way to accomplish inserting the user's past conversation history into Microsoft Bot Framework Dialogs or is it prohibited by design? If it can be accomplished in either Microsoft Bot Framework v3 or v4, please let me know. Thank you!

I have tried to replace context.conversationData object but since it is read-only, it did not worked. I also see that there is a method in ConversationData which is: context.ConversationData.SetValue(string key,T value) but not sure if it is intended to be used to accomplish what I'm trying.

1 Answers

It is important to note that Conversation History is different from context.ConversationData. ConversatonData is a pointer to data scoped by conversation.id, and by default contains the dialog stack (in Bot Builder dotnet v3, each entire dialog is binarily serialized/deserialized to and from ConversationData). You can also use this property to store/retrieve custom data pertinent to the conversation. In Bot Builder V3, the interface for storing conversation history is actually IActivityLogger while in Bot Builder V4 the interface is ITranscriptLogger. More information can be found here

Once conversation history is properly stored, the next step is to send that history to the conversation. The V3 and V4 sdks both implement the SendConversationHistoryAsync endpoint: V3, V4 We do not currently have a sample demonstrating how to do this: but we are working on it.

Related