Awesome tutorial!
Steve Atwal
1

Hi Steve, so there are two ways to accomplish what you want to do:

  1. You can create a new file and put in bunch of data in there (perhaps copy-paste from a list of restaurants around your area).
  2. Pull from some API (Yelp?) and generate a random restaurant from that.

The second approach would definitely be more robust, but requires more familiarity with node.js and callbacks/promises. If you want to go this route, you can take a look at http://www.smorgasbork.com/2015/09/06/ruuvu-building-an-alexa-skill-with-alexa-app/ for pulling data out of IMDB API.

If you want to go the first route, make a new file in the same directory as your index.js, call it whatever you want (e.g. food.js). In this file, you will declare a variable (e.g. var food) and put all your food choices (basically this is the same as var food = [“Thai”, …”Uncle Julio’s”] line in index.js). Then all you have to do is export this variable: at the bottom of your food.js, do something like exports.food = food;

Finally, you just have to import this variable in index.js and get rid of the var food inside function generate_suggestions. At the top of your index.js, import the other file like var food = require(‘./food’); Now everything should work as before: basically, we moved the hardcoded part to a different file so you can copy paste a huge list. You can refer to SampleMovies.js file in the IMDB API example if you are confused.

In terms of where this file would reside, you would have to reupload the zip file on AWS Lambda. You do not have to change anything on the Alexa Skills Portal though. You only have to update that if you want to change sample utterances or intents.

Hope this helps!

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.