Like we said in the last exercise, .speak() generates a response and then ends the session, so we’re never capturing the response from the user.

Currently, our skill is set up so that Alexa asks the user a question and the user may try to respond, but Alexa isn’t listening because the session has closed. To keep the session open and get the user response we use the .listen() method.

However, we want to continue the conversation and use .listen to make the skill wait for the user to trigger the LanguageIntent.

We use .listen() by chaining it to the end of the .speak response definition.

As an example, if the handler for SampleIntent responded What is your name?, and waited for a response, the code would look like:

'SampleIntent': function () { this.response.speak("What is your name?").listen(); this.emit(':responseReady'); },



In the index.js file to the right, add a .listen() method to the LaunchRequest response. This ensures Alexa waits for a response from the user and doesn’t terminate the session.

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?