Search code examples
amazon-web-servicesaws-cliamazon-echo

Use the Amazon Alexa Skill CLI to update the Interaction Model


Trying to update the interaction model of my skill using the command line based AWS CLI. Until now I've been copying the interaction model directly into the online skill editor. What's the best process for doing this programmatically?


Solution

  • To Update your Alexa Skill Interaction Model Via the AWS CLI:

    1) Setup an AWS CLI Profile using credentials from your AWS IAM Profile https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html

    $ aws configure --profile [PREFERED PROFILE NAME]
    AWS Access Key ID [None]: AKIAIOSFODNN7_EXAMPLE_FOUND_IN_IAM
    AWS Secret Access Key [None]: wJalrXUtnFEMI/K7MDENG/bPxRfiCY_EXAMPLE_KEY
    Default region name [None]: us-east-1
    Default output format [None]: json
    

    In the Command Line:

    SKILL_ID=[YOUR SKILL ID FOUND AT DEVELOPER.AMAZON.COM]
    CLI_PROFILE=[YOUR CLI PROFILE CREATED ABOVE]
    
    ask api update-model -s ${SKILL_ID} -p ${CLI_PROFILE} -l en-US -f [PATH TO FILE]/InteractionModel.json
    

    Note:

    • en-US updates the english interaction model

    Return Data:

    Model for en-US submitted.
    Please use the following command to track the model build status:
    
    ask api get-skill-status -s amzn1.ask.skill.4245ff2e-476c-418b-8004-dc63346dc432e4
    

    To Track your progress be sure to append your AWS_CLI profile

    ask api get-skill-status -s amzn1.ask.skill.4245ff2e-476c-418b-8004-dc63346dc432e4 -p ${CLI_PROFILE}
    

    Tracking Result Data:

    {
      "interactionModel": {
        "en-US": {
          "eTag": "f05823449ac35d318acb4096d061eaa8",
          "lastUpdateRequest": {
            "status": "IN_PROGRESS"
          }
        }
      },
      "manifest": {
        "eTag": "df3b0a7c544b5c0ee006e34cf726dcd2",
        "lastUpdateRequest": {
          "status": "SUCCEEDED"
        }
      }
    }
    

    LastUpdateRequest Status: Should Eventually Read SUCCEEDED

    Forewarning:

    • You cannot update the Invocation Name of a live skill. This is the only error I've run across so far. "message": "InvalidStageInvocationNameChange: You cannot change the invocation name for a live skill."