Scenario 1: Create a custom prompt to elicit the arrivalCity slot value.

In the Flight Booker skill, the available flight destinations may change over time. Those available offerings, or options, should be clear to users, and the skill should be able to notify its users as they change.

We can solve this by using custom dialog management to check the available destinations in the Lambda function and respond accordingly. Those destinations can be included in the speechOutput and repromptSpeech during slot elicitation:

this.emit(':elicitSlot', slotToElicit, speechOutput, repromptSpeech);

You won’t need the updatedIntent parameter for this exercise.



Using a dialog directive and conditional logic, create a slot elicitation for arrivalCity that lists the possible options. It should create conversations similar to those linked here.

In index.js, the helper function getListOfCities() generates the actual list based on available data and is stored as a string in the variable listOfCities. Include this in your speechOutput and repromptSpeech.

You can move on when your code passes the following tests:

  • If the dialog is not completed and the arrivalCity value HAS NOT been collected, elicit that slot. The elicitation must include the list of cities.
  • If the dialog is not completed and the arrivalCity value HAS been collected, delegate dialog management back to Alexa.
  • For all other cases, call the main functionality.

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?