Giter Club home page Giter Club logo

thebestdarngirls's Introduction

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 In Stores. For English Speaking Great Britain and the United States, uses can purchase access to Early Screening reviews and a searchable Library. Some reviews in the Library will be exclusives because they will never be featured in the main app. User add In Store review items to their Amazon cart.

Technology Used

Built with

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)
  • Release-4.0.0: Uses Node.js 10.15 with In Skill Purchasing for English speaking US and English Speaking Great Britian. Adds a library backed by Aurora DB and Early Screening Reviews. Changed Must Buy to In Stores
  • Release-4.1.0: Updated NPM packages, added support for Echo Spot 5, updated the Logo, updated APL to version 1.1, and bug fixes.
  • Release-4.1.1: Updated CodePipeline with more robust CodeBuilds
  • Release-4.1.2: Update NodeJS from version 10 to version 14. Updates had to be made to the Lambda function, AWS CodeBuild, and the package.json.
  • Release-5.0.0: Updated APL to version 1.6 for improved tablet support, updated templates, and increases response time. Also, several bug fixes
  • Release-5.0.1: Updated APL for movieoptions and getList for version 1.8 to support using images as buttons
  • Release-5.1.0: Add Alexa Shopping Kit to In Stores section of the US locale and updated the APL for all locales
  • Release-5.2.0: Update NodeJS from version 14 to version 18

Code

  • Data Folder
    • earlyScreening.js - contains data for the Early Screening section
    • 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 In Stores 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
    • help.json - sets up APL design for the help page
    • librarywelcome.json - sets up APL design for the library home page
    • movieoptions.json - sets 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. Italics are for EN-US and EN-GB only.

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
CancelPurchaseIntent {Verbs} my subscription
{Verbs} my {ProductName} subscription
{Verbs} {ProductName} subscription
{verbs} subscription
to {Verbs} my subscription
etc
Verbs
ProductName
LIST_OF_VERBS
LIST_OF_PRODUCT_NAMES
BuyIntent to purchase {ProductName}
to buy {ProductName}
i would like {ProductName}
i want {ProductName}
would like {ProductName}
ProductName LIST_OF_PRODUCT_NAMES
WhatCanIBuy purchase
what can i buy
what can i shop for
tell me what can i buy
etc
Library look for {query}
look for {MovieList}
search for {query}
search for {MovieList}
lookup {query}
etc
query
MovieList
Amazon.SearchQuery
LIST_OF_MOVIES
}
Slot Types Value
USER_COMMAND main menu
movie options
repeat
MENU_OPTIONS Video on Demand
In Stores
Made for TV
In The Theater
Early Screening
Library
LETTER_CHOICE 1 through 5
6 through 10
LIST_OF_VERBS stop
refund
return
end
cancel
LIST_OF_PRODUCT_NAMES Premium Access
LIST_OF_MOVIES List of all the movies in the database
Amazon.SearchQuery Name the slot query

Create a subscription product and note its ARN and Product Name.

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. First create a Role with the following permissions

  • SecretsManagerReadWrite
  • AmazonRDSDataFullAccess
  • AWSLambdaBasicExecutonRole
  • AWSLambdaVPCAccessExecutionRole
Then create an Aurora MySQL 5.6 DB cluster with the following following table setup:
CREATE TABLE reviews (
	ID int NOT NULL AUTO_INCREMENT,
	Title varchar(255) NOT NULL,
	Rating float NOT NULL,
	Image varchar(255) NOT NULL,
	Review blob(4000) NOT NULL,
	PRIMARY KEY (ID)
);

Next, create an AWS Secrets Manager with the automatic rotation disabled. Then, in the AWS Management Console, create 2 Lambda functions with

  • Trigger: Alexa Skills Kit
  • Runtime: Node.js 10.x
  • Environment Variables
    • database: Database name
    • productID: ARN number of the ISP created
    • productName: Name used when ISP was created
    • resourceArn: Aurora ARN
    • secretArn: Secret Manager ARN
    • skillAdds: A sentence to tell the users what movies have been added to the skill
    • libraryAdds: A sentence to tell the users what movies have been added to the library
  • Code entry type: Upload a .zip file
  • Timeout: 0 to 8 seconds
  • Execution Role: Role created above

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 [email protected]

Credits

That Darn Girl

thebestdarngirls's People

Contributors

dependabot[bot] avatar karatetd avatar tiffanygray avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Forkers

trellixvulnteam

thebestdarngirls's Issues

Update local code

update all code to reflect python

  • index.js
  • all helper functions
  • all data
  • all templates

Skip/Previous

After picking a select and saying 'main menu', the options are right but the instructions are wrong.

Steps:

  1. Library
  2. Search for and
  3. skip
  4. i choose 4
  5. repeat
  6. movie options

the instructions will tell you that you can say skip but you can't. You are at the end. It should only give a previous option.

Create new CodeBuild

Create a code build based on push. It will build the code and push the artifact to S3 for code deploy to use

Update br and n

now
is replaced by \n\n which is correct on the cards but on the screen.
should be replaced by one \n and the cards should have 2

Capture Decline offer in Upsell

Once a person rejects an offer, you need to make note of this. Remind them they rejected the offer, tell them how to learn more on their own and continue with the skill.

Handle results > 10 with Next Page and Previous Page

Some searches come back with lots of results and the lambda times out. It should

  • tell the person the # of matches
  • tell them it's listing the first ten
  • for more results "next page"
  • for previous results "previous page"
    (0nly if results are > 10)
  • must save results and row count

  • and a page handler

  • look up buttons

test skill

Each Page

  • Welcome/Main Menu
  • Movie List
  • Movie Page
  • Library Page
  • Help Page

Each Action

  • Video on Demand
  • Library
  • In Stores
  • Made for TV
  • Early Screening
  • In The Theater
  • Movie selection
  • Search

Add full sentences

Alexa, ask the best darn girls for in the theater reviews
Alexa, ask the best darn girls for the library
Alexa, ask the best darn girls to search the library
Alexa, ask the best darn girls for made for tv reviews
Alexa, ask the best darn girls for must buy reviews
Alexa, ask the best darn girls for video on demand reviews
Alexa, ask the best darn girls for the latest in the theater reviews
Alexa, ask the best darn girls for the latest made for tv reviews
Alexa, ask the best darn girls for the latest must buy reviews
Alexa, ask the best darn girls for the latest video on demand reviews

Fix Spot Display

This display caused the skill to be rejected. It must be fixed.

Locale Warning

Let the users know the premium access isn't available in their location. Let them know it will be coming soon

Create new Code Pipeline

Create a code build to pull the branch
Update use new code build commands with appspec.yaml
Push zip to lambda, push code to s3 bucket
Test code
If code is ok
pull zip from s3 and push to production

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.