Search code examples
c#botframeworkbots

Great sample Bot Timeout, but where to put it?


I am using BotFramework 4.x with NetCore.App 3.1 and have successfully plugged in our NLU engine to accept and respond to the text input from the bot framework. I want to add a timeout function so that I can reset the session after 5 minutes. There is some great code at https://learn.microsoft.com/en-us/azure/bot-service/bot-builder-howto-expire-conversation?view=azure-bot-service-4.0&tabs=csharp. I am using the EchoBot sample as my basis, and so I don't align with the cs naming in the sample and I am not sure where to put this code in my bot.


Solution

  • The EchoBot is a basic bot sample. You will need to add more code while following the article for restarting conversations.

    The sample code in this article begins with the structure of a multi-turn bot.

    If you want to follow along this article, I suggest using this sample.

    https://github.com/microsoft/BotBuilder-Samples/blob/main/samples/csharp_dotnetcore/05.multi-turn-prompt/Bots/DialogBot.cs