/how-old-is

Serverless Alexa skill to find out how old (someone/something) is

Primary LanguageGoApache License 2.0Apache-2.0

How-Old-Is

This repository contains the Alexa skill to find out how long something or someone has been alive for.

SETUP

How to configure your Alexa Skill

Please Configure the Makefile with your own available S3 bucket

  1. Create a new Alexa skill with a name of your choice

  2. Set Alexa skill invocation method as 'how old is x'

  3. Set built-in invent invocations to their relevant phrases i.e. 'help', 'stop', 'cancel', etc.

  4. Set a random phrase for the built-in fallback intent, i.e. 'bumbaclart'

  5. Create new Intent named 'AgeIntent'

  6. Create new intent slot named 'name', with SLOT TYPE 'AMAZON.FirstName'

  7. Add invocation phrase for the 'AgeIntent' intent with phrase 'how old is {name}'

  8. Configure slot values for the 'AMAZON.FirstName' SLOT TYPE i.e. 'Bob'

  9. Edit the 'internal/dom/age.go' file to feature your name and DoB in RFC3339 format

  10. Package and deploy how-old-is lambda

  11. Configure Alexa skill endpoint lambda ARN:
    Once the 'how-old-is' lambda has been deployed,
    retrieve the generated lambda ARN using the AWS console or
    one of the describe stack methods found above.
    input the lambda ARN as the default endpoint of your Alexa skill,
    within your Alexa development console!

  12. Begin testing your Alexa skill by querying for 'how old is x'

  13. Query Alexa 'how old is Bob'

  14. Query Alexa 'bumbaclart' or your fallback invocation phrase!

  15. Tell Alexa to 'stop'

  16. Testing complete!

Development

To develop how-old-is or interact with its source code in any meaningful way, be sure you have the following installed:

Prerequisites

You will need to activate Modules for your version of GO,

by setting the GO111MODULE=on environment variable set

curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $GOPATH/bin latest

Make sure you configure the AWS CLI

  • AWS Access Key ID
  • AWS Secret Access Key
  • Default region 'us-east-1'
aws configure

Build

How to build the Alexa skill lambda

Note*:- Executables are placed in 'dist/handlers/*/main'

make build

OR

  • Lint the project FIRST

Note*:-This may throw build errors, which may not break anything!

golangci-lint run
  • Build the lambda
GOARCH=amd64 GOOS=linux go build -gcflags='-N -l' -o dist/how-old-is/main  ./lambda/handlers/how-old-is/main.go

Package & Deploy

This section describes how to validate, compile and deploy the latest Alexa skill.

Validate

Validate the template.yml before packaging!

make validate

OR

sam validate

Package

How to compile template.yml after updating the back-end stack definition.

make package
  • runs clean
  • runs build
  • runs sam validate
  • runs sam package

OR

sam package --template-file template.yml --s3-bucket {{bucket-name}} --output-template-file packaged.yml

OR

aws cloudformation package --template-file template.yml --output-template-file packaged.yml --s3-bucket {{bucket-name}}

Deploy

How to deploy the complied packaged.yml to update the serverless stack.

make deploy

OR

sam deploy --template-file ./packaged.yaml --stack-name how-old-is --capabilities CAPABILITY_IAM

OR

aws cloudformation deploy --template-file ./packaged.yml --stack-name how-old-is --capabilities CAPABILITY_IAM

Describe Stack

Get information about the back-end infrastructure

make describe

OR

aws cloudformation describe-stacks  --region us-east-1 --stack-name how-old-is

Contributors

This project exists thanks to all the people who contribute.

Donations

All donations are appreciated!

Donate