Tutorial: Create an Alexa Conversations Skill with the Alexa Conversations Description Language (ACDL)

You can use the Alexa Skills Kit Command-Line Interface (ASK CLI) to create an Alexa Conversations skill from a quick-start Weather Bot template. This process typically takes 5-10 minutes.

The following is an example of how you interact with the skill.

User: Open my weather bot.
Alexa: Welcome to the weather bot, I can give you the weather report. Just say "what's the weather" to start.
User: What's the weather?
Alexa: Which city?
User: Seattle.
Alexa: Which date?
User: Tomorrow.
Alexa: In Seattle, it's a high of 65 degrees and a low of 50 degrees.

The Weather Bot template is a sample skill, so it contains data for a fixed set of cities and always uses "today" as the date. However, you can extend this skill to invoke any external weather API to get real data.

Prerequisites

Before you do this tutorial, you must install and configure a version of the ASK CLI that supports Alexa Conversations. For details, see Set up the ASK CLI to Use ACDL.

Steps to create a skill

Complete the following steps to create an Alexa Conversations skill using the ASK CLI.

  1. Create a skill based on a template.
  2. Compile the skill artifacts.
  3. Deploy the skill.
  4. Read about the package structure and artifacts.
  5. Test the skill.

Step 1: Create a skill based on a template

In this step, you create your skill from the Weather Bot template.

To create an Alexa Conversations skill by using the ASK CLI

  1. Create a folder to hold your skill code.
  2. In your skill code folder, open a command line.
  3. Enter the following command.
    askx new
  4. Choose NodeJS.
    Node.js is currently the only programming language that supports the ASK CLI Weather Bot template.
  5. Choose AWS Lambda.
    AWS Lambda is currently the only hosting method that supports the ASK CLI Weather Bot template.
  6. Choose Weather Bot (Beta).
  7. Enter a skill name or press enter to select the default skill name.
  8. Enter a folder name or press enter to select the default folder name.
    The command line displays a message such as the following.
    Project for skill "weather_bot" is successfully created at C:\<folder>\weatherbot
    Project initialized with deploy delegate "@ask-cli/lambda-deployer" successfully.
    

Step 2: Compile the skill artifacts

In this step, you compile the skill artifacts.

To compile the skill artifacts

  1. On a command line, navigate to your Weather Bot skill folder.
  2. Enter the following command.
    askx compile

Step 3: Deploy the skill

In this step, you deploy the skill to AWS Lambda.

To deploy the skill

  1. From your Weather Bot skill folder, enter the following command.
    askx deploy
  2. Enter y to the warning about ACDL skills not being compatible with the developer console.
    As the skill deploys, you see the following information.
    Deploying the skill
    Deploying the skill

Step 4: Read about the package structure and artifacts

While your skill deploys, you can familiarize yourself with the package contents in Understand the Directory Structure of ACDL.

Step 5: Test the skill

After your skill deploys, you can run it by using the ASK CLI as follows.

To run your skill by using the ASK CLI

  1. After your skill deploys, get the skill ID from the deployment information that the command line displays, as shown in the following excerpt.
    Skill ID in successful deployment message
    Skill ID in successful deployment message
  2. To run your skill by using the Alexa simulator, enter the following command on the command line.
    askx dialog -s <your-skill-id> -l en-US -g development
    The output is as follows.
    The Alexa simulator in the ASK CLI
    The Alexa simulator in the ASK CLI

    For details about the askx dialog command, see dialog command.

  3. At the User > prompt, enter Open my weather bot, and then engage in a conversation as follows.
    User > Open my weather bot
    Alexa > Welcome to the weather bot, I can give you the weather report. Just say "what's the weather" to start.
    User > What's the weather?
    Alexa > Which city?
    User > Seattle. 
    Alexa > Which date?
    User > Tomorrow. 
    Alexa > In Seattle, it's a high of 65 degrees and a low of 50 degrees.
    

    Because the conversation is AI-driven, Alexa might ask for the city and date in a different order.

  4. To exit the conversation, enter .quit or press ctrl+c.

Troubleshooting

The following are possible resolutions for common issues related to this tutorial.

Issue: When I create a skill by using the ASK CLI, the Weather Bot template is not an option.

Symptoms
When you type askx new and the ASK CLI guides you through skill creation, you don't see Weather Bot in the list of available templates.

Try this
Make sure that your version of the ASK CLI supports Alexa Conversations. To get the correct version, follow the steps in Set up the ASK CLI to Use ACDL.