Silent data push notification

Silent data push notifications allow for the delivery of data payloads silently to your app without notifying the app user with an alert. These notifications are typically used to trigger actions or deliver information to the app.
Another common use for a silent data push notification is to determine whether your app is still installed on devices.
In the following information and examples, we assume you want to verify your app is still installed on the user device by sending a silent data push notification.

📘

Note:

Install/uninstall status is maintained by the Campaign service automatically. You can see the uninstalls in the mobile reports, and if you subscribe to mobile events in Exchange, you can consume the uninstall events and store device and contact status in your data source.
The push payload examples below can be easily adapted to support other silent data push cases.

iOS allows you to create silent data notifications that can trigger background app actions but requires that the alert key not be set.

The payload and the alert key

Data notifications require the inclusion of the content-available flag in the payload to process a data notification silently. They also require the exclusion of the alert key. If the alert key is set, the push will be visible, and the push will also be passed to didReceiveRemoteNotification: in the app delegate for data handling. Therefore, a silent data notification should not include the alert key.

Sending silent data push notifications to entire app keys

You can send a silent data push payload to all devices within an app key using this example.

  1. Send the following payload using our /channels/push/sendjobs REST API:
    
    
    { "appKeys": ["gc4bH3K3aj", "apNNMhxI4l"], "contactSourceId": "70897", "campaignName": "UninstallPulse", "messageName": "UninstallPulse", "content": { "simple": { "apns": { "aps": { "content-available": "1" }, "action": "pulse" }, "gcm": { "action": "pulse" } } } }

    where:

    • appKeys is an array of one or more of your app keys.
    • contactSourceId is your mobile push-enabled database ID.
    • campaignName is the value used in the mobile reports to view campaigns.
    • messageName is a unique name for this specific push campaign. The system will reject the payload if this value is not unique. When using automation, a safe approach to message naming is to use a timestamp as all or part of a message name.

  2. The /channels/push/sendjobs API allows you to send a payload to one or more app keys in an org. So all installed devices will be seen as valid by the service providers (FCM, APNS), and the service providers will report uninstalled devices to the Campaign service.
  3. The "action": "pulse" key:value is arbitrary. It is not used constructively by the SDK in this example. If you were sending a silent data push with a purpose other than detecting uninstalled devices, you would pass a valid data payload that the app would use to trigger some action.
  4. Finally, the next day you can create a query to return all contacts that have received an uninstall event in the last 24 hours, export the data, and then use this list to create a GDPR Erasure job to purge all uninstalled devices. For more information on the GDPR Erasure support in Campaign, see:

Sending silent data push notifications to individual devices

You can send a silent data push payload to listed devices within app keys using this example.

  1. Send the following payload using our /channels/push/sends REST API:
    
    
    { "channelQualifiers": ["apNNMhxI4l"], "content": { "simple": { "apns": { "aps": { "content-available": "1" }, "action": "pulse" }, "gcm": { "action": "pulse" } } }, "contacts": [{ "channel": { "qualifier": "apNNMhxI4l", "destination": "krf3Rw7O4pPhVlJs|kuNFndJs" } }, { "channel": { "qualifier": " apNNMhxI4l", "destination": "ZlqX5IV9dIHzCxII|PEO1O6jr" } } ], "campaignName": "Test Push Notifications" }

    where:

    • channelQualifiers is an array of one or more of your app keys.
    • contacts->channel->qualifier is the app key for the destination device listed.
    • contacts->channel->destination is the device mobile user id | channel id.

    This API supports sending a payload to multiple devices. You can batch dozens or even hundreds of devices to receive this single push payload by listing each under the "contacts" structure.

  2. The /channels/push/sends API allows you to send a payload to one or more devices in one or more app keys in an org.
  3. The "action": "pulse" key:value is arbitrary. The SDK does not use it in this example. If you were sending a silent data push with a purpose other than detecting uninstalled devices, you would pass an actual data payload that the app would use to trigger something.
  4. Finally, the next day you can create a query to return all contacts that have received an uninstall event in the last 24 hours, export the data, and then use this list to create a GDPR Erasure job to purge all uninstalled devices. For more information on the GDPR Erasure support in Campaign, see

Limitations with iOS 10 - 11.2

Due to an internal iOS issue, content-available:1 push notifications do not work after a device is rebooted on iOS 10 and do not work on iOS 11.0 and iOS 11.1. The issue was corrected in iOS 11.2.
Content-available silent data notifications deliver on later versions as expected.

You can create a notification with any content you specify; however, make sure not to have the alert element in the notification. In the following example, the alert element is left out, and therefore it triggers a silent push.

If a push notification with no alert element is sent, the push notification is not displayed. In the app, you must override or modify the onMessage: method to take the action you want when the silent data notification is received.

The payload and the alert key

