A simple Amazon Alexa number game. This is a demonstration of using Amazon's Alexa Skills Kit SDK for nodejs.
"Alexa, open Fizz Buzz"
or
"Alex, play Fizz Buzz"
Count upwards from 1 taking turns with Alexa. If a number is divisible by 3 then say, "fizz". If a number is divisible by 5 say, "buzz". And if it is divisible by both 3 and 5 then say, "fizz buzz".
e.g. "1", "2", "fizz", "4", "buzz", etc.
You lose after you get it wrong for the second time.
- Install nodejs
- Register for an AWS Account
- Register for an Amazon Developer Account
- Install and Setup Serverless Framework
Fork this repository to submit pull requests OR use it as a template project for building your own Alexa App. I believe that the easiest way to do this is to use the Serverless Framework.
- Get the latest version of Serverless:
npm update -g serverless
- Install from the repository:
serverless install -u https://github.com/jnicho02/alexa-fizzbuzz/tree/master -n [your_project_name]
- Install npm dependencies:
cd [your_project_name]/lambda/custom
npm
Alexa language models are set up in their own special web panel. As of 2018, this is being updated constantly so these instructions may have aged.
-
Open the Alexa Console
-
Create a new skill
-
Open your skill
-
Scroll down and select the 'JSON Editor' in the left-hand menu
-
Drag and drop /models/en-GB.json (or your language area) to the editor's 'drag and drop a .json file' panel
sls deploy
Use the AWS Console to see the Lamdba programs created
See the inputs and outputs via the Alexa web page
cd lambda/custom
npm test
This is a deliberate model answer for Alexa code to demonstrate best practice.
Each RequestHandler will be called by index.handler without knowledge of any other. Keep it neat by putting each into a module and avoid the temptation to create global variables.
The workings of the fizzbuzz game itself are in its own module. This allows us to unit test it without invoking any Lamdba, Alexa, etc.