Alexa CLI Commands

Learn how to build and deploy Alexa projects using the Jovo CLI.

Introduction

The Alexa CLI plugin allows you to interact with the Alexa Developer Console using the Jovo CLI.

To use the Alexa CLI, add it as plugin to your jovo.project.js file. Learn more about Alexa project configuration here.

const { ProjectConfig } = require('@jovotech/cli-core');
const { AlexaCli } = require('@jovotech/platform-alexa');
// ...

const project = new ProjectConfig({
  // ...
  plugins: [
    new AlexaCli(),
    // ...
  ],
});

The Alexa CLI plugin uses the official ASK (Alexa Skills Kit) CLI provided by Amazon for deployment. For the deployment to work, you need to at least set up a default ASK profile using the ASK CLI. Follow the official Alexa docs to install and configure ASK CLI.

The Alexa CLI plugin hooks into the following commands:

  • build: Create Alexa project files based on the project config and models folder
  • deploy: Deploy project files to the Alexa Developer Console
  • get: Synchronize your local project files with the Alexa Developer Console

Also it provides the following platform specific commands:

build

The Alexa CLI plugin hooks into the build command and creates a platform.alexa folder inside the build directory in the root of your Jovo project. Learn more about the build command here.

$ jovo build:platform alexa

It uses the Alexa jovo.project.js configuration and files in the models folder to create Alexa-specific project files that are ready for deployment.

The folder then contains an ask-resources.json file and a skill-package folder as explained in the official Alexa docs.

The Alexa CLI plugin adds the following flags to the build command:

FlagDescriptionExamples
--ask-profileAdd the specified ASK profile to the ask-states.json file. Learn more about ASK profile configuration here.--ask-profile default
--asyncDeploys the skill asynchronously. You can check the status of the upload using the ASK CLI.--async

You can also add the --reverse flag to turn the Alexa Interaction Model files in your build folder into Jovo Model files in your models folder. This is especially helpful if you maintain your Interaction Model in the Alexa Developer Console and then use the get command to synchronize your console project with your local files. Learn more about reverse builds here.

# Import files from Alexa Developer Console
$ jovo get:platform alexa

# Turn Alexa Interaction Model into Jovo Model
$ jovo build:platform alexa --reverse

deploy

You can use the following CLI commands for deployment:

  • deploy:platform: Deploy your project to the Alexa Developer Console.
  • deploy:code: Bundle and deploy your source code to a server or cloud hosting platform like AWS.

deploy:platform

The Alexa CLI plugin hooks into the deploy:platform command to deploy the Alexa project files (which were previously generated using the build command) to the Alexa Developer Console.

$ jovo deploy:platform alexa

After successful deployment, you can open the Alexa Developer Console and see the changes there. If it was the first deployment, a new Alexa Skill is created. The Skill ID is stored in build/platform.alexa/.ask/ask-states.json. We recommend copying the Alexa Skill ID and adding it to your project config. This ensures that the project is always deployed to the right Skill in the Alexa Developer Console.

The Alexa CLI plugin adds the following flags to the deploy:platform command:

FlagDescriptionExamples
--ask-profileDeploy to using the specified ASK profile. Learn more about ASK profile configuration here.--ask-profile default
--asyncDon't wait for the model building process to be finished. Recommended for Alexa Conversations.
--skip-validationSkip the validation step of the Alexa Conversations ACDL compiler.

deploy:code

If you want to deploy the code of your Jovo app to a server or cloud service, you can use the deploy:code command.

If you run into problems while bundling the code, make sure that the bundle script in your package.json file includes the following:

{
  "scripts": {
    "bundle": "[...] --external:@alexa/*"
  }
}

The reason for this is that esbuild can't resolve vscode, a dependency used in @alexa/acdl, which is used for the Alexa Conversations integration.

get

The Alexa CLI plugin hooks into the get:platform command to synchronize the files in your build directory with the project data from the Alexa Developer Console.

$ jovo get:platform alexa

This is helpful if you've made any updates to the Skill's configuration (for example updating interfaces) that you now want to add to the jovo.project.js file using the files configuration.

The Alexa CLI plugin adds the following flags to the get:platform command:

FlagDescriptionExamples
--ask-profileRetrieve data using the specified ASK profile. Learn more about ASK profile configuration here.--ask-profile default

After running get, you can turn your Alexa Interaction Model into Jovo Model files using build --reverse:

# Import files from Alexa Developer Console
$ jovo get:platform alexa

# Turn Alexa Interaction Model into Jovo Model
$ jovo build:platform alexa --reverse

validate

The Alexa CLI plugin provides a command to easily trigger a Skill Validation.

$ jovo verify:alexa

After successfully triggering the validation, you can check the status in the Alexa Developer Console.

FlagDescriptionExamples
--skill-stageEither development, live or certification depending on what skill stage is to be validated. Default is developmentjovo validate:alexa --skill-stage development
--skill-idThe skillId of the to be validated skill. If not provided, will be taken from the stage in the project configuration. Learn more about ASK skillId configuration herejovo validate:alexa --skill-id amzn1.ask.skill.123example
--ask-profileDeploy to using the specified ASK profile. If not provided as flag, will be taken from project configuration. Learn more about ASK profile configuration herejovo validate:alexa --ask-profile default
--localesList of locales in which to validate the skill. If not provided, will do for all locales in project configuration. Learn more about locales configuration herejovo validate:alexa --locales en-US de-DE

certify

The Alexa CLI plugin provides a command to easily trigger a Skill Certification.

$ jovo certify:alexa

After successfully triggering the certification, you can check the status of the certification in the Alexa Developer Console.

FlagDescriptionExamples
--skill-idThe skillId of the to be validated skill. If not provided, will be taken from the stage in the project configuration. Learn more about ASK skillId configuration herejovo certify:alexa --skill-id amzn1.ask.skill.123example
--ask-profileDeploy to using the specified ASK profile. If not provided as flag, will be taken from project configuration. Learn more about ASK profile configuration herejovo certify:alexa --ask-profile default
--publication-methodEither MANUAL_PUBLISHING or AUTO_PUBLISHING. Default is MANUAL_PUBLISHING. Learn more about publication methodsjovo validate:alexa --publication-method AUTO_PUBLISHING