thebestdarngirls
This code will create a movie review app for an Alexa skill
Motivation
To create an Alexa skill to coincide with my website, thatdarngirlmovie.reviews. User will get the last 5 reviews for movies that are In The Theater, Made for TV, Video on Demand, and Must Buy.
Technology Used
Built with
- Amazon S3
- Alexa Skill Kit
- AWS Lambda
- AWS CodePipeline
- GitHub
- NodeJS 8.10
Features
When this code is git push'ed to master branch, it triggers your CodePipeline to build the code in the Development Lambda Function. Once built, it waits for the user to manually test in the Alexa Development Console. If the test is labeled successful, the CodePipeline will build the code in the Production Lambda Function. This will change the skill to all production customers.
Releases
- Release-1.0.0: Uses Node.js 6.10 without Alexa Skills Cards
- Release-1.1.0: Uses Node.js 6.10 with Alexa Skills Cards
- Release-2.0.0: Uses Node.js 8.10 with Alexa Skills Cards and optimized for the Echo Show and the Echo Spot
- Release-2.0.1: Release-2.0.0 with bug fixes
- Release-3.0.0: Updated with the Alexa Presentation Language (APL) which optimizes this skill for Echo Spot, Echo Show 1st Gen, Echo Show 2nd Gen, and Fire TV (FTC Affiliate Disclaimer)
Code
- Data Folder
- inTheTheater.js - contains data for the In The Theater section
- madeForTV.js - contains data for the Made For TV section
- mustBuy.js - contains data for the Must Buy section
- videoOnDemand.js - contains data for the Video On Demand section
- Helpers Folder
- getCardInfo.js - returns information about a specific movie for the Alexa Skills Card
- getList.js - returns the json for Alexa devices with screens
- getOptions.js - creates a string for Alexa to say
- getReview.js - returns the review in the data file
- JSON Folder
- background.json - sets background images for APL design. If you change the image here, it will change everywhere
- movieoptions.json - set up APL design for the movie options section
- review.json - sets up APL design for the movie review
- welcome.json - sets up APL deign for the home, help, and goodbye screen
- index.js This contains the code with helper functions for each Intent listed in the next section.
Installation
First, you must have an account on the Alexa Developer Console. Then create a new skill. The following are the Intents, followed by their sample utterences, and their slots. Also, you need a a development and production Lambda function for the system to call. And you need the images in a public S3 bucket with CORS turned off.
| Intent | Sample Utterances | Slot Name | Slot Type |
|---|---|---|---|
| Commands | {command} Please {command} |
command | USER_COMMAND |
| MenuSelection | {menu} | menu | MENU_OPTIONS |
| MovieChoices | show me {choice} tell me about {choice} select {choice} i choose {choice} {choice} |
choice | LETTER_CHOICE |
| Slot Types | Value |
|---|---|
| USER_COMMAND | main menu movie options repeat good bye |
| MENU_OPTIONS | Video on Demand Must Buy Made for TV In The Theater |
| LETTER_CHOICE | 1 through 5 |
Test
First, you must have an account on the Alexa Developer Console to test. Open your Alexa skill and click the "Test" tab. To start, say the following invocation "Open [Invocation of your choice]". Then follow the prompts. Listen for grammar and spelling errors.
How to use
Create an account on the Alexa Developer Console and the AWS Management Console. In the Alexa Developer Console, create a skill with the above mention intents, sample utterances, and slots. In the AWS Management Console, create 2 Lambda functions with
- Trigger: Alexa Skills Kit
- Resources: Amazon CloudWatch Logs
- Runtime: Node.js 8.10
- Code entry type: Upload a .zip file
Create a CodePipeline. The CodeCommit should use your GitHub Repo with this code. The CodeBuild should run the following steps
cd lambda
npm install
zip -r ../OOOOOOO.zip *
cd ..
aws lambda update-function-code --function-name DDDDDDD --zip-file fileb://OOOOOOO.zip
Replace the DDDDDDD with your Lambda Dev function name. Replace the OOOOOOO with your desired zip file name. Add a manual Testing step to the CodePipeline. The Test section above will explain how to use the Alexa Developer Console to test. Finally, add a CodeBuild step to push your code to production.
cd lambda
npm install
zip -r ../OOOOOOO.zip *
cd ..
aws lambda update-function-code --function-name PPPPPPP --zip-file fileb://OOOOOOO.zip
Replace the PPPPPPP with your Lambda Prod function name.
Suggestions
To make suggestions for code changes, fixes, or updates, please email thebestdarngirls@gmail.com
Credits
That Darn Girl
Log in or sign up for Devpost to join the conversation.