简体   繁体   中英

How to capture all the conversation happend in the Chat - using Bot framework

I am trying out the Bot framework examples (Sandwich sample) and I want to check is there a way we can capture the complete conversation on the completion of chat.

Example:

I am trying to capture the complete conversation between both parties on the " OnCompletionAsyncDelegate " event. Is there any alternative to capture all the conversation?

Thank You.

If you're using LUIS, one solution is to create your own Dialog class that extends LuisDialog, override MessageReceived to transcribe the incoming message's Text, and have your other Dialogs extend this new class instead of LuisDialog.

If you're not using LUIS then your new class can just implement this logic in your own implementation of IDialog's MessageReceived.

The transcribing logic would need to log this text somewhere, perhaps table storage or dynamo db.

Does that help?

I have a tutorial that shows how to capture the conversation to a database: Implementing A SQL Server Database With The Microsoft Bot Framework

The key piece of code that captures the conversation is:

// *************************
// Log to Database
// *************************
// Instantiate the BotData dbContext
Models.BotDataEntities DB = new Models.BotDataEntities();
// Create a new UserLog object
Models.UserLog NewUserLog = new Models.UserLog();
// Set the properties on the UserLog object
NewUserLog.Channel = activity.ChannelId;
NewUserLog.UserID = activity.From.Id;
NewUserLog.UserName = activity.From.Name;
NewUserLog.created = DateTime.UtcNow;
NewUserLog.Message = activity.Text.Truncate(500);
// Add the UserLog object to UserLogs
DB.UserLogs.Add(NewUserLog);
// Save the changes to the database
DB.SaveChanges();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM