Search code examples
botframeworkchatbotazure-application-insights

How to store user conversation of Root bot and skill bot on Bot framework SDK V4 built in Visual Studio?


I have build a Handoff bot using Tompanna Sample intermediator bot sample https://github.com/tompaana/intermediator-bot-sample as a root bot and connected it to a dailog Skill, We followed https://github.com/microsoft/BotBuilder-Samples/tree/main/samples/csharp_dotnetcore/81.skills-skilldialog this sample.

Now I am trying to store user conversation, to do that I followed this https://learn.microsoft.com/en-us/azure/bot-service/bot-builder-howto-v4-storage?view=azure-bot-service-4.0&tabs=csharp article however it only stores the conversation of the root bot. I want to store the conversation of both the bot root and skill.

Can anyone guide me to store the conversation? Could Application insight also be used to store the log conversations? Thanks in Advance!!


Solution

  • In your question it contain only for bot storage document but you need to maintain bot state for each conversation. So if you want to store the bot conversation then you need to implement state management in bot flow.

    The state and storage features of the Bot Framework SDK allow you to add state to your bot. Bots use state management and storage objects to manage and persist state. The state manager provides an abstraction layer that lets you access state properties using property accessors, independent of the type of underlying storage.

    User state is available in any turn that the bot is conversing with that user on that channel, regardless of the conversation.

    Conversation state is available in any turn in a specific conversation, regardless of user (i.e. group conversations)

    If you want, you can additionally store conversation flow in Application insight as a custom event using TelemetryClient like trace,metrics,etc.

    Reference :

    1. Save user and conversation data
    2. Managing state
    3. Application Insights API for custom events and metrics