Overview

Skill Level: Any

Creating silent notifications as data notification, in-app messages, or inbox messages.

Prerequisites

None

The payload and the alert key

A silent notification can be either a data notification, an in-app message, or an inbox message. IBM recommends that you do not use the alert key in the payload. If the alert key is sent in the payload, the message shows up on the device’s screen.

Tip: The content-available flag is ignored if the alert key is set, but the flag is required to process a notification in the background. Data notifications need to include the content-available flag, but the alert key without background processing should not include it. If you send a notification from the Watson Campaign Automation user interface, the content-available and alert flags are set automatically for you based on the type of message you send.

Limitations with iOS 10 – 11.2

Silent notifications deliver correctly to iOS 8 and iOS 9, however due to an internal iOS issue, they do not work after a device is reboot on iOS 10 and do not work at all on iOS 11.0 and iOS 11.1 This issue was corrected in iOS 11.2 and content-available silent notifications deliver on later versions as expected.

Step-by-step

  1. Use content-available in your payload without the alert key. The following example code shows how to use this:

    {"aps":{"content-available":1}, "otherkeyshere":"othervalueshere"}
  2. Enter values for otherkeyshere and othervalues.

    These values include the items that you want to send to your mobile app.

  3. Use the template in Watson Campaign Automation

    By using an unmodified data notification template in  Watson Campaign Automation, you get a notification that looks like the following payload:

    {
    aps = {
    "content-available" = 1;
    };
    data = {
    "sample type" = {
    title = "Welcome to NYC";
    };
    };
    mce = {
    attribution = "Test Push with Data campaign";
    };
    }

Expected outcome

Example:

If you want to send a silent mobile app message to tell your mobile app to sync data, you can add the following code:

{"aps":{"content-available":1}, "action":"sync"}

Then, in the app, you can hardcode your mobile app to look for the action key and the sync value. When this is received, you can initiate a sync operation.

For information about other mobile app message features, see the Documentation.

Go Back to the Mobile App Messaging home page.

Join The Discussion

Your email address will not be published. Required fields are marked *