Created
April 23, 2020 17:20
-
-
Save apoorvlathey/0243d23afc7c0f0ec3b387c85789fadd to your computer and use it in GitHub Desktop.
This file contains hidden or 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 FactsIntentHandler = { | |
canHandle(handlerInput) { | |
return Alexa.getRequestType(handlerInput.requestEnvelope) === 'IntentRequest' | |
&& Alexa.getIntentName(handlerInput.requestEnvelope) === 'FactsIntent'; | |
}, | |
handle(handlerInput) { | |
var random = factsList.facts[Math.floor(Math.random() * factsList.facts.length)]; //select a random fact from json file | |
var factText = random.text; | |
var speakOutput = "Did you know that " + factText; | |
return handlerInput.responseBuilder | |
.speak(speakOutput) | |
//.reprompt('add a reprompt if you want to keep the session open for the user to respond') | |
.getResponse(); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment