Routines Trigger Service Provider Interface
A UNICAST
delivery has a unique recipient for the trigger parameters. If you use UNICAST
as the delivery type in your trigger definition, you must implement the Routines Trigger Service Provider Interface (SPI) in your Alexa skill to handle requests from your customer to create or delete a routine. When a customer sets up a routine with your trigger, Alexa sends a callback request to your skill and your skill must send a response to this callback request.
Requests and responses
The following table shows the available operations with the Routines Trigger SPI.
Operation | Description |
---|---|
|
When a customer sets up a routine with your trigger, Alexa sends a |
|
When a customer deletes a routine that contains your trigger, Alexa sends a |
Trigger request
When a customer creates a routine with your trigger or enables a routine that contains your trigger from the Routines Gallery, Alexa sends an event to your Alexa skill with the following JSON payload.
When a customer deletes a routine with your trigger or disables a routine that contains your trigger from the Routines Gallery, Alexa sends an event to your skill with the following JSON payload.
Request parameters
The following table shows the request parameters.
Property | Description | Type | Required |
---|---|---|---|
|
Details of the trigger request from the user. |
Object |
Yes |
|
The date and time when Alexa sends the request as an ISO 8601 format, |
String |
Yes |
|
A unique identifier for the specific request. |
String |
Yes |
|
The routines request type. The acceptable values are: |
String |
Yes |
|
Information of the trigger that is created or deleted by the customer. |
Object |
Yes |
|
Trigger name that is defined in trigger definition. |
String |
Yes |
|
Inputs received during trigger configuration. The values in this object correspond to the trigger parameters that are defined in the trigger registration. Alexa collects your customer's trigger configuration from the trigger detail page and passes them to your skill as the parameters. For details about trigger registration, see Step 2.3 Deploy the skill to development and submit your trigger definition for registration in "Steps for Create Custom Triggers for Routines". |
Object |
Yes |
|
Recipient information that you have configured the trigger for. |
Object |
Yes |
|
Type of the event recipient value. In this release, the acceptable value is |
String |
Yes |
|
An object that describes the event recipient. For the |
Object |
Yes |
|
A string that represents a unique identifier for the Amazon account for which the skill is enabled. The format is |
String |
Yes |
|
Use this parameter when the user is a customer who has an account that is linked with the Alexa skill. This parameter holds the customer's account linking information, such as access token. For details about account linking, see Add Account Linking to Your Alexa Skill. |
Object |
Yes |
|
Type of the provided token. In this release, the supported value is |
String |
Yes |
|
Value of the token to access the account information of the customer. |
String |
Yes |
Trigger response
A successful response returns an HTTP status 200 Okay
. On error, the response returns the appropriate error HTTP status code. For more details, see HTTP status codes.
Response parameters
The following table shows the response parameters.
Property | Description | Type | Required |
---|---|---|---|
|
The |
String |
Yes |
HTTP status codes
HTTP status code | Type | Description |
---|---|---|
|
|
Operation succeeded. |
|
|
The request payload has invalid parameters. |
|
|
The access token is invalid. |
|
|
The requester doesn't have access to the trigger type. |
|
|
The request resource isn't found. |
|
|
The server received too many requests. |
|
|
An internal error occurred when processing the request. |
|
|
The server is unavailable to accept the request. |
Related topics
Last updated: Sep 10, 2024