Add Events to Your Skill
When you develop a skill with ASK CLI (Alexa Skills Kit Command Line Interface), you can modify the skill schema to include event subscriptions that allow you to build richer skill and external app experiences. See Skill Events and List Events.
All skill models—that is, custom skills, smart home skills, and so on—support skill events.
To add events to an existing skill, follow these instructions. Otherwise, to create a new list skill directly from ASK CLI, see Steps to Create a List Skill. You can view sample code for a skill with skill and list events.
The following instructions apply to both custom skills and list skills.
A custom skill manifest can include skill events if updated in this manner.
A list skill manifest has two possible formats:
- A skill manifest for a custom skill, including events, plus an additional
householdList
field in theapis
object. - A skill manifest that includes a
householdList
field, but nocustom
object in theapis
object, and no interaction model.
Obtain Access to Alexa Skill Management API
Install ASK CLI from npm. See Quick Start Alexa Skills Kit Command Line Interface for installation instructions.
Update Skill Definition to Include Events
After you complete the ASK CLI installation and initialization, you can update your skill definition for any of your existing skills as follows.
- Download your existing skill schema. Run this command:
ask api get-skill -s {skillId} > skill.json
-
Update the
skill.json
file to include theevents
object. See the Skill Manifest formats for each type of supported skill. -
If required by your skill, add the
permissionInfo
object, using the appropriate scopes for your skill, to your skill schema definition manually. Check the format against the appropriate Skill Manifest. -
Update your skill definition. Run this command:
ask api update-skill -s {skillId} -f skill.json
For an example that shows how to include code in your skill service to handle events, see the List Events Demo on GitHub.