Amazon Alexaask-cli

Get your Alexa Skill information by ASK CLI

Have you tried the ASK CLI? ASK CLI helps us to manage your Alexa Skill as a code. But sometime we want to use […]

広告ここから
広告ここまで

Have you tried the ASK CLI?

ASK CLI helps us to manage your Alexa Skill as a code. But sometime we want to use the Alexa Developer console in the browser to make a Model.

So, the post will try to get your Alexa Skill information by ASK CLi.

Run get-skill command, to import your skills information

If you want to get your skill information ,you can get it byask api get-skill.

$ ask api get-skill -h

  Usage: get-skill <-s|--skill-id <skill-id>> [-g|--stage <stage>] [-p|--profile <profile>] [--debug]

  get a skill

  Options:

    -s, --skill-id <skill-id>  skill-id for the skill
    -g, --stage <stage>        stage for the skill
    -p, --profile <profile>    ask cli profile
    --debug                    ask cli debug mode
    -h, --help                 output usage information

When you run the command, you can get your skill information as JSON.

$ ask api get-skill -s amzn1.ask.skill.xxxxx-xxx-xxx-xxxx
{
  "manifest": {
    "publishingInformation": {
      "locales": {
        "ja-JP": {
          "name": "Hello Alexa"
        }
      }
    },
    "apis": {
      "custom": {
        "endpoint": {
          "uri": "arn:aws:lambda:ap-northeast-1:9999999:function:example-development-hello"
        },
        "interfaces": []
      }
    },
    "manifestVersion": "1.0"
  }
}

Where should we export the information as JSON file

In ASK CLI, the skill information is at ./skill.jsonin your project. So you can merge the JSON object into the file.

$ ask api get-skill -s amzn1.ask.skill.xxxxx-xxx-xxx-xxxx > ./skill.json

get-model: to get the interaction model

You can get your skill’s interaction model (like an intent, slot, utterance) by api get-modelcommand.

$ ask api get-model -h

  Usage: get-model <-s|--skill-id <skill-id>> [-g|--stage <stage>] <-l|--locale <locale>> [-p|--profile <profile>] [--debug]

  get an interaction model for skill

  Options:

    -s, --skill-id <skill-id>  skill-id for the skill
    -g, --stage <stage>        stage for the skill
    -l, --locale <locale>      model locale for the skill
    -p, --profile <profile>    ask cli profile
    --debug                    ask cli debug mode
    -h, --help                 output usage information

The command result is here.

$ ask api get-model -s amzn1.ask.skill.xxxxx-xxx-xxx-xxxx --stage development -l ja-JP

{
  "interactionModel": {
    "languageModel": {
      "invocationName": "ハローアレクサ",
      "intents": [
        {
          "name": "AMAZON.CancelIntent",
          "samples": []
        },
        {
          "name": "AMAZON.HelpIntent",
          "samples": []
        },
        {
          "name": "AMAZON.StopIntent",
          "samples": []
        },
        {
          "name": "ExampleIntent",
          "slots": [
            {
              "name": "sample_number",
              "type": "AMAZON.NUMBER"
            }
          ],
          "samples": [
            "こんにちはアレクサ",
            "正解は {sample_number} 番"
          ]
        }
      ]
    }
  }
}

Where is in the interaction model ?

In ASK CLI, the skill information is at the ./models/directory in your project. So you can merge the JSON object into the file.

$ tree -L 2
.
├── lambda
│   └── custom
├── models
│   └── en-US.json

So you can easily to export the interaction model by following command.

$ ask api get-model -s amzn1.ask.skill.xxxxx-xxx-xxx-xxxx --stage development -l ja-JP > ./models/ja-JP.json

Lambdaのソースコード配置場所

When you run the ask createcommand. The skill’s Lambda function source code is in the /lambda/custom/directory.

$ tree -L 3
.
├── lambda
│   └── custom
│       ├── index.js
│       ├── node_modules
│       ├── package-lock.json
│       └── package.json
├── models

So if you have the Lambda function source code in another directory, you should move it into the directory.

ブックマークや限定記事(予定)など

WP Kyotoサポーター募集中

WordPressやフロントエンドアプリのホスティング、Algolia・AWSなどのサービス利用料を支援する「WP Kyotoサポーター」を募集しています。
月額または年額の有料プランを契約すると、ブックマーク機能などのサポーター限定機能がご利用いただけます。

14日間のトライアルも用意しておりますので、「このサイトよく見るな」という方はぜひご検討ください。

広告ここから
広告ここまで

Related Category posts