Amazon Simple Notification Service
Developer Guide

Application Event Notifications

Amazon SNS provides support to trigger notifications when certain application events occur. You can then take some programmatic action on that event. Your application must include support for a push notification service such as Apple Push Notification Service (APNS), Firebase Cloud Messaging (FCM), and Windows Push Notification Services (WNS). You set application event notifications using the Amazon SNS console, AWS CLI, or the AWS SDKs.

Available Application Events

Application event notifications track when individual platform endpoints are created, deleted, and updated, as well as delivery failures. The following are the attribute names for the application events.

Attribute Name Notification Trigger
EventEndpointCreated A new platform endpoint is added to your application.
EventEndpointDeleted Any platform endpoint associated with your application is deleted.
EventEndpointUpdated Any of the attributes of the platform endpoints associated with your application are changed.
EventDeliveryFailure A delivery to any of the platform endpoints associated with your application encounters a permanent failure.

Note

To track delivery failures on the platform application side, subscribe to message delivery status events for the application. For more information, see Using Amazon SNS Application Attributes for Message Delivery Status.

You can associate any attribute with an application which can then receive these event notifications.

Sending Mobile Push Notifications

To send application event notifications, you specify a topic to receive the notifications for each type of event. As Amazon SNS sends the notifications, the topic can route them to endpoints that will take programmatic action.

Important

High-volume applications will create a large number of application event notifications (e.g., tens of thousands), which will overwhelm endpoints meant for human use, such as email addresses, phone numbers, and mobile applications. Consider the following guidelines when you send application event notifications to a topic:

  • Each topic that receives notifications should contain only subscriptions for programmatic endpoints, such as HTTP or HTTPS endpoints, Amazon SQS queues, or AWS Lambda functions.

  • To reduce the amount of processing that is triggered by the notifications, limit each topic's subscriptions to a small number (e.g., five or fewer).

You can send application event notifications using the Amazon SNS console, the AWS Command Line Interface (AWS CLI), or the AWS SDKs.

AWS Management Console

  1. Sign in to the Amazon SNS console.

  2. On the navigation panel, choose Mobile, Push notifications.

  3. On the Mobile push notifications page, in the the Platform applications section, select an application and then choose Edit.

  4. Expand the Event notifications section.

  5. Choose Actions, Configure events.

  6. Enter the ARNs for topics to be used for the following events:

    • Endpoint Created

    • Endpoint Deleted

    • Endpoint Updated

    • Delivery Failure

  7. Choose Save changes.

AWS CLI

Run the set-platform-application-attributes command.

The following example sets the same Amazon SNS topic for all four application events:

aws sns set-platform-application-attributes --platform-application-arn arn:aws:sns:us-east-1:12345EXAMPLE:app/FCM/MyFCMPlatformApplication --attributes EventEndpointCreated="arn:aws:sns:us-east-1:12345EXAMPLE:MyFCMPlatformApplicationEvents", EventEndpointDeleted="arn:aws:sns:us-east-1:12345EXAMPLE:MyFCMPlatformApplicationEvents", EventEndpointUpdated="arn:aws:sns:us-east-1:12345EXAMPLE:MyFCMPlatformApplicationEvents", EventDeliveryFailure="arn:aws:sns:us-east-1:12345EXAMPLE:MyFCMPlatformApplicationEvents"

AWS SDKs

Call one of the following APIs, depending on your target programming language or platform: