TransWikia.com

What is the purpose of session.endConversation()

Stack Overflow Asked by Flea on January 23, 2021

I am developing a bot in node.js using the Microsoft Bot Framework. Once my user has completed their action with my bot; I am calling session.endConversation(). However, I am not sure really what this is doing. My assumption when calling this code would be that it would clear out session data; so if the user interacts with the bot again; they will essentially be starting over.

However, when I call endConversation(), the user data is still there:

    session.endConversation("Thank you for your business!");
    console.log("User Data:");
    console.log(session.userData);

enter image description here

The documentation just says, “ends the conversation” but doesn’t describe what in fact that means.

I guess my question is; what is this function doing and when you are finished with a conversation, what should the approach be to handle the users conversation data?

One Answer

According to this post:

As a result, when a conversation or dialog has come to an end, it’s a best practice to explicitly call endConversation, endDialog, or endDialogWithResult. endConversation both clears the current dialog stack and resets all data stored in the session, except userData. Both endDialog and endDialogWithResult end the dialog, clear out dialogData, and control to previous dialog in the stack. Unlike endDialog, endDialogWithResult allows you to pass arguments into the previous dialog, which will be available in the second parameter of the first method in the waterfall (typically named results).

Answered by Flea on January 23, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP