How do I end the conversation?

I have created a bot using Bot Framework and I am using conversationID

to maintain state using my feedback mechanism. I cannot find in the documentation to end the conversation. It is necessary that at some point the user can signal "end or exit" for a conversation so that the next time they start a conversation he gets a new one conversationID

. I think it should be a simple task. I'm using the default echo pattern and just replaced the number of lines of letters with a method with my class that returns the text to send back to the user.

+3


source to share


3 answers


Now there is ActivityTypes.EndOfConversation (this is already in the sdk).

Here's one way to use it:



public static async Task EndConversation(this IBotToUser botToUser, string code = EndOfConversationCodes.CompletedSuccessfully, CancellationToken cancellationToken = default(CancellationToken))
{
    var message = botToUser.MakeMessage();
    message.Type = ActivityTypes.EndOfConversation;
    message.AsEndOfConversationActivity().Code = code;

    await botToUser.PostAsync(message, cancellationToken);
}

      

This should also be in the next release: GitHub Pull Request

+1


source


Json web (jwt) icons are only available in one chat. so it gets the conversion again. The session.endConversation () method provides a convenient way to quickly end a conversation with a user. used to end a conversation.



0


source


There is a newer, shorter path 1 :

context.EndConversation(EndOfConversationCodes.CompletedSuccessfully);

      

0


source







All Articles