Progress will discontinue Telerik Platform on May 10th, 2018. Learn more

Constructing a Notification Object

Constructing a Notification Object

Unless you want to send a basic generic message to all registered devices, you need to construct a JSON notification object to pass as a payload to the send request.

You can include the following sections in the push notification object:

  • Filter expression: The Filter option is a generic field that allows you to target a subset (segment) of your devices with the push notification. For detailed discussion of filters and targeting, see Targeting Push Notifications.
  • Generic options: Options that apply to all types of devices. Push Notification Object Field Reference provides a list of all supported generic options.
  • Vendor-specific options: Options that apply only to certain devices such as iOS or Android. Push Notification Object Field Reference provides a list of all supported vendor-specific options.

The next JSON object includes all three sections: Filter, the UseLocalTime generic option, and a section for each supported device vendor:

{
    "Filter": "{\"Parameters.City\":\"London\"}",
    "UseLocalTime": true,
    "Android": {
        "data": {
            "title": "Push Title",
            "message": "Push message for Android",
            "customData": "Custom data for Android"
        }
    },
    "IOS": {
        "aps": {
            "alert": "Push message for iOS",
            "badge": "+1",
            "sound": "default",
            "category": "MY_CATEGORY"
        },
        "customData": "Custom data for iOS"
    },
    "WindowsPhone": {
        "Toast": {
            "Title": "Push title",
            "Message": "Push message for Windows Phone"
        }
    },
    "Windows": {
        "Toast": {
            "template": "ToastText01",
            "text": ["Push message for Windows"]
        }
    }
}

Telerik Platform uses the information to send the appropriate push notification to each targeted device. If you fail to specify options for a given vendor, its devices are served from the generic options. For example the next object sends a generic message to all devices except for iOS devices. Note that in this case the Message option is required.

{
    "Message": "This text will appear on all devices except for iOS devices"
    "IOS": {
        "aps": {
            "alert": "This text will override the generic Message on iOS",
            "badge": "+1",
            "sound": "default",
            "category": "MY_CATEGORY"
        },
        "customData": "Custom data for iOS"
    }
}

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.