Trigger Definition
To implement a custom trigger, you must provide at least one trigger definition file in your routines skill package to represent your custom trigger.
In your routines skill package, use the /skill-package/routines/triggers/ directory to hold trigger definition files. Only Alexa skills with the type routines can understand trigger definitions.
routines, your skill fails to build.The following skill package directory shows a skill package that contains a trigger that supports two locales. Items marked with (new) indicate that they are for the routines skill type only.
The trigger definition file is a JSON file. Add your trigger definition files in the /skill-package/routines/triggers/{some-trigger-name}/ directory for each trigger type. The file name for your trigger definition must match with the four letter locale code supported in Alexa skills. For example, use the en-US.json file name to represent a trigger definition in US english. All locale files must share the same name field. Only their display.title, display.iconUrl, and display.description fields might differ.
en-US, en-CA. The following JSON file shows a trigger definition template.
The following JSON file shows a UNICAST trigger definition example.
The following JSON file shows a MULTICAST trigger definition example.
Trigger definition
The following table shows details about the trigger definition for your JSON file.
| Field | Description | Type | Required | 
|---|---|---|---|
| 
 | Name that identifies the custom trigger in your skill. This name is case sensitive and accepts from one to a maximum of 50 alphanumeric characters.  Note: To support multiple locales, the  namefield must be the same for all locales. Only thedisplayobject can differ. | String | Yes | 
| 
 | Trigger display object. For more details, see display object. | Object | Yes | 
| 
 | A list of objects that define the parameters for your trigger. For more details, see parameters object. | Array of objects | Yes | 
| 
 | Type of trigger. Acceptable values are:  | String | Yes | 
| 
 | Indicates whether your skill requires account linking. Acceptable values are:  | String | No | 
| 
 | Values that help categorize your trigger. Accepted values are:   Note: Your skill and its triggers can have different category values.   | Array of strings | Yes | 
| 
 | List of search terms that your customer can use to search the trigger. Keywords can be different for different locales. | Array of strings | Yes | 
Display object
Use the display object to describe the trigger details that you want to display in the Alexa app. You can create the display object for each locale.
| Field | Description | Type | Required | 
|---|---|---|---|
| 
 | Title for the trigger in the Alexa app. You can localize the title for different locales. | String | Yes | 
| 
 | Description for the trigger in the Alexa app. The  | String | No | 
| 
 | Public web address to get the trigger icon. You can localize the icon for different locales. | String | No | 
Parameters object
Use parameters to define a list of parameters for your trigger. Your customers use trigger parameters when they create or update a trigger. Routines require a defined list of parameters to construct a trigger detail page and render valid trigger parameters. How you order the parameters list determines their order on the rendered page.
| Field | Description | Type | Required | 
|---|---|---|---|
| 
 | Name of the trigger parameter in the trigger creation request data object. | String | Yes | 
| 
 | The parameter schema including its type. For more details, see schema object. | Object | Yes | 
| 
 | Information about the title, description, and icon URL for the custom trigger. For more details, see display object. | Object | Yes | 
Schema object
Use the schema object inside the parameters object to specify the schema details. Acceptable value: enum.
| Field | Description | Type | Required | 
|---|---|---|---|
| 
 | Type of the schema. Acceptable value:  | String | Yes | 
Enum type schema object
The enum type schema accepts a list of enum value objects.
| Field | Description | Type | Required | 
|---|---|---|---|
| 
 | For the enum type schema, set this field to  | String | Yes | 
| 
 | Available enum values and their display metadata. See enum value object. | Array of enum value objects | Yes | 
Enum value object
The enum value object lists distinct values.
| Field | Description | Type | Required | 
|---|---|---|---|
| 
 | Distinct enumeration value of the enum set. This is the value of the enum data in the trigger creation request data. | String | Yes | 
| 
 | Trigger display object. For more details, see display object. | Object | Yes | 
Best practices for trigger icons, descriptions, and titles
- 
    Your icons must meet the following requirements: - PNG file format
- 512 x 512 pixels in size
- Transparent background
- Visible on both light (#FFFFFF) and dark (#010B13) mode backgrounds
 
- 
    You should have icons for all options in an enumlist, or for none of them. The same rule applies to descriptions.
- 
    The namefield anddisplay.titleare different. Thedisplay.titleis what your customer sees, therefore you should make sure that yourdisplay.titlereflects the actual meaning of your trigger.
Example icons
Icon with a transparent background

Icon clearly visible on both light and dark backgrounds

Related topics
Last updated: Sep 10, 2024