botframework-sdk icon indicating copy to clipboard operation
botframework-sdk copied to clipboard

[Question] Saving Chat History in Microsoft Bot Framework

Open RaoVenka opened this issue 9 years ago • 2 comments

How can i save the chat history in microsoft bot framework using c# ?Could you provide some samples too.

RaoVenka avatar Jun 17 '17 10:06 RaoVenka

You can implement this yourself. When the Post method is called (everytime a user sends something to your bot) you can take the text that the user typed and store it:

if (activity.Type == ActivityTypes.Message) { var messageFromUser = activity.Text; }

You can do this any number of ways in C#, like writing that message to a database or other store. You might also capture information about the decisions that the bot took and the reply given. None of this is provided for you, but it should be fairly easy to add into any sort of solution using normal C# stuff, you don't need anything specific to the Bot Framework.

tomorgan avatar Jun 19 '17 11:06 tomorgan

@RaoVenka In c# you can implement the IActivityLogger interface. There are some examples here: https://github.com/Microsoft/BotBuilder-Azure/tree/master/CSharp/Library/Microsoft.Bot.Builder.Azure.Logging Here is a blog post on implementing IActivityLogger and storing activities in Azure Sql: https://blog.botframework.com/2017/05/05/Saving-Bot-Actions-On-Azure-Sql-Server/


The Microsoft Bot Framework team prefers that how to questions be submitted on Stack Overflow. The official Bot Framework Github repo  is the preferred platform for submitting bug fixes and feature requests.     I have closed this issue. Please feel free to resubmit your question over on Stack Overflow and one of our support engineers will help you out as soon as possible.

EricDahlvang avatar Jun 19 '17 16:06 EricDahlvang