{"action":"closed","issue":{"url":"https://api.github.com/repos/Microsoft/BotBuilder/issues/277","repository_url":"https://api.github.com/repos/Microsoft/BotBuilder","labels_url":"https://api.github.com/repos/Microsoft/BotBuilder/issues/277/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/BotBuilder/issues/277/comments","events_url":"https://api.github.com/repos/Microsoft/BotBuilder/issues/277/events","html_url":"https://github.com/Microsoft/BotBuilder/issues/277","id":154680407,"number":277,"title":"Session.replaceDialog to an existing Intent","user":{"login":"loretoparisi","id":163333,"avatar_url":"https://avatars.githubusercontent.com/u/163333?v=3","gravatar_id":"","url":"https://api.github.com/users/loretoparisi","html_url":"https://github.com/loretoparisi","followers_url":"https://api.github.com/users/loretoparisi/followers","following_url":"https://api.github.com/users/loretoparisi/following{/other_user}","gists_url":"https://api.github.com/users/loretoparisi/gists{/gist_id}","starred_url":"https://api.github.com/users/loretoparisi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/loretoparisi/subscriptions","organizations_url":"https://api.github.com/users/loretoparisi/orgs","repos_url":"https://api.github.com/users/loretoparisi/repos","events_url":"https://api.github.com/users/loretoparisi/events{/privacy}","received_events_url":"https://api.github.com/users/loretoparisi/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Microsoft/BotBuilder/labels/question","name":"question","color":"cc317c"}],"state":"closed","locked":false,"assignee":{"login":"Stevenic","id":698939,"avatar_url":"https://avatars.githubusercontent.com/u/698939?v=3","gravatar_id":"","url":"https://api.github.com/users/Stevenic","html_url":"https://github.com/Stevenic","followers_url":"https://api.github.com/users/Stevenic/followers","following_url":"https://api.github.com/users/Stevenic/following{/other_user}","gists_url":"https://api.github.com/users/Stevenic/gists{/gist_id}","starred_url":"https://api.github.com/users/Stevenic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Stevenic/subscriptions","organizations_url":"https://api.github.com/users/Stevenic/orgs","repos_url":"https://api.github.com/users/Stevenic/repos","events_url":"https://api.github.com/users/Stevenic/events{/privacy}","received_events_url":"https://api.github.com/users/Stevenic/received_events","type":"User","site_admin":false},"milestone":null,"comments":2,"created_at":"2016-05-13T10:22:03Z","updated_at":"2016-06-01T08:07:08Z","closed_at":"2016-06-01T08:07:08Z","body":"Not sure if this is a duplicate issue (didn't find one), I have this issue.\r\nI'm using the good api `session.replaceDialog` to override session info ( like `session.message` ) and replace the current session with this data like:\r\n\r\n```javascript\r\nsession.replaceDialog('/');\r\n```\r\n\r\nThis works perfectly, when I'm putting in  `session.message` the new utterance that will be then matched to an existing Intent, and the dialog `on` callback will be then fired for this intent.\r\nIn some circumstances, I need to replace a session to a specific intent, supposed to have a Intent with a four steps waterfall model like this (Simplified version of my code)\r\n\r\n```javascript\r\n/**\r\n       * Help Intent\r\n       * two-turn intent dialog / two steps waterfall\r\n       * @example help me\r\n      */\r\n      self.dialog.on(Intent.Type.HelpIntent,\r\n      [\r\n          function (session, args, next)\r\n          {\r\n           //WF1: here we show help and ask if user wants more\r\n           session.send( self.getLocalizedString('HELP_HINT1','HELP_HINT1') );\r\n            BotBuilder.Prompts.confirm(session, self.getLocalizedString('HELP_MORE','HELP_MORE') );\r\n         },\r\n         function (session, args, next)\r\n          {\r\n           // WF2: if user is fine, present some KB options\r\n          var response=results.response;\r\n            if ( response ) {\r\n              BotBuilder.Prompts.choice(session,\r\n                self.getLocalizedString('HELP_CHOOSER','HELP_CHOOSER'),\r\n                self.getLocalizedString('HELP_KB_OPTIONS','HELP_KB_OPTIONS') );\r\n            }\r\n          },\r\n          function (session, args, next)\r\n          {\r\n              //WF3: the user choose some option (good or bad)\r\n              // Botframework will forward here multiple times with \"I didn't understand. How can I help you?\"\r\n              var response=results.response;\r\n            if (response) {\r\n               // this is a good option, we send KB entry and end it up.\r\n              var kbEntry = response.entity;\r\n              var kbIndex = response.index; // this index starts from 1!\r\n              var kbMatchingRatio = response.score;\r\n              var kbValues = self.getLocalizedString('HELP_KB_VALUES',[]);\r\n               //...some code\r\n              session.send( msg );  \r\n          }\r\n          else { // not found\r\n               // if user type something the BotFramework will discard definitively\r\n              // now I want to go back to WF3 and ask again help\r\n              // so I prompt a confirm for more help:\r\n              session.send( self.getLocalizedString('HELP_UNKNOWN','HELP_UNKNOWN') )\r\n              BotBuilder.Prompts.confirm(session, self.getLocalizedString('HELP_MORE','HELP_MORE') );\r\n          }\r\n          },\r\n          function (session, args, next)\r\n          {\r\n             //WF4: at confirm I would forward to KB options\r\n            // in order to loop until user choose not help any more\r\n             var response=results.response;\r\n            if ( response ) {\r\n              session.replaceDialog('/'+Intent.Type.HelpIntent);\r\n            }\r\n           }]\r\n```\r\n\r\nThis code will ends up with a \r\n\r\n```shell\r\nSession Error: Dialog[/HelpIntent] not found.\r\nSession Error: Dialog[/HelpIntent] not found.\r\nevents.js:141\r\n      throw er; // Unhandled 'error' event\r\n      ^\r\n\r\nError: Dialog[/HelpIntent] not found.\r\n```\r\n\r\nMy intent is `HelpIntent`, and I have tried to replace the dialog with \r\n\r\n```javascript\r\nsession.replaceDialog('/'+Intent.Type.HelpIntent);\r\n```\r\n\r\nHere is a snippet of this conversation:\r\n\r\n```shell\r\nhelp me\r\nYou can ask me any lyrics to any song. <--this is WF1\r\nDo you need more help?\r\nyes\r\nHow can I help you? <--this is WF2\r\n   1. Get a song by lyrics words\r\n   2. Get a song by name and artist\r\n   3. Get a quote by an artist\r\ngote a quote\r\nI didn't understand. How can I help you? <--this is botframework answering\r\n   1. Get a song by lyrics words\r\n   2. Get a song by name and artist\r\n   3. Get a quote by an artist\r\nquote \r\nI'm sorry, I'm afraid there is help available for this. <--this is WF3\r\nDo you need more help?\r\nyes\r\nSession Error: Dialog[HelpIntent] not found. <--this is WF4\r\nSession Error: Dialog[HelpIntent] not found.\r\nevents.js:141\r\n      throw er; // Unhandled 'error' event\r\n      ^\r\n\r\nError: Dialog[HelpIntent] not found.\r\n```\r\n\r\nSame error if using `session.replaceDialog('HelpIntent')`"}}
{"actor":{"display_login":"Stevenic"}}