Hello,
I've got an Error, explained under the Code:
Here's my VUI:
{ "interactionModel": { "languageModel": { "invocationName": "test skill", "intents": [ { "name": "AMAZON.FallbackIntent", "samples": [] }, ... { "name": "GetInformation", "slots": [ { "name": "SlotOne", "type": "SlotOne", "samples": [ "{SlotOne}" ] }, { "name": "SlotTwo", "type": "SlotTwo", "samples": [ "{SlotTwo}" ] } ], "samples": [ "what is {SlotOne} from {SlotTwo}" ] } ], "types": [ { "name": "SlotOne", "values": [ { "name": { "value": "caseOne" } }, { "name": { "value": "caseTwo" } } ] }, { "name": "SlotTwo", "values": [ { "name": { "value": "caseThree" } } ] } ] }, "dialog": { "intents": [ { "name": "GetInformation", "delegationStrategy": "ALWAYS", "confirmationRequired": false, "prompts": {}, "slots": [ { "name": "SlotOne", "type": "SlotOne", "confirmationRequired": false, "elicitationRequired": true, "prompts": { "elicitation": "Elicit.Slot.443115196312.819908401230" } }, { "name": "SlotTwo", "type": "SlotTwo", "confirmationRequired": false, "elicitationRequired": true, "prompts": { "elicitation": "Elicit.Slot.443115196312.1247203287542" } } ] } ], "delegationStrategy": "ALWAYS" }, "prompts": [ { "id": "Elicit.Slot.443115196312.819908401230", "variations": [ { "type": "PlainText", "value": "What is case one?" } ] }, { "id": "Elicit.Slot.443115196312.1247203287542", "variations": [ { "type": "PlainText", "value": "What is case two?" } ] } ] } }
Here's my Lambda-Code:
const Alexa = require('ask-sdk'); const LaunchRequestHandler = { canHandle(handlerInput) { return handlerInput.requestEnvelope.request.type === 'LaunchRequest'; }, handle(handlerInput) { const speakOutput = WELCOME_MSG; return handlerInput.responseBuilder .speak(speakOutput) .reprompt(speakOutput) .getResponse(); } } const GetInformationIntentHandler = { canHandle(handlerInput) { return handlerInput.requestEnvelope.request.type === 'IntentRequest' && handlerInput.requestEnvelope.request.intent.name === 'GetInformation'; }, handle(handlerInput) { console.log('GetInformation - handle'); const responseBuilder = handlerInput.responseBuilder; const SlotOne = handlerInput.requestEnvelope.request.intent.slots.SlotOne.resolutions.resolutionsPerAuthority[0].values[0].value.name; const SlotTwo = handlerInput.requestEnvelope.request.intent.slots.SlotTwo.resolutions.resolutionsPerAuthority[0].values[0].value.name; let speechOutput = ""; switch (SlotOne) { case "caseOne": switch (SlotTwo) { case "caseThree": speechOutput += "1,3"; break; case "caseFour": speechOutput += "1,4"; break; default: speechOutput += "1.d"; } break; case "caseTwo": switch (SlotTwo) { case "caseFive": speechOutput += "2.5"; break; case "caseSix": speechOutput += "2.6"; break; default: speechOutput += "2.d"; } break; default: speechOutput += "Bei diesem Fall kann ich ihnen leider nicht helfen."; } speechOutput += ' Kann ich noch etwas für sie tun?'; return responseBuilder .speak(speechOutput) .getResponse(); }, }; //insert here the other biuld-in intent handlers const FallbackIntentHandler = { canHandle(handlerInput) { return handlerInput.requestEnvelope.request.type === 'IntentRequest' && handlerInput.requestEnvelope.request.name === 'AMAZON.FallbackIntent'; }, handle(handlerInput) { const speakOutput = handlerInput.t('FALLBACK_MSG'); return handlerInput.responseBuilder .speak(speakOutput) .reprompt(speakOutput) .getResponse(); } }; const SessionEndedRequestHandler = { canHandle(handlerInput) { const request = handlerInput.requestEnvelope.request; return request.type === 'SessionEndedRequest'; }, handle(handlerInput) { console.log(`Session ended with reason: ${handlerInput.requestEnvelope.request.reason}`); return handlerInput.responseBuilder.getResponse(); }, }; const ErrorHandler = { canHandle() { return true; }, handle(handlerInput, error) { console.log(`Error handled: ${error.message}`); console.log(`Error handled: ` + handlerInput.requestEnvelope.request.type); console.log(`Error handled: ` + handlerInput.requestEnvelope.request.intent.name); return handlerInput.responseBuilder .speak('Sorry, an error occurred.') .reprompt('Sorry, an error occurred.') .getResponse(); }, }; const SKILL_NAME = 'My own Skill'; const WELCOME_MSG = 'Was gibt`s?'; const FALLBACK_MSG = 'Hierbei kann ich ihnen leider nicht helfen.'; const HELP_MESSAGE = 'Wie kann ich ihnen helfen?'; const HELP_REPROMPT = 'Was kann ich für sie tun?'; const STOP_MESSAGE = "Vielen Dank!"; const skillBuilder = Alexa.SkillBuilders.standard(); exports.handler = skillBuilder .addRequestHandlers( LaunchRequestHandler, GetInformationIntentHandler, HelpHandler, ExitHandler, FallbackIntentHandler, SessionEndedRequestHandler ) .addErrorHandlers(ErrorHandler) .lambda();
My Problem is, that I become an Error "RequestHandlerChain not found!" when I say "what is caseOne from caseThree?". The request-type is an intent request and the intent-name ist the AMAZON.FallbackIntent. But it should be the "GetInformation"-Intent?!?
Thank you for your help!