Payload Customization

Introduction

To support different push platform engines an template engine system is needed which provide the transformation of a common push message into the platform target format. The data exchange format uses the json format so the template engine must support json to json transformation like XSLT for XML.

Push template engine jolt

The template engine uses the jolt project to provide a common transfrom DSL see:

Example

Input JSON
{
    "title": "Example message",
    "message": "Hello, World!",
    "articleId": "123",
    "url": "http://test.de/123",
    "pushID": "1234567"
}
Transform template JSON
[
    {
        "operation": "shift",
        "spec": {
            "title": "customFields.title",
            "message": "customFields.subtitle",
            "url": "customFields.url",
            "articleId": "collapseKey",
            "pushID": "customFields.pushId"
        }
    },
    {
        "operation": "default",
        "spec": {
            "delayWhileIdle": "false",
            "timeToLive": "1800",
            "customFields": {
                "feedId": "feed.1",
                "regId": "123"
            }
        }
    }
]
Result JSON
{
  "collapseKey" : "123",
  "customFields" : {
    "feedId" : "http://test.de/feed/1",
    "pushId" : "1234567",
    "regId" : "123",
    "subtitle" : "message",
    "title" : "title",
    "url" : "http://test.de/123"
  },
  "delayWhileIdle" : "false",
  "timeToLive" : "1800"
}

Example Android json input format

Push format JSON
{
    "collapseKey": "123",      (1)
    "delayWhileIdle": "false", (2)
    "timeToLive": "1800",      (3)
    "customFields": {          (4)
        "field1": "value1",
        "field2": "value2",
        "fieldX": "valueX"
    }
}
1 GCM setting collapseKey
2 GCM setting delayWhileIdle
3 GCM setting timeToLive
4 entry point for custom fields
The Server Key obtained from GCM should be configured in App→ API Key

Example IOS push input format

For the alert, two different fields can be used: alert and alertObj. Here alert will in fact set only the alert body text, where alertObj can have title and body text specified. Only one of the two should be used. The silent flag is optional.

Push format JSON
{
    "alert": "title",        (1)
    "alertObj": {            (2)
        "title": "alert title",
        "body": "alert body"
    },
    "badge": "0",            (3)
    "sound": "default",      (4)
    "silent": true,          (5)
    "rich": true,            (6)
    "customFields": {        (7)
        "field1": "value1",
        "field2": "value2",
        "fieldX": "valueX"
    }
}
1 APNS setting alert message
2 APNS setting alert title and message
3 APNS setting badge
4 APNS setting sound
5 APNS setting content-available (optional)
6 APNS setting mutable-content (optional)
7 entry point for custom fields
The Keystore(Certificate)/Key(Token) obtained from APNS should be configured in App→ Keystore(Certificate)/Key(Token)

Example Firebase push input format

Push format JSON
{
    "collapseKey": "123",      (1)
    "delayWhileIdle": "false", (2)
    "timeToLive": "1800",      (3)
    "customFields": {          (4)
        "field1": "value1",
        "field2": "value2",
        "fieldX": "valueX"
    }
}
1 FCM setting collapseKey
2 FCM setting delayWhileIdle
3 FCM setting timeToLive
4 entry point for custom fields
The Server Key obtained from FCM should be configured in App→ Server Key