Alexa.SimpleEventSource Interface 1.0
Implement the Alexa.SimpleEventSource
interface to model stateless events, such as a button press on a remote or an occupant entering a room. Users can connect the events to Alexa routines. For example, after the user presses a button on their remote switch or smart button, Alexa triggers a routine to dim their smart bulbs to 25 percent and close the blinds.
The Alexa.SimpleEventSource
interface is a generic controller interface.
For the list of languages that the Alexa.SimpleEventSource
interface supports, see List of Alexa Interfaces and Supported Languages. For the definitions of the Alexa message properties, see Alexa Interface Message and Property Reference.
Utterances
The Alexa.SimpleEventSource
interface doesn't have any user utterances. The customer interacts with your device, and the associated event triggers an Alexa routine.
Reportable properties
The Alexa.SimpleEventSource
interface doesn't define any reportable properties.
Discovery
You describe endpoints that support Alexa.SimpleEventSource
by using the standard discovery mechanism described in Alexa.Discovery
.
Set the display category to the one most appropriate for your device, such as REMOTE
. For the full list of display categories, see display categories.
To let Alexa know the health of your device, also implement the Alexa.EndpointHealth
interface.
Alexa.SimpleEventSource
interface.Capabilities array
An endpoint can support multiple instances of Alexa.SimpleEventSource
, so you must always include the instance
ID in your events and responses.
Define an instance
for each interface and schema that the same endpoint supports in the capabilities
object.
In addition to the usual discovery response fields, for each Alexa.SimpleEventSource
entry in the capabilities
array, include the following fields.
Property | Description | Type | Required |
---|---|---|---|
|
Unique identifier for the instance, preferably a version 4 UUID. |
String |
Yes |
|
Friendly names that users can use to refer to the button or gestures supported by your device. Alexa displays these names in the Alexa app and customers can use the friendly name to identify entities on your device that can trigger events. |
|
Yes |
|
A list of events that this device supports. You must define at least one event. |
Array of objects |
Yes |
|
Unique identifier used to refer to this event. |
String |
Yes |
|
Friendly names for the event. Alexa displays these names in the Alexa app and customers can use the friendly name to trigger an Alexa routine. |
Array of |
Yes |
Assets for the REMOTE display category
Alexa defines instance and event friendly name assets for the REMOTE
display category in the global Alexa catalog. If you use another display category, define friendly names that best describe the instance and events for your device.
Instance friendly name assets
For REMOTE
devices, you can use the following localized, friendly name assets to identify entities on your device that can trigger events, such as the buttons on a remote or an occupant entering a room. Or, you can define your own friendly names.
Asset identifier | Supported friendly names |
---|---|
|
Off button |
|
On button |
|
Brighten button |
|
Dim button |
|
Main button |
|
Top button |
|
Bottom button |
|
Center button |
|
Middle button |
|
Up button |
|
Down button |
|
Left button |
|
Right button |
|
First button |
|
Second button |
|
Third button |
|
Fourth button |
|
Fifth button |
|
Sixth button |
|
Seventh button |
|
Eighth button |
Event friendly name assets
For REMOTE
devices, you can use the following localized, friendly name assets to identify actions that trigger an event. For example, a button might support both a single push or a double push. Or, you can define your own friendly names.
Asset identifier | Supported friendly names |
---|---|
|
Double press |
|
Double push |
|
Long press |
|
Long push |
|
Single press |
|
Single push |
|
Double click |
|
Double tap |
|
Single click |
|
Swipe down |
|
Swipe left |
|
Swipe right |
|
Swipe up |
|
Tap |
Discovery response example
The following example shows a Discover.Response
message for a remote switch that supports the Alexa.SimpleEventSource
interface. The switch has four buttons with one event per button.
Directives and events
The Alexa.SimpleEventSource
interface doesn't define any directives, but does define an event.
SimpleEvent event
Send a SimpleEvent
message to the Alexa event gateway to notify Alexa proactively that the user triggered the specified event on the specified event source. For details, see Send Events to the Event Gateway.
SimpleEvent example
The following example shows a SimpleEvent
to notify Alexa that an event, identified as Button.SinglePush
fired on the specified instance.
{
"event": {
"header": {
"namespace": "Alexa.SimpleEventSource",
"name": "Event",
"instance": "Unique identifier, preferably a version 4 UUID",
"messageId": "Unique identifier, preferably a version 4 UUID",
"payloadVersion": "1.0"
},
"endpoint": {
"scope": {
"type": "BearerToken",
"token": "OAuth2 bearer token"
},
"endpointId": "Endpoint id",
"cookie": {}
},
"payload": {
"id": "Button.SinglePush.1",
"timestamp": "2021-12-12T16:20:50:52Z"
}
}
}
SimpleEvent payload
The following table shows the payload details for the SimpleEvent
event.
Property | Description | Type | Required |
---|---|---|---|
|
Identifies the event that fired. You defined the event |
String |
No |
|
Time the endpoint detected the event. |
String |
Yes |
SimpleEvent response
If Alexa handles the event successfully, your skill receives HTTP status code 202 Success
from the Alexa event gateway. On error, Alexa sends the appropriate HTTP status code.
HTTP status codes
The following table shows the HTTP status code values that your skill might receive from the Alexa event gateway. If you receive an error, the payload
object contains a code
and description
field. Use these fields for logging only.
Status | Payload code | Description |
---|---|---|
|
— |
Request is authorized and the message is a syntactically valid event. The gateway accepted the event for further logical validation and processing. |
|
|
Message is invalid due to missing fields, incorrect values, or malformed JSON. Check your messages against the documentation to verify that your message contains all the required fields. |
|
|
Message didn't include the authorization token or the token is invalid, expired, or malformed. Refresh your token and retry the request. If a user disables your skill, that also invalidates the access token. Here, the user revoked authorization, and you can stop sending change reports for them. |
|
|
You're not allowed access to the event gateway. Make sure that you're sending the events to the correct regional endpoint. For example, send events in North America to the North American endpoint. |
|
|
Token doesn't have the required permissions. Make sure that the skill has permission to send Alexa events. For details, see Request Access to the Alexa Event Gateway. |
|
|
Account record associated with this directed identifier doesn't exist or has expired. This error can occur if the event was sent too late or with an invalid directed identifier. Verify that the directed identifier and authorization code are correct. |
|
|
Skill ID associated with this token wasn't found. This error occurs when user's access token was generated when the skill was in different stage, such as certification. Try disabling and re-enabling the skill for this user. |
|
|
Size of the event payload is too large. The maximum number of endpoints allowed in a request is 300. Send your message with smaller payloads. |
|
|
Number of requests is too high. Resend the message up to three times, with at least a one-second interval between each send attempt. |
|
|
Error occurred with Alexa, and the message wasn't processed. Resend the message up to three times, with at least a one-second interval between each send attempt. If problems persist, contact Amazon Support. |
|
|
Alexa couldn't accept the message. Resend the message up to three times, with at least a one-second interval between each attempt. If the problem persists, contact Amazon Support. |
Example 401 Unauthorized response body
The following example shows an error response.
HTTP/1.1 400 Bad Request
Date: Wed, 07 Mar 2018 20:25:31 GMT
Connection: close
{
"header": {
"namespace": "System",
"name": "Exception",
"messageId": "90c3fc62-4b2d-460c-9c8b-77251f1698a0"
},
"payload": {
"code": "INVALID_ACCESS_TOKEN_EXCEPTION",
"description": "The access token is invalid, expired, or malformed."
}
}
Change reporting
You send a ChangeReport
event to report changes proactively in the state of an endpoint. You identify the properties that you proactively report in your discovery response. For details about change reports, see Understand State and Change Reporting.
Alexa.SimpleEventSource
interface doesn't define any proactively reportable properties. However, you send change reports for the other interfaces that you implement in your skill. Related topics
Last updated: Nov 22, 2023