September 2018
Intermediate to advanced
266 pages
7h 26m
English
The way that you create a response in Lex is very different from how it's done in Alexa. In Lex, there is an object structure that needs to be followed:
sessionAttributes: {},dialogAction: { type: '', fulfillmentState: '', slots: {}, slotToElicit: '', message: { contentType: 'PlainText', content: ''};}
Because this is a bit of code that we may use multiple times, we can create functions for each of the types. Here is a function for finishing the last stage of a conversation flow. This can be added to the bottom of the index.js file:
const lexClose = ({ message, sessionAttributes = {}, fulfillmentState = "Fulfilled"}) => { return { sessionAttributes, dialogAction: { type: 'Close', fulfillmentState, message: { contentType: ...Read now
Unlock full access