Last active
September 27, 2018 10:09
-
-
Save jonchurch/f83fdf8a942dd53a58179aa489396976 to your computer and use it in GitHub Desktop.
Valid ElicitSlot AWS Lex Lambda response
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
'use strict'; | |
exports.handler = (event, context, callback) => { | |
// Currently all possible fields | |
// { | |
// "sessionAttributes": { | |
// "key1": "value1", | |
// "key2": "value2" | |
// ... | |
// }, | |
// "dialogAction": { | |
// "type": "ElicitIntent, ElicitSlot, ConfirmIntent, Delegate, or Close", | |
// "fulfillmentState": "Fulfilled or Failed", | |
// "message": { | |
// "contentType": "PlainText or SSML", | |
// "content": "message to convey to the user" | |
// }, | |
// "intentName": "intent-name", | |
// "slots": { | |
// "slot-name": "value", | |
// "slot-name": "value", | |
// "slot-name": "value" | |
// }, | |
// "slotToElicit" : "slot-name", | |
// "responseCard": { | |
// "version": integer-value, | |
// "contentType": "application/vnd.amazonaws.card.generic", | |
// "genericAttachments": [ | |
// { | |
// "title":"card-title", | |
// "subTitle":"card-sub-title", | |
// "imageUrl":"URL of the image to be shown", | |
// "attachmentLinkUrl":"URL of the attachment to be associated with the card", | |
// "buttons":[ | |
// { | |
// "text":"button-text", | |
// "value":"value sent to server on button click" | |
// } | |
// ] | |
// } | |
// ] | |
// } | |
// } | |
// } | |
// This is all that is required for a valid ElicitSlot response | |
var dummy = { | |
"sessionAttributes": {}, | |
"dialogAction": { | |
"type": "ElicitSlot", | |
"intentName": "ScheduleRequest", | |
"slots": { | |
"MusicGroup": "null" | |
}, | |
"slotToElicit": "MusicGroup" | |
} | |
} | |
// Respond to Lex by passing a proper JSON response to callback | |
callback(null, dummy) | |
}; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here
ScheduleRequest
is the intent this function is being called in, andMusicGroup
is a slot of the type AMAZON.MusicalGroup