Today we announced that developers can now programmatically manage and test their skills with the Alexa Skill Management API (SMAPI) and the Alexa Skills Kit Command-line Interface (ASK CLI), new features in the Alexa Skills Kit. You can now perform a full range of skill management and testing functions directly from the command line and with REST APIs using the Alexa Skills Kit Command Line Interface (ASK CLI) and the Alexa Skill Management API (SMAPI). Use ASK CLI for programmatic management of your own skills. Use SMAPI for creating tools that include skill management in their workflow.
This post explains the basic instructions and includes links to more resources to help you get started.
Every Alexa skill is represented by a skill.json file that contains all of the metadata required to represent a skill, such as the name, permissions, configuration, and publishing details like description, icon, and example phrases, as well as a reference to the interaction model.
The command-line interface allows you to obtain the skill.json file for each of your existing skills. You can create a new skill, update an existing skill, clone an existing skill, deploy a skill so that it is available to other developers, submit your skill for certification, and withdraw it from certification, among other tasks.
The ASK Command Line Interface (ASK CLI) is a tool for you to manage your Alexa skills and related AWS Lambda functions. With ASK CLI, you have access to the Skill Management API, which allows you to manage Alexa skills programmatically from the command line.
Quick Start for ASK CLI
Step 1: Prerequisites for Using ASK CLI
§ Node.js version 4.0 or greater and Node Package Manager (npm), which installs with Node.js. To check the version of node.js, open a command prompt and type the following:
$ node --version
To install or update your version of Node.js, use one of the following installers:
* [Windows Installer](https://nodejs.org/dist/v6.10.0/node-v6.10.0-x64.msi)
* [Mac Installer](https://nodejs.org/dist/v6.10.0/node-v6.10.0.pkg)
* [Linux: download binaries and add to Node.js and npm to your path](https://nodejs.org/en/download/)
If you have used AWS before, you likely have an AWS account already. Otherwise, you will have to create an AWS account. Ensure that your AWS account has the appropriate permissions as described in Set Up Credentials for an Amazon Web Services (AWS) Account.
Step 2: Install and Initialize ASK CLI
To install ASK CLI:
- Use npm to install ASK CLI. Run the npm global install command into the ask-cli folder:
$ npm install -g ask-cli
If you are using Linux, the installation may require
$ sudo npm install -g ask-cli
The first time you use ASK CLI, you must call the
init command to initialize the tool with your Amazon developer account credentials. For more information, see init command.
$ ask init
You will be prompted to select your profile and to log in to your AWS account. Once the initialization is complete, you can use ASK CLI to manage your skill.
Create and Deploy a Skill
Let’s make a skill using the new and deploy commands. ASK CLI will create a new skill and a new AWS Lambda function with an IAM role named “ask-lambda-skill name”, attached to the basic execution policy. Make sure your AWS user account has permissions to enable Role creation or this step will fail.
$ ask new --skill-name hello-world
$ ask deploy
You can also create a new local project from an existing skill by using the clone command.
Using API Commands
The api command provides a number of subcommands that enable you to create and modify skills associated with your developer account. There are subcommands for creating and updating the skill, interaction model, and account linking information as well as starting the skill certification process.
Here's a command to try right now. To list every skill you have created, regardless of its current state, use the list-skills command.
$ ask api list-skills
With the skillId values shown, you can perform more tasks that reference particular skills directly, such as
ask deploy to deploy a skill to other users. The
ask deploy command neatly packages your skill and facilitates making it available to other users.
Use the following help commands to see what high-level and subcommands you can perform:
$ ask --help
$ ask api --help
Harness the Power of Skill Events in Your Skill with ASK CLI
With ASK CLI, skill developers now have the capability to integrate with Alexa skill events directly. Access to these events allows skill developers to build richer skill and external app experiences. These skill events include enabling or disabling a skill, granting or changing permissions for a skill, using account linking in a skill. See Skill Events for Alexa Skills Development for more information about how to use events in your skill service.
ASK CLI and SMAPI are available today in beta so that you can programmatically manage and test your Alexa skills and resources such as interaction models. In this post we showed you how to get started. Here are some additional capabilities that may interest you:
We look forward to seeing what you create with these new capabilities.
Build a Skill, Earn Developer Perks
Got skills? Bring your big idea to life with the Alexa Skills Kit and earn perks through our new tiered rewards system. Publish a skill in September, and earn a pair of limited-edition Alexa dev socks. If 100 unique users use your skill in its first 30 days in the Alexa Skills Store, you can also apply to receive a free Echo Dot featuring a limited-edition developer skin design. Learn more about our promotion and start building today.