Reputation: 739
Messing around with creating an alexa skill and I keep getting a message like I seem to successfully invoke the intent.
When I say "I want accents" alexa responds "You just triggered BuyAccentsIntent" or whatever I name the intent in the interaction model.
my code looks like this. As far as i can tell nothing is ever logged. I'm certain this is some stupid incorrect assumption I have made about how to link intent handlers with intent names, but I'm not sure what it is. I made the same mistake on the previous intent and fixed it but I'm not sure how. They both look like they follow the same pattern to me.
const BuyAccentsIntentDoesThisEvenMatterHandler = {
canHandle(handlerInput) {
console.log('handlerInput:'+handlerInput);
return handlerInput.requestEnvelope.request.type === 'IntentRequest'
&& handlerInput.requestEnvelope.request.intent.name === 'BuyAccentsIntentTwo';
},
handle(handlerInput) {
console.log('BuyAccentsIntentHandler');
return handlerInput.responseBuilder
.speak("buy something then")
//.reprompt('add a reprompt if you want to keep the session open for the user to respond')
.getResponse();
}
};
Upvotes: 4
Views: 3127
Reputation: 739
I hadn't included my handler in the custom request handlers.
Alexa.SkillBuilders.custom().addRequestHandlers()
Upvotes: 5
Reputation: 184
I would suggest you to take a look at your interaction model and check to which intent the sample/training phrase "I want accents" is being used. If you can/want post your IM's JSON here, also. Double check in which intent the phrase "You just triggered..." is being used.
Let's investigate this, it seems that is triggering another intent and not the one your are showing in your question.
Upvotes: 0