Created
April 10, 2019 09:50
-
-
Save dhAlcojor/12934b308388369580430e48de11a3b2 to your computer and use it in GitHub Desktop.
Alexa lambda simple template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Alexa = require('ask-sdk'); | |
const HelloHandler = { | |
canHandle(handlerInput) { | |
}, | |
handle(handlerInput) { | |
} | |
}; | |
const ErrorHandler = { | |
canHandle(handlerInput, error) { | |
return true; // Handle all errors | |
}, | |
handle(handlerInput, error) { | |
console.log(`Error handled: ${error.message}`); | |
console.log(error.trace); | |
return handlerInput.responseBuilder | |
.speak('Sorry, I can\'t understand the command. Please say again.') | |
.getResponse(); | |
}, | |
} | |
}; | |
const skillBuilder = Alexa.SkillBuilders.custom(); | |
exports.handler = skillBuilder | |
.addRequestHandlers( | |
HelloHandler | |
) | |
.addErrorHandlers(ErrorHandler) | |
.lambda(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment