Request a specific U.S. national park to get a brief sound clip of a typical activity or sight at the park, followed by a description of the park provided by the NPS API. You can then ask for location, general directions, or the current weather (OpenWeatherMap API).
To get a list of parks located in a particular state, say the state name.
- NPS API https://developer.nps.gov/api/
- OpenWeatherMap API http://openweathermap.org/api/
User: Alexa, start National Parks.
Alexa: Welcome to National Parks. Which park or state do you want information for?
Alexa: Texas has two national parks: Big Bend, Guadalupe Mountains. To continue, name a park or another state.
Alexa: <Hear a geyser.> Visit Yellowstone and experience the world's first national park. Marvel at a volcano’s... To continue, you can say weather or location or directions. Or you can ask for another park or a state.
Alexa: Yellowstone is in Wyoming, Montana, and Idaho. Anything else?
User: How do I get there?
Alexa: Yellowstone covers nearly 3,500 square miles in the northwest corner of Wyoming (3% of the park is in Montana and 1% is in Idaho). The park has five entrances and the directions to each depend on where your trip originates. Anything else?
Alexa: The weather at Yellowstone is overcast clouds with a temperature of 25 degrees. Anything else?
Alexa: Thanks for visiting. <Hear a bird tweeting.>
1. Create AWS and Amazon developer accounts.
2. Apply for API keys from NPS and OpenWeatherMap.
3. Research the national parks to determine the best audio to use for each park.
4. Download, edit and upload sound clips.
5. Create AWS Lambda function.
6. Create Alexa skill.
I used 18 audio files as intros to the national parks — waterfall, ocean, hiking, birds, river, bats, volcano, geyser, etc. See parks.js for a complete list. Most of the time, I used hiking.mp3 for the audio. The files were truncated to 10 seconds. I also created a 3-second audio file named warbler.mp3 to play at the end of a session.
To get audio files, you can buy them or download free ones or create your own. Pay attention to copyright laws, and make sure the files can be used commercially.
A. Edit the audio files using Audacity.
B. Edit parks.js in the source code with the correct mp3 file names, if necessary.
C. Upload the audio files.
- Upload the files somewhere with an HTTPS endpoint. I used AWS S3.
- Create a new bucket for the audio files.
- After uploading, right click on each file and select Make Public.
- Go to the src folder in the Code section.
- In index.js, edit the variable S3_BUCKET with the path to your S3 bucket containing the audio files.
- In utils.js, edit the variables NPS_API_KEY and OPEN_WEATHER_API_KEY with your API keys.
- Zip up the contents of the src folder.
- Follow the steps for creating a Lambda function on the Amazon developer site. The function name doesn't matter. Because the source code is written in Node.js, follow the instructions in the Node column.
- Note the ARN (Amazon Resource Name) for the function you created. You'll need it in the next step.
Did you replicate this project? Share it!I made one
Love this project? Think it could be improved? Tell us what you think!