This project allows you to create your own voice based pick a path adventure which is described as JSON in Dynamo DB.
- Node.js (> v4.3)
- The ask CLI
- Register for an AWS Account
- Register for an Amazon Developer Account
-
Install ask cli & run
ask initto link with your account -
Clone the repository.
$ git clone https://github.com/benleov/alexa-pap.git
-
Navigating into the repository's root folder.
$ cd alexa-pap -
Install npm dependencies by navigating into the
lambda/directory and running the npm command:npm install$ cd lambda/ $ npm install
/lambda/- The lambda function that processes requests from alexa/examples/sample-story.json- An example story stored in DynamoDB
ASK CLI will create the skill and the lambda function for you. The Lambda function will be created in us-east-1 (Northern Virginia) by default
-
Deploy the skill and the lambda function in one step by running the following command:
$ cd .. # to get back to the root directory $ ask deploy
-
Once deployed, additional permissions need to be added to the AWS IAM role being used by the skill since it is persisting data in Amazon DynamoDB. Navigate to the AWS IAM console.
Note: We are adding the full access policy here for convenience. For a production skill, you should use a more targeted policy restricting access to just the required resources. Refer to the DynamoDB documentation for more details.
- Locate the role for your skill (by default, it is named
ask-lambda-<your skill name>). - Click on the role, then click Attach Policy.
- Search for AmazonDynamoDBFullAccess and click the check box next to it.
- Click Attach Policy.
- Locate the role for your skill (by default, it is named
- You need to make sure that your Alexa is in the same region and using locale as what you have deployed.
- You need to deploy the lambda that supports Alexa, such as Ireland (eu-west-1)
- Create row in the Pick-A-Path table within dynamo db with key "story"
- Using an editor like https://jsoneditoronline.org/ is easier than using DynamoDB to edit the story as the latter will rearrange the children elements to be at the top making it difficult to work with.
- Modify speech with https://developer.amazon.com/docs/custom-skills/speech-synthesis-markup-language-ssml-reference.html
- An example is in
/examples/example-story.json
-
To test, you need to login to Alexa Developer Console, and enable the "Test" switch on your skill from the "Test" Tab.
-
Simulate verbal interaction with your skill through the command line using the following example:
$ ask simulate -l en-US -t "start pick a path game" ✓ Simulation created for simulation id: 4a7a9ed8-94b2-40c0-b3bd-fb63d9887fa7 Waiting for simulation response{ "status": "SUCCESSFUL", ...
Note: if you did not add the DynamoDB permission as described in the previous step, the skill will return an error and you will see an error in your CloudWatch Logs reporting: ...
Coud not read item...is not authorized to perform: dynamodb:GetItem...
-
Once the "Test" switch is enabled, your skill can be tested on devices associated with the developer account as well. Speak to Alexa from any enabled device, from your browser at echosim.io, or through your Amazon Mobile App and say :
Alexa, start pick a path game