Starting a New Alexa Conversations Project

There is not (yet) a way to add Alexa Conversations to an existing Alexa skill project. Therefore, we are unable to retrofit the Star Port 75 skill to make use of Alexa Conversations. Instead, we’ll start an all new skill project, using Alexa Conversations to recreate the multi-turn dialog we defined in Chapter 4, Creating Multi-Turn Dialogs.

Support for Alexa Conversations in the ASK CLI is relatively new and (at least for now) is only available in a beta version of the ASK CLI. To install the ASK CLI beta, use npm to install “ask-cli-x” as a global model like this:

 $ ​​npm​​ ​​install​​ ​​-g​​ ​​ask-cli-x

The beta version can be installed alongside the non-beta ASK CLI installation, so you don’t need to worry about one stepping on the other. When using the non-beta ASK CLI, you’ll use the ask command as we’ve done throughout this book. But when using the beta version, you’ll use the askx command instead.

The askx new command creates a new Alexa Conversations project, the same as ask new. The following session shows how you might use the ASK CLI to create a new Alexa Conversations skill:

 $ ​​askx​​ ​​new
 Please follow the wizard to start your Alexa skill project ->
 ? Choose the programming language you will use to code your skill: NodeJS
 ? Choose a method to host your skill's backend resources: AWS Lambda
  Host your skill code on AWS Lambda (requires AWS account).
 ? Choose a template to start with: Weather Bot (Beta)
  Quick sample weather bot skill using Alexa Conversations ACDL.
 ? Please type in your skill name: starport-75-conversations
 ? Please type in your folder name for the skill project (alphanumeric):
  starport-75-conversations
 Executing git custom command..
 remote: Counting objects: 104, done.
 Receiving objects: 100% (104/104), 24.88 KiB | 772.00 KiB/s, done.
 Resolving deltas: 100% (11/11), done.
 Project for skill "starport-75-conversations" is successfully created at
  /Users/habuma/Projects/starport-75-conversations
 
 Project initialized with deploy delegate "@ask-cli/lambda-deployer" successfully.

As you can see, after invoking askx new, you’ll be asked some very familiar questions. For purposes of developing an Alexa Conversations skill, you’ll need to be sure to answer some of the questions with very specific answers. To start with, Alexa Conversations are only supported in NodeJS. Also, when developing Alexa Conversations using the ASK CLI, Alexa-hosted skills are not an option; Only AWS Lambda-hosting is supported.

For the starting template, you’ll be presented with a handful of choices, three of which are specific to Alexa Conversations: Empty, Weather Bot, and Pizza Bot. The Empty template will give you a bare-bones Alexa Conversations project to start from, but it is perhaps a bit too empty; you’ll need to add the lambda directory and initialize the NodeJS project before you can write the fulfillment code. At the other extreme is the Pizza Bot example which is a great example of a complex Alexa Conversations skill, but is far too complicated to serve as a starting point for a new skill project.

Therefore, we’ll start with the Weather Bot skill. You will probably want to delete some weather-specific artifacts from it before you publish your skill. But for a starter project, it gives you everything you need to create a custom Alexa Skill.

Now that the new project has been created, we’re almost ready to define the skill’s conversation model. But first, let’s get acquainted with the Alexa Conversations Definition Language (ACDL), a language dedicated to defining conversation models.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset