• How to Programmatically Read Information for Failed Push Notifications

How to Programmatically Read Information for Failed Push Notifications

Environment

Service Notifications (Backend Services)
Feature Push Notifications

Description

You need to programmatically track the status and feedback for the sent push notifications and optionally, take action in case of failed push notifications.

Solution

The following steps illustrate how to check the status for a push notification and in case of failed notifications, examine the logged feedback information for them.

  1. Request a push notification entry using the means explained in Reading Push Notifications. For example, you can fetch all notifications that failed to be sent to more than 0 devices using the following filter.

    X-Everlive-Filter: { "Feedback.Failed": { "$gt": 0}} 
    
  2. Observe the returned Feedback object - it will contain a breakdown for each platform for the received from the vendor servers feedback for the given notification. For example, the following notification was sent to 8 iOS devices but failed for 1 device.

    {
        "Feedback":{
            "1":{
                "Sent":0,
                "Deactivated":0,
                "Failed":0
            },
            "2":{
                "Sent":0,
                "Deactivated":0,
                "Failed":0
            },
            "3":{
                "Sent":0,
                "Deactivated":0,
                "Failed":0
            },
            "4":{
                "Sent":8,
                "Deactivated":0,
                "Failed":1
            }
        }
    }
    
  3. To get the information for the failed notification:

  4. (Optional) Depending on the reason for the failed push notifications you can either troubleshoot and try to eliminate the reason for the failure or resend the notification to the failed devices as explained here.

Notes

You can read more information about the device platform types here.

You can read more information about the status field of a notification in the System set fields section here.

See Also

Start a free trial Request a demo
Contact us: +1-888-365-2779
sales@telerik.com
Copyright © 2016-2017, Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.