Howard
Howard

Reputation: 189

How to add additional dialog in bot framework

How can I have 2 conversations going concurrently? I'm currently using TextBot and LuisDialog to build a bot. I start off by having a conversation with the user to obtain data. Then while doing some processing in a different method, I discover that I need additional information from the user. How can I create a new conversation with the user just to get that additional information? I have some code below that attempts to show what I want to do. Thanks for your suggestions.

File 1: foo.js

var dialog = new builder.LuisDialog(model);
var sonnyBot = new builder.TextBot();
sonnyBot.add('/', dialog);
dialog.on('intent_1', [
    function(session, args, next) {
        name = builder.Prompts.text(session,"What is your name?");
    },
    function(session, result) {
        session.dialogData.name= results.response;
        getFamilyTree(session.dialogData.name);
    }
]); 

File 2: getFamilyTree.js

function getFamilyTree(name) {    
    find family tree for name
    if (need place of birth) {
        begin new dialog
        prompt user place of birth
        get place of birth from user
        end dialog
    }
    finish getting the family tree
}

Upvotes: 0

Views: 1130

Answers (2)

Howard
Howard

Reputation: 189

I posted the same question on GitHub and received the answer from Steven Ickman, who is involved in the development of the node.js SDK. The link to the answer is https://github.com/Microsoft/BotBuilder/issues/394#issuecomment-223127365

Upvotes: 0

krazy
krazy

Reputation: 11

i guess you could pass session object and then use that object to start a new dialog .

Edit 1

can't you use some thing like

session.beginDialog('/getFamilyTree',{name:result.response});

and then you can access name like

args.name 

inside 'getFamilyTree' dialog

Upvotes: 1

Related Questions