Best practices for managing Amazon SNS mobile push notifications
This section describes best practices that might help you improve your customer engagement.
Endpoint management
Delivery issues might occur in situations were device tokens change due to a user’s
action on the device (for example, an app is re-installed on the device), or certificate updates
Since the device token won’t change each time an app is opened by a user, the
idempotent CreatePlatformEndpoint
API can be used. However, this can
introduce duplicates for the same device in cases where the token itself is invalid, or
if the endpoint is valid but disabled (for example, a mismatch of production and sandbox
environments).
A device token management mechanism such as the one in the pseudo code can be used.
For information on managing and maintaining FCM v1 device tokens, see Amazon SNS management of Firebase Cloud Messaging endpoints.
Delivery status logging
To monitor push notification delivery status, we recommended you enable delivery
status logging for your Amazon SNS platform application. This helps you troubleshoot delivery
failures because the logs contain provider response
codes returned from the push platform service. For details on enabling
delivery status logging, see How do I access Amazon SNS topic delivery logs for push notifications?
Event notifications
For managing endpoints in an event driven fashion, you can make use of the event notifications functionality. This allows the configured Amazon SNS topic to fanout events to the subscribers such as a Lambda function, for platform application events of endpoint creation, deletion, updates, and delivery failures.