Real-Time Notifications Examples
This page provides example Real-Time Notifications JSON responses to your HTTPS endpoint for subscriptions, consumables, and entitlements.
Confirmation message
When you register or change an endpoint, Amazon sends a confirmation message containing a confirmation token to that endpoint. To confirm the endpoint, copy the value of the Token field from this message and paste it into the Confirmation token field in the Developer Console. For details, see Use Real-Time Notifications.
The following example shows a confirmation message. The Token field holds the value you paste into the console.
{
"Type": "SubscriptionConfirmation",
"MessageId": "11111111-2222-3333-4444-555555555555",
"Token": "EXAMPLETOKEN2336412f37fb687f5d51e6e2425929f524e04858e6aba4a192cef9fcc377a4cc",
"TopicArn": "arn:aws:sns:us-east-1:123456789012:ExampleTopic",
"Message": "You have chosen to subscribe to the topic arn:aws:sns:us-east-1:123456789012:ExampleTopic.\nTo confirm the subscription, visit the SubscribeURL included in this message.",
"SubscribeURL": "https://sns.us-east-1.amazonaws.com/?Action=ConfirmSubscription&TopicArn=arn:aws:sns:us-east-1:123456789012:ExampleTopic&Token=EXAMPLETOKEN2336412f37fb687f5d51e6e2425929f524e04858e6aba4a192cef9fcc377a4cc",
"Timestamp": "2026-09-09T16:00:38.561Z",
"SignatureVersion": "1",
"Signature": "EXAMPLEsignatureBMRl6XMoQUbt0Pi6O69Bh7Ega1+wxWxVHOzPNH0gSsNfOHiv1aBbLy0HAC=",
"SigningCertURL": "https://sns.us-east-1.amazonaws.com/SimpleNotificationService-EXAMPLE.pem"
}
Message field text instructs you to visit the SubscribeURL, but to authenticate your endpoint, you must enter the Token value in the Developer Console.The confirmation message differs from the notification messages that follow. The samples in the rest of this page show notification messages, not the confirmation message.
Subscription
In this example, a customer creates a new subscription for your app and you receive a SUBSCRIPTION_PURCHASED Real-Time Notification.
{
"Type" : "Notification",
"MessageId" : "b1c4d9bb-0fd9-54b2-8f74-8e59c91e396a",
"TopicArn" : "arn:aws:sns:us-east-1:033616359524:LT0XA",
"Message" : "{\"appPackageName\":\"com.example.amazonsdkapivalidator3\",\"notificationType\":\"SUBSCRIPTION_PURCHASED\",\"appUserId\":\"io9oFdzmCSMuKk_pp9pYccoIHRfc6kSAAYaNo51xZrg=\",\"receiptId\":\"koxIn_LO2u7rc-_MF40hKz1vqSSJSlitfTNDeH_JAs8=:3:11\",\"relatedReceipts\":{},\"timestamp\":1600701569824,\"betaProductTransaction\":false}",
"Timestamp" : "2020-09-21T15:19:35.686Z",
"SignatureVersion" : "1",
"Signature" : "EXAMPLEab123...",
"SigningCertURL" : "https://sns.us-east-1.amazonaws.com/SimpleNotificationService-a86cb10b4e1f29c941702d737128f7b6.pem",
"UnsubscribeURL" : "https://sns.us-east-1.amazonaws.com/?Action=Unsubscribe&SubscriptionArn=arn:aws:sns:us-east-1:033616359524:LT0XA:a745747c-8230-4cd2-84c6-d0e7df9f1ca1"
}
Consumable
In this example, a customer buys a consumable from your app and you receive a CONSUMABLE_PURCHASED Real-Time Notification.
{
"Type" : "Notification",
"MessageId" : "22b80b92-fdea-4c2c-8f9d-bdfb0c7bf324",
"TopicArn" : "arn:aws:sns:us-west-2:123456789012:MyTopic",
"Message": "{\"receiptId\":\"bsw3Wi6w17Ngdabggckh61kmmFhfwlfT9nPZeLfh83k=:1:11+Sheet2!A1+\",\"relatedReceipts\": {},\"appUserId\":\"kyplB1fdRX1m6/GNAVW0l6jv9Nl1V/GemSopKBHM84w=\",\"notificationType\":\"CONSUMABLE_PURCHASED\",\"appPackageName\":\"com.playrix.gardenscapes.amazon\",\"timestamp\":1588086967189, \"betaProductTransaction\":false,}",
"Timestamp" : "2012-05-02T00:54:06.655Z",
"SignatureVersion" : "1",
"Signature" : "EXAMPLEw6JRN...",
"SigningCertURL" : "https://sns.us-west-2.amazonaws.com/SimpleNotificationService-f3ecfb7224c7233fe7bb5f59f96de52f.pem",
"UnsubscribeURL" : "UnsubscribeUrl"
}
Entitlement
In this example, a customer buys an entitlement from your app and you receive an ENTITLEMENT_PURCHASED Real-Time Notification.
{
"Type" : "Notification",
"MessageId" : "22b80b92-fdea-4c2c-8f9d-bdfb0c7bf324",
"TopicArn" : "arn:aws:sns:us-west-2:123456789012:MyTopic",
"Message": "{\"receiptId\":\"bsw3Wi6w17Ngdabggckh61kmmFhfwlfT9nPZeLfh83k=:1:11+Sheet2!A1+\",\"relatedReceipts\": {},\"appUserId\":\"kyplB1fdRX1m6/GNAVW0l6jv9Nl1V/GemSopKBHM84w=\",\"notificationType\":\"ENTITLEMENT_PURCHASED\",\"appPackageName\":\"com.playrix.gardenscapes.amazon\",\"timestamp\":1588086967189, \"betaProductTransaction\":false,}",
"Timestamp" : "2012-05-02T00:54:06.655Z",
"SignatureVersion" : "1",
"Signature" : "EXAMPLEw6JRN...",
"SigningCertURL" : "https://sns.us-west-2.amazonaws.com/SimpleNotificationService-f3ecfb7224c7233fe7bb5f59f96de52f.pem",
"UnsubscribeURL" : "UnsubscribeUrl"
}
Duplicate notifications
Generally, each Real-Time Notification is delivered to each specified endpoint once. However, the distributed nature of Amazon SNS and transient network conditions can cause an occasional duplicate message. Make sure to design the application so that duplicate notification messages do not create any errors or inconsistencies.
Example code with Amazon AWS SDK
AWS reference documentation:
- Amazon AWS SDK
- Example Code Pointer
- Code Deep Dive Section
- AWS region: us-east-1
public class SnsServletProcessor implements HttpServletProcessor {
private final SnsMessageManager messageParser = new SnsMessageManager("us-east-1");
@Override
public void process(HttpServletRequest httpRequest, HttpServletResponse httpResponse) throws IOException {
messageParser.handleMessage(httpRequest.getInputStream(), new DefaultSnsMessageHandler() {
@Override
public void handle(SnsNotification snsNotification) {
// Business logic to process the notification message
}
};
}
}
Last updated: Oct 08, 2026

