We saw how slots are sent within the JSON request from Alexa to the Lambda function. Now we need to modify our Lambda function to read the slot values.

Within the Alexa-SDK, the request JSON is available as an object. You can access this object using this.event.request.

In the previous exercise, we saw that the JSON request containing our slot looked like this:

"intent": { "name": "LanguageIntent", "slots": { "language": { "name": "language", "value": "ruby" } } }

You can access the input using the following syntax:


In the JSON example above, we can access our user’s language response value with the following




In the index.js file to the right, define a variable within the LanguageIntent called myLanguage. Assign it the slot value passed in via the JSON object.

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?