Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bot framework V4 Nodejs chat history logging

I have to log the user-bot conversation in CosmosDB for audit/history purpose. In V3 using .Net, I was using table logger module, like the below code.

builder.RegisterModule(new TableLoggerModule(account, chatHistoryTableName));

Now we are upgrading/rewriting the bot to V4 in NodeJS. Please guide if there is a similar approach available for V4 in NodeJS to save the entire conversation?

like image 289
sreeharikm Avatar asked Mar 05 '19 09:03

sreeharikm


2 Answers

This example hasn't been merged yet: https://github.com/Microsoft/BotBuilder-Samples/pull/1266

It uses AzureBlobTranscriptStore and TranscriptLoggerMiddleware

const { AzureBlobTranscriptStore  } = require('botbuilder-azure');
const { TranscriptLoggerMiddleware } = require('botbuilder-core');

// Get blob service configuration as defined in .bot file
const blobStorageConfig = botConfig.findServiceByNameOrId(BLOB_CONFIGURATION);
// The transcript store has methods for saving and retrieving bot conversation transcripts.
let transcriptStore = new AzureBlobTranscriptStore({storageAccountOrConnectionString: blobStorageConfig.connectionString,
                                                    containerName: blobStorageConfig.container
                                                    });
// Create the middleware layer responsible for logging incoming and outgoing activities
// into the transcript store.
var transcriptMiddleware = new TranscriptLoggerMiddleware(transcriptStore);
adapter.use(transcriptMiddleware);
like image 139
Eric Dahlvang Avatar answered Nov 18 '22 09:11

Eric Dahlvang


This should provide a good start.

https://learn.microsoft.com/en-us/azure/bot-service/bot-builder-howto-v4-state?view=azure-bot-service-4.0&tabs=javascript

like image 1
Steve Johnson Avatar answered Nov 18 '22 09:11

Steve Johnson