Upselling Products

You may recall from Chapter 4, Creating Multi-Turn Dialogs that ScheduleTripIntent doesn’t complete until the user has specified the destination, departure date, and return date and those slots are validated. Until then the dialog is considered “in progress”, enabling us to step into the dialog to do custom validation.

In fact, we took advantage of this to validate that the return date is after the departure date in the ScheduleTripIntentHandler_InProgress.js module. We’ll apply a similar technique to verify that the user has purchased the Magnificent Moons package before allowing them to plan a trip to one of those premium destinations.

To start, let’s create a local helper function that checks to see if the user is requesting ...

Get Build Talking Apps for Alexa now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.