Skip to content

Instantly share code, notes, and snippets.

@dhAlcojor
Created April 10, 2019 09:50
Show Gist options
  • Save dhAlcojor/12934b308388369580430e48de11a3b2 to your computer and use it in GitHub Desktop.
Save dhAlcojor/12934b308388369580430e48de11a3b2 to your computer and use it in GitHub Desktop.
Alexa lambda simple template
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