Data notifications require that the alert key be excluded in the payload to process a data notification silently. If the alert key is set, the push will be visible. Therefore, a silent data notification should not include the alert key.

Sending silent data push notifications to entire app keys

You can send a silent data push payload to all devices within an app key using this example.

  1. Send the following payload using our /channels/push/sendjobs REST API:
    
    
    { "appKeys": ["gc4bH3K3aj"], "contactSourceId": "70897", "campaignName": "UninstallPulse", "messageName": "UninstallPulse", "content": { "simple": { "gcm": { "action": "pulse" } } } }

    Where:

    • appKeys is an array of one or more of your app keys.
    • contactSourceId is your mobile push-enabled database ID.
    • campaignName is the value used in the mobile reports to view campaigns.
    • messageName is a unique name for this specific push campaign. The system will reject the payload if this value is not unique. When using automation, a safe approach to message naming is to use a timestamp as all or part of a message name.

  2. The /channels/push/sendjobs API allows you to send a payload to one or more app keys in an org. So all installed devices will be seen as valid by the service providers (FCM, APNS) and the service providers will report uninstalled devices to the Campaign service.
  3. The "action": "pulse" key:value is arbitrary. It is not used constructively by the SDK in this example. If you were sending a silent data push with a purpose other than detecting uninstalled devices, you would pass a valid data payload that the app would use to trigger some action.
  4. Finally, the next day you can create a query to return all contacts that have received an uninstall event in the last 24 hours, export the data, and then use this list to create a GDPR Erasure job to purge all uninstalled devices. For more information on the GDPR Erasure support in Campaign, see:

Sending silent data push notifications to individual devices

You can send a silent data push payload to listed devices within app keys using this example.

  1. Send the following payload using our /channels/push/sends REST API:
    
    
    { "channelQualifiers": ["gc4bH3K3aj"], "content": { "simple": { "gcm": { "action": "pulse" } } }, "contacts": [{ "channel": { "qualifier": " gc4bH3K3aj", "destination": "krf3Rw7O4pPhVlJs|kuNFndJs" } }, { "channel": { "qualifier": " gc4bH3K3aj", "destination": "ZlqX5IV9dIHzCxII|PEO1O6jr" } } ], "campaignName": "Test Push Notifications" }

    where:

    • channelQualifiers is an array of one or more of your app keys.
    • contacts->channel->qualifier is the app key for the destination device listed.
    • contacts->channel->destination is the device mobile user id | channel id.

    This API support sending a payload to multiple devices. You can batch dozens or even hundreds of devices to receive this single push payload by listing each under the "contacts" structure.

  2. The /channels/push/sends API allows you to send a payload to one or more devices in one or more app keys in an org.
  3. The "action": "pulse" key:value is arbitrary. The SDK does not use it in this example. If you were sending a silent data push with a purpose other than detecting uninstalled devices, you would pass an actual data payload that the app would use to trigger something.
  4. Finally, the next day you can create a query to return all contacts that have received an uninstall event in the last 24 hours, export the data, and then use this list to create a GDPR Erasure job to purge all uninstalled devices. For more information on the GDPR Erasure support in Campaign, see:

Sending silent data push notifications to iOS and Android app keys

A more common use case would be sending a silent push data notification to your production iOS and Android app keys at the same time using the /channels/push/sendjobs API.

  1. This payload allows you to send one payload and send the uninstall pulse push to all production devices, both Android and iOS:
1.	{
  "appKeys": ["gc4bH3K3aj", "apNNMhxI4l"],
  "contactSourceId": "70897",
  "campaignName": "UninstallPulse",
  "messageName": "UninstallPulse",
  "content": {
    "simple": {
      "apns": {
        "aps": {
          "content-available": "1"
        },
        "action": "pulse"
      },
      "gcm": {
        "action": "pulse"
      }
    }
  }
}

where:

  • appKeys is an array of one or more of your app keys.
  • contactSourceId is your mobile push-enabled database ID.
  • campaignName is the value used in the mobile reports to view campaigns.
  • messageName is a unique name for this specific push campaign. The system will reject the payload if this value is not unique. When using automation, a safe approach to message naming is to use a timestamp as all or part of a message name.
  1. The /channels/push/sendjobs API allows you to send a payload to one or more app keys in an org. So all installed devices will be seen as valid by the service providers (FCM, APNS), and the service providers will report uninstalled devices to the Campaign service.
  2. The "action": "pulse" key:value is arbitrary. It is not used constructively by the SDK in this example. If you were sending a silent data push with a purpose other than detecting uninstalled devices, you would pass a valid data payload that the app would use to trigger some action.
  3. Finally, the next day you can create a query to return all contacts that have received an uninstall event in the last 24 hours, export the data, and then use this list to create a GDPR Erasure job to purge all uninstalled devices. For more information on the GDPR Erasure support in Campaign, see: