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?
Alexa: Which date?
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.
- Steps to create a skill
- Step 1: Create a skill based on a template
- Step 2: Compile the skill artifacts
- Step 3: Deploy the skill
- Step 4: Read about the package structure and artifacts
- Step 5: Test the skill
- Related topics
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.
- Create a skill based on a template.
- Compile the skill artifacts.
- Deploy the skill.
- Read about the package structure and artifacts.
- 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
- Create a folder to hold your skill code.
- In your skill code folder, open a command line.
- Enter the following command.
- Choose NodeJS.
Node.js is currently the only programming language that supports the ASK CLI Weather Bot template.
- Choose AWS Lambda.
AWS Lambda is currently the only hosting method that supports the ASK CLI Weather Bot template.
- Choose Weather Bot (Beta).
- Enter a skill name or press enter to select the default skill name.
- 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
- On a command line, navigate to your Weather Bot skill folder.
- Enter the following command.
Step 3: Deploy the skill
In this step, you deploy the skill to AWS Lambda.
To deploy the skill
- From your Weather Bot skill folder, enter the following command.
yto the warning about ACDL skills not being compatible with the developer console.
As the skill deploys, you see the following information.Note: The
deploycommand includes building the skill model. In the future, if you want to deploy changes just to the Lambda function and not build the model, you can use the AWS command line to deploy the Lambda function changes only. For details, see Using AWS Lambda with the AWS Command Line Interface in the AWS documentation.
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
- After your skill deploys, get the skill ID from the deployment information that the command line displays, as shown in the following excerpt.
- 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.
For details about the
askx dialogcommand, see dialog command.
- 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.
- To exit the conversation, enter
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.
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.
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.