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.



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.


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!'.

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?