Skip to content

Instantly share code, notes, and snippets.

@standemchuk
Last active June 19, 2018 07:44
Show Gist options
  • Save standemchuk/7f472760532c3d12fd6a4f9a81d879ac to your computer and use it in GitHub Desktop.
Save standemchuk/7f472760532c3d12fd6a4f9a81d879ac to your computer and use it in GitHub Desktop.
Example intent handler of Amazon Alexa request
async handle(handlerInput) {
const slotValue = handlerInput.requestEnvelope.request.intent.slots['requestReason'].value;
const response = await axios.post('https://google.com', {
"Param1": slotValue
});
if (response && response.status === 200) {
return handlerInput.responseBuilder
.speak('Ok, I\'ve notified the staff about your request')
.getResponse();
} else {
return handlerInput.responseBuilder
.speak('There was a problem with notifying the staff')
.getResponse();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment