Sagar Patil
Sagar Patil

Reputation: 469

How to get chatbot conversation

I am working on azure bot service,Bot is working properly. Once the chat is completed i need to send entire chat conversation to email as a transcript-or. How to achieve this?

Upvotes: 2

Views: 1291

Answers (1)

Drew Marsh
Drew Marsh

Reputation: 33379

The Bot Framework Service does not maintain any transcripts, this is something you'd have to implement yourself in your bot. You're in luck though because the Bot Builder SDK ships a piece of middleware, appropriately named TranscriptLoggerMiddleware, that will do this for you and can be configured with a backing store of your choosing.

A storage implementation that ships in the box is the AzureBlobTranscriptStore which will just append to a blob throughout the life of the conversation. However, if you want to store the transcripts using another storage mechanism then you can just implement ITranscriptLogger (just one method) yourself and pass that to the middleware instead.

To set up the middleware you would do the following in your startup logic:

public void ConfigureServices(IServiceCollection services)
{
    // Load the settings from config however you like
    var myAzureBlobTranscriptSettings = LoadMySettingsFromConfig();

    services.AddBot<MyBot>(options =>
    {
        // Register the middleware
        options.Middleware.Add(
           new TranscriptLogger(
               new AzureBlobTranscriptStore(
                 myAzureBlobTranscriptSettings.ConnectionString,
                 myAzureBlobTranscriptSettings.ContainerName)));
    });
}

Upvotes: 2

Related Questions