Anyone having problems with intent routing? I'm following this section from the cookbook: https://github.com/alexa/alexa-cookbook/blob/master/ingredients/using-new-session-to-short-circuit-incoming-intent-and-launch-requests.md It says:
// This will short-cut any incoming intent or launch requests and route them to this handler. 'NewSession': function() { if (this.event.request.type === 'IntentRequest') { this.emit(this.event.request.intent.name); } this.emit('LaunchRequest'); }
Seems fair enough. So I tried it, and it's not working. I've console-logged everything, and it definitely is catching the intent.
Here's my code:'NewSession': function () { console.log("In newsession function within menu"); if (this.event.request.type === 'IntentRequest') { console.log("got an intentrequest within newsession in menu of " + this.event.request.intent.name); console.log(this.attributes.STATE); this.emit(this.event.request.intent.name); } this.handler.state = constants.states.MENU_MODE; this.emit('MenuIntent'); },
And here's my log output:
- got an intentrequest within newsession within menu: AMAZON.HelpIntent
- In menuintent function within menu
So it definitely catches it, but doesn't reroute UNLESS I change NewSession to LaunchRequest. Where am I going wrong?!