Getting Started

The typical first application a programmer writes when working with a new language or framework is the “Hello World” application in which we enable a minimum thread of execution to demonstrate base functionality. For our first skill, we will be deploying a simple fact telling skill, this is essentially the “Hello World” of Alexa skills but since the facts can be easily changed and updated this is a useful and fun initial skill to deploy and later modify.

Note

Our fact skill is based upon the Space Geek Skill a demo skill written by the Amazon developer team for the Java programming language.

Deploying our first skill

There are two primary tasks in deploying an Alexa Skill. The first is deploying the User Interaction Model in the Amazon Developer Portal and the second is deploying the skill implementation code to AWS Lambda.

The Alexa interaction with our skill would be similar to the below:

User: “Alexa, ask Obama fact to give me a fact.”
Alexa: “Did you know : …”

To deploy our example skill:

  • Clone the ASK Amy examples.

    $ git clone https://github.com/dphiggs01/ask_amy_example_skills.git
    
  • Edit the alexa_obama_fact_skill/cli_config.json and update aws_role with your AWS Lambda Role.

    {
        "skill_name": "alexa_obama_fact_skill",
        "skill_home_dir": ".",
        "aws_region": "us-east-1",
        "aws_profile": "default",
        "aws_role": "arn:aws:iam::***********:role/alexa_skill_role",
    
        "lambda_runtime": "python3.6",
        "lambda_handler": "ask_amy.lambda_function.lambda_handler",
        "lambda_timeout": "5",
        "lambda_memory": "128",
        "lambda_zip": "alexa_skill.zip",
    
        "ask_amy_dev": false,
        "ask_amy_home_dir": ""
    }
    
  • Create the AWS Lambda Function by executing the ask-amy-cli create_lambda … command below.

    $ ask-amy-cli create_lambda --deploy-json-file cli_config.json
    
  • After execution the output should be similar to the below content.

    {
        "add_trigger": {
            "Statement": "{\"Sid\":\"al....
        },
        "create_function": {
            "Role": "arn:aws:iam::095547******:role/alexa_skill_role",
            "MemorySize": 128,
            "CodeSize": 69157,
            "Description": "alexa_obama_fact_skill",
            "Runtime": "python3.6",
            "FunctionName": "alexa_obama_fact_skill",
            "TracingConfig": {
                "Mode": "PassThrough"
            },
            "Version": "$LATEST",
            "FunctionArn": "arn:aws:lambda:us-east-1:095547******:function:alexa_obama_fact_skill",
            "CodeSha256": "JZ/7XolvjCmxaYHUELY7ezuPGJWQs1os6Udhwv1rG9Y=",
            "LastModified": "2017-07-23T17:17:05.962+0000",
            "Handler": "ask_amy.lambda_function.lambda_handler",
            "Timeout": 5
        }
    }
    

    Note

    subsequent calls would use deploy_lambda inplace of create_lambda i.e ask-amy-cli deploy_lambda –deploy-json-file cli_config.json

  • Logon to Alex Development Portal. Select Create Skill

    _images/tut_1_01_add_new_skill.png
  • In Create a new skill set Skill name to Obama Fact and set Default language to English (US), choose Custom as the model (it is selected by default) click Create a skill

    _images/tut_1_02_skill_information.png
  • In Intercation Model copy the contents of the alexa_obama_fact_skill/speech_assests/intent_schema.json to Intent Schema and alexa_obama_fact_skill/speech_assests/utterance.txt to Sample Utterances, click Save and Next

    _images/tut_1_03_a_interaction_model.png _images/tut_1_03_b_interaction_model.png
  • In Configuration click AWS Lambda ARN, North America and paste the FunctionArn from step three above into the Service Endpoint Field, click Save and Next

    _images/tut_1_04_configuration.png
  • In Test Enter Utterance Give me a fact and click Ask Obama Fact note the Lambda Response

    _images/tut_1_05_test.png
  • Congratulations, You have deployed your first ASK Amy based skill!