Amazon Alexa

ask-cliでスキルの公開前バリーデーション(β版)を試す

Alexa開発ダッシュボードでは、スキルの公開前に必要な項目が揃っているか確認することができます。そしてask-cliでもその機能を利用することができるコマンドが追加されていましたので、早速ためしてみました。 [注意]こ […]

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

Alexa開発ダッシュボードでは、スキルの公開前に必要な項目が揃っているか確認することができます。そしてask-cliでもその機能を利用することができるコマンドが追加されていましたので、早速ためしてみました。

[注意]このコマンドはβ版のため、変更が入る可能性があります

ドキュメントを見ると、以下のようにコメントがされています。

Note: The Skill Validation API is offered as a beta and may improve or change as we receive feedback and iterate on the feature. Please provide your feedback to this forum thread: Wanted: Feedback on Skill Validation API.

https://developer.amazon.com/docs/smapi/ask-cli-command-reference.html#validate-skill-subcommand

「ユーザーのフィードバックを受けて変更する可能性がある」と書かれておりますので、この記事の内容は2018/05/01時点でのものであることをご留意ください。

バリデーションの実行

simulation apiなどと同様、「リクエスト送信 -> 結果取得」という流れになります。まずはapi validate-skillでリクエストを送りましょう。

$ ask api validate-skill -h

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

  (Beta) validate a skill

  Options:

    -s, --skill-id <skill-id>  skill-id for the skill
    -l, --locales <locales>    a list of locales for executing skill validations
    -g, --stage <stage>        stage for skill
    -p, --profile <profile>    ask cli profile
    --debug                    ask cli debug mode
    -h, --help                 output usage information

実行すると、バリデーションIDをステータスが表示されます。

$ ask api validate-skill -s amzn1.ask.skill.xxxx-xxxx-xxxx-xxxxxxx --stage development -l en-US
{
  "id": "xxxx-xxxx-xxxx",
  "status": "IN_PROGRESS"
}

バリデーション結果の取得

先ほど取得したバリデーションIDを元に結果を見てみましょう。結果の取得には、api get-validationを利用します。

$ ask api get-validation -h

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

  (Beta) get skill validation result

  Options:

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

実行結果です。サンプル発話の入力がされていないことが通知されていますね。

$ ask api get-validation -i xxxx-xxxx-xxxx-xxxxxxx -s amzn1.ask.skill.xxxx-xxxx-xxxx-xxxxxxx --stage development -l en-US
{
  "id": "xxxx-xxxx-xxxx-xxxxxxx",
  "status": "FAILED",
  "result": {
    "validations": [
      {
        "locale": "en-US",
        "title": "Example phrases cannot be empty",
        "description": "Required: Provide at least one example phrase",
        "status": "FAILED",
        "importance": "REQUIRED"
      }
    ]
  }
}

statusSUCCESSFULになっていれば、バリデーションOKです。

