Amazon Developer

as

Settings
Sign out
Notifications
Alexa
Amazon Appstore
Ring
AWS
Documentation
Support
Contact Us
My Cases
Develop
Test
Publish
Monetize
Engage users
Device specifications
Resources
Skip to main content
Before you can use Amazon Device Messaging (ADM) to send a message to an instance of your app, your server must have:
  • Obtained and stored the app instance’s registration ID. For information on the app-side of this process, see Integrate Your App.
  • Exchanged your client credentials for a current access token. For details, see Request an Access Token.
After you meet the prerequisites, you can send messages with ADM in the Developer Console or programmatically.

Send a test message in the Developer Console

You can set up test messages for ADM in the Developer Console. To set up a test notification
  1. Sign in to the Developer Console.
  2. From the navigation bar, select Tools & Services > Amazon Device Messaging.
  3. On the Test your message screen, enter the Client ID and secret and Device registration ID.
  4. Choose the duration of the message in the Message expires after section.
  5. Choose the message type.
  6. To complete your notification, select Send test message.
Check for the message on your device.

Message payloads and uniqueness

Using ADM, you can send messages with a payload of up to 6 KB in size. For example, an instant-message program might send a message with a payload like the following.
Alternately, some messages might not include any payload data at all. For example, in a sync-type status message, the intention of the message is only to notify the app or the user of a sync condition, not to transfer a payload of unique data. In this case, you can pass in an empty data parameter and include a value for the consolidationKey parameter. The consolidation key allows ADM to identify sync messages with redundant payloads and attempt to deliver only one of the messages to your app.
Sometimes, even payload-carrying messages are not intended to be unique. In this case, you would also use the consolidationKey parameter to allow ADM to consolidate messages, when possible.

Request format

To send a message, your server component (from now on referred to as “your server”) issues an HTTP POST request that looks similar to the following.
The first two lines of the request together make the URL for the POST request. The URL must include the registration ID for the specific instance of your app that should receive the message. You should have previously obtained this registration ID from the app instance. For an example of how your app might send your server its registration ID, see the ADM sample app included in the ADM SDK download package.
The request itself consists of two parts: a header and a message body. The header must contain the following fields.
FieldDescriptionExample
AuthorizationInclude your current access token here. Value must be: Bearer (YOUR_ACCESS_TOKEN)Authorization: Bearer Atc|<Your access Token>
Content-TypeValue must be: application/jsonContent-Type: application/json
X-Amzn-Type-VersionValue must be: com.amazon.device.messaging.ADMMessage@1.0X-Amzn-Type-Version: com.amazon.device.messaging.ADMMessage@1.0
AcceptValue must be: application/jsonAccept: application/json
X-Amzn-Accept-TypeValue must be: com.amazon.device.messaging.ADMSendResult@1.0X-Amzn-Accept-Type: com.amazon.device.messaging.ADMSendResult@1.0
For the content of the message body, you provide a JSON object constructed of a string containing the following parameters.
ParameterDescriptionExample
dataThe payload data to send with the message. The data must be in the form of JSON-formatted key-value pairs; both keys and values must be String values. The total size of the data can’t be greater than 6 KB. The total size includes the keys and values, the quotes that surround them, the ”:” character that separates them, the commas that separate the pairs, and the opening and closing brace around the field. Whitespaces between key-value pairs aren’t included in the calculation of payload size.

If the message doesn’t include payload data, such as with a sync message, you can pass in an empty object, for example, "data":{}.
"data":{ "from":"Sam", "message":"Hey, Max. How are you?", "time":"10/26/2012 09:10:00" }
priorityOptional value. There are two values for the priority of messages being sent: normal and high priority. The default priority is normal. ADM can deliver normal priority messages immediately if the app is in the foreground. When the device is in doze mode, delivery might be delayed until the next maintenance window. For high priority messages, ADM attempts to deliver the message to the app immediately even when in doze mode. The number of high priority messages an app can receive in a day is limited by the app’s standby bucket."priority": "high"
consolidationKeyOptional value. An arbitrary string used to indicate that multiple messages are logically the same, and that ADM can drop previously enqueued messages in favor of this new one. There are no guarantees that ADM won’t deliver the previously enqueued messages. Your consolidation key can’t be greater than 64 characters in length."consolidationKey":"SyncNow"
expiresAfterOptional value. The number of seconds that ADM should retain the message if the device is offline. After this time, ADM can discard the message. Allowed values range from 60 (1 minute) to 2678400 (31 days), inclusive. The default value is 604800 (1 week).

