Learn
Speak, Listen & Reprompt
Review

You have learned a number of methods in this lesson to control how Alexa interacts with a user.

  • this.response.speak() sets up a response to the user and ends the session.
  • Chaining .listen() to the .speak() response keeps the session open and opens the michrophone to listen for a user’s response.
  • You can provide an optional string as an argument to the .listen() method, which will be used by Alexa to reprompt the user if no response was detected.
  • You use this.emit(':responseReady') to send your response to a user’s Alexa device.

The work that you have done in this lesson lays the foundation for a more complete skill that you can build in Codecademy's slots lesson.

Instructions

Copy the code from index.js on the right into your own Lambda function (start from the alexa-skill-kit-sdk-factskill blueprint) and associate it with your Alexa skill using the ARN.

Once the configuration of the Alexa skill is complete, you can test the skill.

In the next lesson, you will learn how to ingest the user’s response and act on it accordingly.

Folder Icon

Take this course for free

Already have an account?