Giter Site home page Giter Site logo

luhart / jargonized-skill-sample-highlowgame Goto Github PK

View Code? Open in Web Editor NEW

This project forked from alexa-samples/skill-sample-nodejs-highlowgame

0.0 1.0 0.0 117 KB

This is game where the player tries to guess the target number. After each incorrect guess, the player is informed if the target number is higher or lower than their guess. This sample Alexa Skill is written in Node.js and has been adapted to manage content using the Jargon SDK. It demonstrates the use of session and persistent attributes.

PowerShell 22.19% Shell 14.83% JavaScript 62.98%

jargonized-skill-sample-highlowgame's Introduction

Build An Alexa High Low Game Skill with the Jargon SDK

This is a fork of the Alexa High Low Game template skill that uses the Jargon SDK to manage content. This skill demonstrates the use of session and persistent attributes using Amazon DynamoDB and Amazon S3.

Skill Architecture

Each skill consists of two basic parts, a front end and a back end. The front end is the voice interface, or VUI. The voice interface is configured through the voice interaction model. The back end is where the logic of your skill resides.

Note: The High Low Game uses persistent attributes. When you create an Alexa-hosted skill, the persistence layer the sample code uses is Amazon S3. No configuration or additional setup is required to use the S3 bucket provided with an Alexa-hosted skill. When you create an AWS-hosted skill, the persistence layer the sample code uses is Amazon DynamoDB. The tutorial will walk you through any additional steps required to setup and access DynamoDB.

Instructions

Pre-requisites

Installation

  1. Make sure you are running the latest version of the CLI

    npm update -g ask-cli
  2. Clone the repository.

    ask new --url https://github.com/l-hartman/skill-sample-nodejs-highlowgame.git --skill-name high-low-game

Deployment

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.

  1. Navigate to the project's root directory. you should see a file named 'skill.json' there.
  2. Deploy the skill and the lambda function in one step by running the following command:
    ask deploy
  3. Once deployed, additional permissions need to be added to the AWS IAM role being used by the function since it is persisting data in Amazon DynamoDB. Locate the execution role used by the skill's Lambda function in the AWS IAM Console.
    1. Open the AWS Console: https://console.aws.amazon.com/iam
    2. Click on Roles.
    3. Type (at least part of) the name of your skill in the search box. (Replace spaces with dashes.)
    4. Click the role that corresponds to your skill's function.

      Note: If you can't find the correct role, first locate your skill's function in AWS Lambda. Scroll down to the section labeled Execution Role and find the role name there.

  4. On the right side of the Permissions tab, click + Add inline policy.
  5. Click the JSON tab.
  6. Select the existing JSON and replace it with the following policy document. This policy grants access to the role to (1) create the needed table and (2) read/write items to the table. It is restricted to this for just a table named 'High-Low-Game'.
    {
        "Version": "2012-10-17",
        "Statement": [
            {
                "Sid": "DynamoDBTableCreationAndAccess",
                "Effect": "Allow",
                "Action": [
                    "dynamodb:CreateTable",
                    "dynamodb:PutItem",
                    "dynamodb:GetItem",
                    "dynamodb:UpdateItem"
                ],
                "Resource": "arn:aws:dynamodb:*:*:table/High-Low-Game"
            }
        ]
    }
    
     > Note: The table name as specified in the sample code is `High-Low-Game`.  If you want to use a different name, change it in the policy and in the sample code.  The name doesn't matter as long as they match.
    
  7. Click Review Policy.
  8. Enter DynamoDBTableAccess as the Name.
  9. Click Create Policy.

Testing

  1. To test, you need to login to Alexa Developer Console, and enable the "Test" switch on your skill from the "Test" Tab.

  2. Simulate verbal interaction with your skill through the command line (this might take a few moments) using the following example:

     ask simulate -l en-GB -t "start high low game"
    
     ✓ Simulation created for simulation id: 4a7a9ed8-94b2-40c0-b3bd-fb63d9887fa7
    ◡ Waiting for simulation response{
      "status": "SUCCESSFUL",
      ...
  3. 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 high low game
    

Customization

  1. ./skill.json

    Change the skill name, example phrase, icons, testing instructions etc ...

    Remember than many information are locale-specific and must be changed for each locale (en-GB and en-US)

    See the Skill Manifest Documentation for more information.

  2. ./lambda/custom/index.js

    Modify messages, and data from the source code to customize the skill.

  3. ./models/*.json

    Change the model definition to replace the invocation name and the sample phrase for each intent. Repeat the operation for each locale you are planning to support.

  4. Remember to re-deploy your skill and lambda function for your changes to take effect.

Additional Resources

Community

Tutorials & Guides

  • Voice Design Guide - A great resource for learning conversational and voice user interface design.
  • Codecademy: Learn Alexa - Learn how to build an Alexa Skill from within your browser with this beginner friendly tutorial on Codecademy!

Documentation

jargonized-skill-sample-highlowgame's People

Contributors

akersh-s avatar deegles avatar franklin-lobb avatar hyandell avatar jakemkelly avatar jeffblankenburg avatar luhart avatar memodoring avatar

Watchers

 avatar

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.