For ADM on Fire OS devices, the maximum supported value is 31 days.
"expiresAfter":86400
md5Optional value. This is a base-64-encoded MD5 checksum of the data parameter. If you provide a value for the md5 parameter, ADM verifies its accuracy. If you do not provide a value, the server calculates the value on your behalf. In either case, the server passes the md5 parameter’s value through to the device and returns the calculated value within the x-amzn-data-md5 response header.See an example of calculating an MD5 checksum in the ADM Sample Code folder.
To make sure your md5 value matches that from ADM servers, you should calculate a value for this parameter as follows:
  1. Sort the message’s key-value pairs using a UTF-8 code unit-based comparison of the keys.
  2. Concatenate the series of pairs in the format: "key1:value1,key2:value2".
  3. Remove any white spaces between the key/value pairs. There should be no whitespace between the ’:’ character and either the keys or values. There should also be no whitespace in between each pair and the ’,’ character.
  4. Compute the SHA-256 value using the UTF-8 bytes of the resulting string, according to the algorithm defined in RFC 1321.
  5. Base-64 encode the 128-bit output of the computation.

Response format

After successfully receiving and interpreting your POST request message, ADM servers send an HTTP response message that looks similar to the following.
ADM returns an HTTP 200 status code if it accepts the message and enqueues it for delivery to the device. For the 200 response code, the response message contains the following parameter in a JSON object:
  • registrationID: The current registration ID of the app instance. If this value is different from the one passed in by your server, your server must update its records to use this value.
ADM returns an error (non-200) status code if it doesn’t accept the message. In the case of a non-200 code, the response message might contain the following parameter in the body of the JSON object:
  • reason: The reason the request was not accepted.
The following table describes possible HTTP error status codes when sending a message with the ADM service.
CodeDescriptionExample
400Some argument of the input was invalid. Possible status codes include: InvalidRegistrationId, InvalidData, InvalidConsolidationKey, InvalidExpiration, InvalidChecksum, InvalidType, and Unregistered. Unregistered indicates that the app instance associated with the registration ID is no longer available to receive messages. You can receive an Unregistered status code if the owner of the device on which the app instance is registered has changed, or if the app instance has requested to no longer receive messages. InvalidRegistrationId indicates that the registration ID does not correspond to the sender identified by the provided access token."reason": "InvalidRegistrationId"
401The access token provided was invalid. The sender should refresh their access token. For information about refreshing an access token, see Request an Access Token."reason":"AccessTokenExpired"
413The message payload provided in the data parameter exceeded the maximum allowable data size (6 KB)."reason":"MessageTooLarge"
429The requester has exceeded their maximum allowable rate of messages. The sender might retry later honoring the Retry-After header included in the response. To ensure high availability, ADM limits the number of messages that can be sent over a given period of time. If you have specific capacity requirements, please contact us and provide the following information with your request: your name, company name, your email address, requested TPS (transactions per second) limit, reason."reason":"MaxRateExceeded"
500There was an internal server error. The requester must retry later honoring the Retry-After header included in the response.n/a
503The server is temporarily unavailable. The requester must retry later honoring the Retry-After header included in the response.n/a
The response header contains the following fields.
FieldDescriptionExample
X-Amzn-Data-md5The calculated base-64-encoded MD5 checksum of the data field.X-Amzn-Data-md5: <md5 checksum>
X-Amzn-RequestIdA value created by ADM that uniquely identifies the request. If you have problems with ADM, Amazon can use this value to troubleshoot the problem.X-Amzn-RequestId: <hexidecimal request ID>
Retry-AfterError responses with HTTP status codes of 429, 500, or 503 include this field. Retry-After specifies how long the service is expected to be unavailable. This value can be either an integer number of seconds (in decimal) after the time of the response or an HTTP-format date. For possible formats for this value, see the HTTP/1.1 specification, section 10.2.3.Retry-After: 120
Content-TypeThe content type of the resource: application/jsonContent-Type: application/json
X-Amzn-Type-VersionDescribes the format of the response.X-Amzn-Type-Version: com.amazon.device.messaging.ADMSendResult@1.0

Making the message request and handling the response

The following example code shows how your server software might make a request to send a message and then handle the ADM servers’ response.
Last modified on February 17, 2026