Notifications REST API Reference
Use the Alexa Notifications REST API to send notifications to your Alexa Smart Properties (ASP) guests or residents. You can choose from voice and visual announcements, device notifications, and persistent visual alerts.
Notification types
The Notifications API can deliver notifications to up to one hundred different units in a single request. You can specify one of the following notification types:
- Device notification – For Alexa-enabled devices without screens, the device notification is a yellow ring and a chime sound. For devices with screens, the device notification is a banner and a persistent notification indicator.
- Announcement – For devices with and without screens, Alexa makes announcements by voice. For devices with screens, the announcement displays as a message on the screen.
- Persistent visual alert – Persistent visual alerts are available for Alexa-enabled devices with screens. A persistent visual alert is a notification that displays on the screen until it expires or the guest or resident dismisses it.
API endpoint
Based on the country of your organization, set the Host
parameter in the request header to one of the following API endpoints.
Country | Endpoint |
---|---|
CA, US |
|
DE, ES, FR, IT, UK |
|
JP |
|
Authentication
Each API request must have an authorization header whose value is the access token retrieved from Login with Amazon (LWA). For details, see Manage API Access.
Operations
The Notifications API includes the following operations.
Operation | HTTP Method and URI |
---|---|
| |
| |
| |
|
Send notifications
Send a notification to each of the specified recipients. You can send one notification type at a time. If a persistent visual alert is active, you can't send another persistent visual alert until the active one expires.
This operation is available in the following countries.
Healthcare | Hospitality | Senior Living | Core |
---|---|---|---|
US |
US, UK, FR, CA, IT, DE, ES, JP |
US, UK, FR, CA, IT, DE, ES, JP |
US |
Request
To send a notification, you make a POST
request to the /v3/notifications
resource.
Request path and header example
POST /v3/notifications HTTP/1.1
Host: api.amazonalexa.com
Accept: application/json
Authorization: Bearer {access token}
Request path and header parameters
Parameter | Located in | Description | Type | Required |
---|---|---|---|---|
|
Header |
Access token for the customer. |
String |
Yes |
Request body examples
The following examples show the notification request body for each notification type.
Request body properties
Property | Description | Type | Required |
---|---|---|---|
|
List of recipients of the notification. |
Array of objects |
Yes |
|
Type of recipient. |
String |
Yes |
|
Identifies the unit. |
String |
Yes |
|
Describes the notification. |
Object |
Yes |
|
List of notification variants. |
Array of objects |
Yes |
|
Notification delivery type. For details about the types, see Notification types. |
String |
Yes |
|
Content for the notification. The specific fields for this object depend on the |
Content object |
Yes |
|
Expiration date and time of the notification. Valid for notification |
String |
No |
|
Reference ID of the newly created notification. |
String |
No |
Response
A successful response returns HTTP 202 Accepted
, along with the list of notifications published and failed.
If the entire request fails, the response returns the appropriate HTTP status code and includes a response body with an Error object.
Response body examples
The following response example shows a notification sent to all recipients successfully.
The following response example shows a persistent notification sent to some recipients successfully and failed to send to other recipients.
The following response example shows a notification that failed to send to all recipients. In this example, the failure reasons are different for each recipient.
Response body properties
HTTP 202 Accepted
.Property | Description | Type |
---|---|---|
|
Short description of the result. |
String |
|
Detailed description of the result. |
String |
|
List of successful notification results. |
Array of objects |
|
Identifies the unit notified. |
String |
|
Unique reference identifier for the unit and notification. If a problem occurs, Amazon can use this value to troubleshoot the problem. |
String |
|
(Optional) List of error results. |
Array |
|
Identifies the unit where the notiification failed. |
String |
|
HTTP response code for the failed request item. |
Integer |
|
Short error code. |
String |
|
Human-readable error message. The error message appears only for debugging and logging purposes. You must not share it with the customer. No business logic should depend on the content of the error description. |
String |
|
Indicates whether there are more results to return. |
Object |
|
Included when the response is truncated. |
String |
HTTP status codes
Status | Description |
---|---|
|
Response body contains list of success and error results. |
|
Indicates that one or more properties in the request body aren't valid. |
|
Request didn't include the authorization token, or the included token expired or isn't valid. Or, you don't have access to the resource. |
|
Indicates that the authorization token is valid, but the requested operation isn't allowed. |
|
Requested resource not found. |
|
Permitted rate limit, specified as the number of requests per unit of time, exceeded. You can retry the request by using exponential back-off. |
|
Error occurred on the server. You can retry the request by using exponential back-off. |
|
Server is down for maintenance, overloaded, or otherwise unavailable to handle the incoming request. |
Delete notification by unit ID
Delete all notifications of the specified type from the specified unit.
This operation is available in the following countries.
Healthcare | Hospitality | Senior Living | Core |
---|---|---|---|
US |
US, UK, FR, CA, IT, DE, ES, JP |
US, UK, FR, CA, IT, DE, ES, JP |
US |
Request
To remove notifications, you make a DELETE
request to the /v3/notifications
resource.
Request path and header example
DELETE /v3/notifications?recipients.id={unitid}&recipients.type={recipientType}¬ification.variants.type={variantType}
Host: api.amazonalexa.com
Content-Type: application/json
Authorization: Bearer {access token}
Request path and header parameters
Parameter | Located in | Description | Type | Required |
---|---|---|---|---|
|
Query |
Identifies the unit. |
String |
Yes |
|
Query |
Type of recipient. |
String |
Yes |
|
Query |
Notification delivery type. |
String |
Yes |
|
Header |
Access token for the customer. |
String |
Yes |
Request body example
The request has no body.
Request body properties
The request has no body.
Response
A successful response returns HTTP 202 Accepted
.
On error, the response returns the appropriate HTTP status code and includes a response body with an Error object.
Response body example
The response has no body.
Response body properties
The response has no body.
HTTP status codes
Status | Description |
---|---|
|
All notifications deleted from specified unit. |
|
Indicates that one or more properties in the request body aren't valid. |
|
Request didn't include the authorization token, or the included token expired or isn't valid. Or, you don't have access to the resource. |
|
Indicates that the authorization token is valid, but the requested operation isn't allowed. |
|
Requested resource not found. |
|
Permitted rate limit, specified as the number of requests per unit of time, exceeded. You can retry the request by using exponential back-off. |
|
Error occurred on the server. You can retry the request by using exponential back-off. |
|
Server is down for maintenance, overloaded, or otherwise unavailable to handle the incoming request. |
Delete all notifications
Delete all notifications associated with the specified units.
This operation is available in the following countries.
Healthcare | Hospitality | Senior Living | Core |
---|---|---|---|
US |
US, UK, FR, CA, IT, DE, JP |
US, UK, FR, CA, IT, DE, JP |
US |
Request
To delete notifications, you make a DELETE
request to the /v3/notifications/delete
resource.
Request path and header example
POST /v3/notifications/delete
Host: api.amazonalexa.com
Content-type: application/json
Authorization: Bearer {access token}
Request path and header parameters
Parameter | Located in | Description | Type | Required |
---|---|---|---|---|
|
Header |
Access token for the customer. |
String |
Yes |
Request body example
{
"recipients": [{
"type": "Unit",
"id": "amzn1.alexa.unit.did.101"
},
{
"type": "Unit",
"id": "amzn1.alexa.unit.did.102"
}
],
"notificationTypes": ["PersistentVisualAlert"]
}
Request body properties
Property | Description | Type | Required |
---|---|---|---|
|
List of recipients of the notification. |
Array of objects |
Yes |
|
Type of recipient. |
String |
Yes |
|
Identifies the unit from which to delete notifications. |
String |
Yes |
|
Type of notification to delete. |
Array of strings |
Yes |
Response
A successful response returns HTTP 202 Accepted
.
On error, the response returns the appropriate HTTP status code and includes a response body with an Error object.
Response body examples
On success, the response has no body.
The following example shows the response when a specified unit ID is invalid.
The following example shows the response when you're not authorized to operate on one or more unit IDs.
Response body properties
On success, the response has no body.
On error, the response body includes the following properties.
Property | Description | Type |
---|---|---|
|
Short description of the result. |
String |
|
Detailed description of the result. |
String |
|
(Optional) List of error results. |
Array |
|
Identifies the unit where the notiification failed. |
String |
|
HTTP response code for the failed request item. |
Integer |
|
Short error code. |
String |
|
Human-readable error message. The error message appears only for debugging and logging purposes. You must not share it with the customer. No business logic should depend on the content of the error description. |
String |
HTTP status codes
Status | Description |
---|---|
|
Deletion of all notifications accepted and processing. |
|
Indicates that one or more properties in the request body aren't valid. |
|
Request didn't include the authorization token, or the included token expired or isn't valid. Or, you don't have access to the resource. |
|
Indicates that the authorization token is valid, but the requested operation isn't allowed. |
|
Requested resource not found. |
|
Permitted rate limit, specified as the number of requests per unit of time, exceeded. You can retry the request by using exponential back-off. |
|
Error occurred on the server. You can retry the request by using exponential back-off. |
|
Server is down for maintenance, overloaded, or otherwise unavailable to handle the incoming request. |
Query persistent visual alerts
Query for persistent visual alerts in a list of units.
This operation is available in the following countries.
Healthcare | Hospitality | Senior Living | Core |
---|---|---|---|
US |
US, UK, FR, CA, IT, DE, ES, JP |
US, UK, FR, CA, IT, DE, ES, JP |
US |
Request
To get the alerts, you make a POST
request to the /v3/notifications/query
resource.
Request path and header example
POST /v3/notifications/query HTTP/1.1
Host: api.amazonalexa.com
Accept: application/json
Authorization: Bearer {access token}
Request path and header parameters
Parameter | Located in | Description | Type | Required |
---|---|---|---|---|
|
Header |
Access token for the customer. |
String |
Yes |
Request body examples
The following example gets active persistent visual alert notifications for one or more units.
The following example gets active persistent visual alert notifications for one of the specified reference IDs.
Request parameters
Property | Description | Type | Required |
---|---|---|---|
|
Filtering conditions. You can filter on recipent ID, recipient type, or reference ID.
|
Array of objects |
Yes |
|
List of conditions to apply with a logical
|
Array of objects |
No |
|
List of conditions to apply with a logical
|
Array of objects |
No |
|
Pagination information. Include if iterating over a paginated response. If omitted, the first page of results are returned. |
Object |
No |
|
Maximum number of results to return in the response. Valid values: 1–100. Default: 10. |
Integer |
No |
|
Identifies the next set of data to return from a previous response. Include if iterating over a paginated response. Set to null otherwise. |
String |
No |
Response
A successful response returns HTTP 200 OK
, along with the list of results that match the query.
On error, the response returns the appropriate HTTP status code and includes a response body with an Error object.
Response body example
The following example shows a successful response.
{
"successResults": [{
"recipients": [{
"type": "Unit",
"id": "amzn1.alexa.unit.did.101"
}],
"notification": {
"variants": [{
"type": "PersistentVisualAlert",
"content": {
"variants": [{
"type": "V0Template",
"values": [{
"locale": "en-US",
"document": {
"type": "Link",
"src": "doc://alexa/apl/documents/enterprise/notifications/persistentvisualalert/textWrappingTemplate"
},
"datasources": {
"displayText": {
"primaryText": "Example notification primary text.",
"secondaryText": "Example notification text."
},
"background": {
"backgroundImageSource": "https://www.example.com/image.jpg"
}
}
}]
}]
},
"dismissalTime": "2021-04-30T10:00:00.00Z"
}],
"referenceId": "example-ref-id-1 "
}
}],
"paginationContext": {
"nextToken": "someToken.2"
}
}
Response body parameters
Property | Description | Type |
---|---|---|
|
List of successful notification results. |
Array of objects |
|
Type of recipient. |
String |
|
Identifies the unit. |
String |
|
Describes the notification. |
Object |
|
List of notification variants. |
Array of objects |
|
Notification delivery type. |
String |
|
Content for the persistent visual alert. |
Content object |
|
Expiration date and time of the notification. |
String |
|
Reference ID of the notification. |
String |
|
Indicates whether there are more results to return. |
Object |
|
Included when the response is truncated. |
String |
HTTP status codes
Status | Description |
---|---|
|
Response body contains list of matched results. |
|
Indicates that one or more properties in the request body aren't valid. |
|
Request didn't include the authorization token, or the included token expired or isn't valid. Or, you don't have access to the resource. |
|
Indicates that the authorization token is valid, but the requested operation isn't allowed. |
|
Requested resource not found. |
|
Permitted rate limit, specified as the number of requests per unit of time, exceeded. You can retry the request by using exponential back-off. |
|
Error occurred on the server. You can retry the request by using exponential back-off. |
|
Server is down for maintenance, overloaded, or otherwise unavailable to handle the incoming request. |
Persistent visual alert templates
When you define a persistent visual alert, you include an APL template to define the data for the alert. You specify the template in the notification.variants[].content.variants[].values[].document.src
property of the Send notifications request body. Then set the fields for the template in the notification.variants[].content.variants[].values[].datasources
object.
About background images
For each of these templates, you can provide a background image with the background.backgroundImageSource
property. The template scales the image uniformly up or down to completely fill the screen ("best-fill"). As a result, if there is a mismatch between the aspect ratio of the image and the device screen, the image might get cut off.
For best results with images, consider the following recommendations:
- Avoid images with text that extends to the edges of the image, as this text might be truncated due to the scaling.
- If possible, test your images on the same device types used in your units.
- If separate units contain different devices, consider targeting the different units with separate persistent visual alerts so that you can optimize the images for the devices. This strategy works when all the devices in a given unit have the same aspect ratio.
- By default, the templates apply a scrim to the background image to make the text over the image easier to read. If the scrim makes the image too dark, you can turn it off by setting the
background.colorOverlay
property for the template tofalse
.
You can provide images in PNG or JPG format. The image files can't exceed 400 KB in size.
Text wrapping template data source
The text wrapping template has the following properties within the notification.variants[].content.variants[].values[].datasources
object.
Property name | Description | Type | Required? |
---|---|---|---|
|
URL for the attribution image to display. Provide either |
String |
No |
|
Attribution text displayed under the other text fields. Provide either |
String |
No |
|
URL for the background image. When choosing images, see the recommendations in About background images. |
String |
No |
|
When |
Boolean |
No, defaults to |
|
Header text displayed before all the other text fields. |
String |
No |
|
Hint text displayed at the bottom of the screen. |
String |
No |
|
Primary text to display. This text displays in a larger font than the rest of the text. |
String |
Yes |
|
Secondary text displayed under the primary text in a smaller font. |
String |
No |
|
Tertiary text displayed next to the secondary text. |
String |
No |
Media template data source
The media template has the following properties within the notification.variants[].content.variants[].values[].datasources
object.
Property name | Description | Type | Required? |
---|---|---|---|
|
URL for the attribution image to display. Provide either |
String |
No |
|
Attribution text displayed under the other text fields. Provide either |
String |
No |
|
URL for the background image. When choosing images, see the recommendations in About background images. |
String |
No |
|
When |
Boolean |
No, defaults to |
|
Header text displayed before all the other text fields. |
String |
No |
|
Hint text displayed at the bottom of the screen. |
String |
No |
|
Primary text to display. This text displays in a larger font than the rest of the text. |
String |
Yes |
|
Secondary text displayed under the primary text in a smaller font. |
String |
No |
|
Tertiary text displayed next to the secondary text. |
String |
No |
|
URL for the image thumbnail to display next to the text fields. |
String |
No |
Rating template data source
The rating template has the following properties within the notification.variants[].content.variants[].values[].datasources
object.
Property name | Description | Type | Required? |
---|---|---|---|
|
URL for the background image. When choosing images, see the recommendations in About background images. |
String |
No |
|
When |
Boolean |
No, defaults to |
|
Header text displayed before all the other text fields. |
String |
No |
|
Hint text displayed at the bottom of the screen. |
String |
No |
|
Primary text to display. This text displays in a larger font than the rest of the text. |
String |
Yes |
|
Number of stars for the rating. The rating number can be between one and five, and can include half stars, such as |
Number between one and five |
Yes |
|
Brief text to give context to the star rating. Must be fewer than eight characters. |
String |
Yes |
|
URL for the image thumbnail to display. |
String |
No |
Object definitions
The Notification API defines the following objects.
Content object
The Content
object defines the notification text or APL document. The specific fields for this object depend on the delivery type of notification that you set in the notification.variants[].type
property: DeviceNotification
, Announcement
, or PersistentVisualAlert
Property | Description | Type | Required |
---|---|---|---|
|
Locale-specific notification content. |
Array of objects |
Yes |
|
Type of content.
|
String |
Yes |
|
Notification content. Include for all notification types. |
Array of objects |
Yes |
|
Locale in which to render the spoken text, in BCP-47 format. The locale must include both the language and country or region, for example: |
String |
Yes |
|
Spoken text in plain text format. Include when the notification type is |
String |
No |
|
Defines the APL document to display. Include when the notification type is |
Object |
No |
|
Type of APL document to display. Include when the notification type is |
String |
No |
|
APL template to display. Include when the notification type is
|
String |
No |
|
Data for the specified |
Object |
No |
Error object
The Error
object defines the error type and message included in the response when an error occurs.
The following example shows the response body.
{
"type": "BAD_REQUEST",
"message": "The request is malformed or is missing any required parameters."
}
Property | Description | Type |
---|---|---|
|
Type of error that occurred. |
String |
|
Human-readable error message. The error message appears only for debugging and logging purposes. You must not share it with the customer. No business logic should depend on the content of the error message. |
String |
Related topics
Last updated: Dec 04, 2024