Skip to content

Instantly share code, notes, and snippets.

@memodoring
Created May 9, 2018 16:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save memodoring/fef7f07e7e5681d3ed692187399e2115 to your computer and use it in GitHub Desktop.
Save memodoring/fef7f07e7e5681d3ed692187399e2115 to your computer and use it in GitHub Desktop.
A sample handle for the Alexa SDK V2 for Node.js
handle(handlerInput) {
const factArr = data;
const factIndex = Math.floor(Math.random() * factArr.length);
const randomFact = factArr[factIndex];
const speechOutput = GET_FACT_MESSAGE + randomFact;
return handlerInput.responseBuilder
.speak(speechOutput)
.withSimpleCard(SKILL_NAME, randomFact)
.getResponse();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment