Learn
Use Dialog Management in Lambda
Dialog State II

At every turn of the conversation your Lambda function can access the dialog state stored in the JSON request. Using the Alexa Node.js SDK, it can be accessed with this.event.request.dialogState.

In the next few exercises, you’ll see how you can use this property to direct the conversation.

Instructions

1.

We’ve provided you with a JavaScript file and one of the JSON requests from this part of the conversation:

ALEXA Ok, what genre of movie would you like? USER I'd like an action movie.

Using console.log(), print the dialog state in the JSON request.

Because this is a reserved word in JavaScript, we’ve setup main.js so you can omit this, and start with event.

2.

We can use dialogState in conditional statements as well. Write an if statement that checks the value of dialogState. If the state is NOT 'COMPLETED', using console.log(), print 'Conversation not completed yet!'.

Folder Icon

Take this course for free

Already have an account?