{
  "id": "xxxx-xxxx-xxxx-xxxxxxx",
  "status": "SUCCESSFUL",
  "result": {
    "validations": [
      {
        "locale": "en-US",
        "title": "Not enough example phrases provided",
        "description": "Required: Provide at least 1 example phrase",
        "status": "SUCCESSFUL",
        "importance": "REQUIRED"
      },
      {
        "locale": "en-US",
        "title": "Too many Example Phrases provided",
        "description": "Please limit your entry to a maximum of 3 example phrases.",
        "status": "SUCCESSFUL",
        "importance": "REQUIRED"
      },
      {
        "locale": "en-US",
        "title": "Example Phrase has duplicate phrases",
        "description": "Your example phrases must not be duplicates. Please provide unique entries.",
        "status": "SUCCESSFUL",
        "importance": "REQUIRED"
      },
      {
        "locale": "en-US",
        "title": "Example Phrase too short",
        "description": "Your example phrase does not meet the minimum character limit of 2 characters.",
        "status": "SUCCESSFUL",
        "importance": "REQUIRED"
      },
      {
        "locale": "en-US",
        "title": "Example Phrase exceeds maximum length",
        "description": "Your example phrase has exceeded the maximum character limit of 200 characters.",
        "status": "SUCCESSFUL",
        "importance": "REQUIRED"
      },
      {
        "locale": "en-US",
        "title": "Example Phrase contains special characters",
        "description": "Example phrases can only contain apostrophes, quotation marks, questions marks, periods, exclamation points and commas.",
        "status": "SUCCESSFUL",
        "importance": "REQUIRED"
      },
      {
        "locale": "en-US",
        "title": "Example Phrase cannot be blank",
        "description": "The example phrase may not be left empty. At least one example phrase must exist.",
        "status": "SUCCESSFUL",
        "importance": "REQUIRED"
      },
      {
        "locale": "en-US",
        "title": "Example phrase must start with wake word",
        "description": "The example phrase must start with Alexa as the wake word.",
        "status": "SUCCESSFUL",
        "importance": "RECOMMENDED"
      },
      {
        "locale": "en-US",
        "title": "Example phrase must contain invocation name",
        "description": "Your example phrase must contain the invocation name: [cloud quiz game].",
        "status": "SUCCESSFUL",
        "importance": "RECOMMENDED"
      },
      {
        "locale": "en-US",
        "title": "Example phrase must match launch pattern",
        "description": "Your example phrase, 'Alexa open cloud quiz game' does not follow the right launch pattern.",
        "status": "SUCCESSFUL",
        "importance": "RECOMMENDED"
      },
      {
        "locale": "en-US",
        "title": "Example Phrase too short",
        "description": "Your example phrase does not meet the minimum character limit of 2 characters.",
        "status": "SUCCESSFUL",
        "importance": "REQUIRED"
      },
      {
        "locale": "en-US",
        "title": "Example Phrase exceeds maximum length",
        "description": "Your example phrase has exceeded the maximum character limit of 200 characters.",
        "status": "SUCCESSFUL",
        "importance": "REQUIRED"
      },
      {
        "locale": "en-US",
        "title": "Example Phrase contains special characters",
        "description": "Example phrases can only contain apostrophes, quotation marks, questions marks, periods, exclamation points and commas.",
        "status": "SUCCESSFUL",
        "importance": "REQUIRED"
      },
      {
        "locale": "en-US",
        "title": "Example Phrase must match utterance",
        "description": "Your example phrase, 'start quiz game' does not contain a sample utterance that you have provided in your intent(s).",
        "status": "SUCCESSFUL",
        "importance": "RECOMMENDED"
      },
      {
        "locale": "en-US",
        "title": "Example Phrase too short",
        "description": "Your example phrase does not meet the minimum character limit of 2 characters.",
        "status": "SUCCESSFUL",
        "importance": "REQUIRED"
      },
      {
        "locale": "en-US",
        "title": "Example Phrase exceeds maximum length",
        "description": "Your example phrase has exceeded the maximum character limit of 200 characters.",
        "status": "SUCCESSFUL",
        "importance": "REQUIRED"
      },
      {
        "locale": "en-US",
        "title": "Example Phrase contains special characters",
        "description": "Example phrases can only contain apostrophes, quotation marks, questions marks, periods, exclamation points and commas.",
        "status": "SUCCESSFUL",
        "importance": "REQUIRED"
      },
      {
        "locale": "en-US",
        "title": "Example Phrase must match utterance",
        "description": "Your example phrase, 'start karuta' does not contain a sample utterance that you have provided in your intent(s).",
        "status": "SUCCESSFUL",
        "importance": "RECOMMENDED"
      }
    ]
  }
}

バリデーションAPIの使い所

ask api submitコマンドでCLIからの公開申請がすでに可能です。ですのでバリデーションAPIを利用したCI / CDパイプラインを組むことで、スキルの公開情報などもGit管理と自動テストができるようになるのではないかなと思います。

日本語対応状況(2018/05/01時点)

ここまででてきたサンプルコードとメッセージがすべて英語なので、察されている方もいるかもしれません。β版機能のためか、現時点でこの機能はまだ日本語に対応していません。

$ ask api validate-skill -s amzn1.ask.skill.xxxx-xxxx-xxxx-xxxxxxx --stage development -l ja-JP
Call validate-skill error.
Error code: 400
{
  "message": "Unsupported locale. Please note that only en-US, en-AU, en-CA, en-GB, en-IN locales are currently supported. Use the developer portal to test any other locales."
}

よくよく見るとドイツ語も未対応の様子なので、気長にβ版が取れる日を待ちましょう。

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

WP Kyotoサポーター募集中

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

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

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

Related Category posts