Sometimes you may need to check the notification payload to perform specific activities based on values of specific payload parameters. Below you can find the examples of received push messages with a description of most common payload parameters.
/createMessage JSON example
{
"request": {
"application": "XXXXX-XXXXX",
"auth": "xxx",
"notifications": [{
"send_date": "now",
"ignore_user_timezone": true,
"content": "hello world",
"rich_media": "1E23F-EDCD6",
"link": "http://google.com",
"data": {
"key": "value"
},
"android_root_params": {
"pw_channel": "value"
},
"android_sound": "soundfile",
"android_header": "header",
"android_icon": "icon",
"android_custom_icon": "http://example.com/image.png",
"android_banner": "http://example.com/banner.png",
"android_badges": 5,
"android_gcm_ttl": 3600,
"android_vibration": 0,
"android_led": "#FF0000",
"android_priority": 2,
"android_delivery_priority": "high",
"android_ibc": "red",
"android_silent": 1,
"ios_badges": 5,
"ios_sound": "sound file.wav",
"ios_ttl": 3600,
"ios_silent": 0,
"ios_category_id": "1",
"ios_root_params": {
"aps": {
"content-available": "0",
"mutable-content": 1
},
"attachment": "YOUR_ATTACHMENT_URL",
"data": "qwe"
},
"apns_trim_content": 1,
"ios_trim_content": 1,
"ios_title": "Title",
"ios_subtitle": "SubTitle"
}]
}
}
Resulting Android Payload
{
"pw_channel": "value",
"pw_silent": "1",
"google.delivered_priority": "high",
"google.sent_time": 1544509239183,
"google.ttl": 3600,
"google.original_priority": "high",
"onStart": true,
"header": "header",
"pw_msg": "1",
"b": "http:\/\/example.com\/banner.png",
"i": "icon",
"l": "https:\/\/goo.gl\/mR2d",
"p": "3!f",
"s": "soundfile",
"userdata": {
"key": "value"
},
"u": "{\"key\":\"value\"}",
"ci": "http:\/\/example.com\/image.png",
"rm": "{\"url\":\"https:\/\/richmedia.pushwoosh.com\/1\/E\/1E23F-EDCD6.zip\",\"ts\":\"1542707958\"}",
"ibc": "red",
"led": "#ff0000",
"pri": "2",
"vib": "0",
"google.message_id": "0:1544509239186745%e526a97af9fd7ecd",
"pw_badges": "5",
"foreground": false
}
Android Payload Description:
- "android_root_params" content is sent out of an object, just as regular keys in PushMessage object.
- "pw_silent" indicates that a push should be received silently and without a banner
- "google.delivered_priority" stands for FCM delivery priority (high or normal) with which a device has received a message
- "google.sent_time" is the time FCM has sent this message
- "google.ttl" is a "time to live" of this notification - if a message is not delivered during this period, it will never be delivered at all
- "google.original_priority" stands for FCM delivery priority specified while sending a push
- "onStart" is a boolean value, true if the app was launched in response to a push
- "header" is a notification header
- "pw_msg": 1 indicates that a push was received from Pushwoosh and not from any other push provider
- "b" is a link to a notification banner
- "i" is a name of an icon used in a generated notification. This icon should be stored in your application bundle
- "l" is an URL specified when sending a push
- "p" is so-called message hash. This value is used internally by Pushwoosh SDK for statistics reporting
- "s" is a key for a sound file
- "userdata" (or "u") is a value of your custom data sent with "data" object or specified as "Custom data" in Action tab when sending a push from Pushwoosh Control Panel.
- "ci" contains an URL to a custom notification icon
- "rm" is used to pass Rich Media data, such as a link to download it ("url" key) and its timestamp ("ts")
- "ibc" is background color for your notification icon
- "led" is a hex code for LED color
- "pri" key carries Notification Importance
- "vib" boolean parameter indicates whether device should vibrate when a push is received
- "google.message_id" is an FCM notification ID
- "pw_badges" allow you to specify an application badge number
- "foreground": true indicates that a push was received when your app was in foreground
Resulting iOS Payload
{
aps = {
alert = {
body = "hello world";
subtitle = SubTitle;
title = Title;
};
badge = 5;
category = 1;
"content-available" = 0;
"mutable-content" = 1;
sound = "sound file.wav";
};
attachment = "YOUR_ATTACHMENT_URL";
data = qwe;
l = "https://goo.gl/mR2d";
p = "3!f";
rm = {
ts = 1542707958;
url = "https://richmedia.pushwoosh.com/1/E/1E23F-EDCD6.zip";
};
u = "{\"key\":\"value\"}";
}
iOS Payload Description:
- aps dictionary. This dictionary contains all system-level information about the push. alert object has body, title and subtitle keys which stand for notification message, header and subtitle correspondingly. It also can contain device badge number, iOS Category ID, sound file and content-available and mutable-content keys.
- attachment is an URL for your iOS 10+ Media Attachment
- data key stands for data passed within "ios_root_params" object
- l (or link) stands for an external URL to open when a push is clicked
- p is a message hash
- rm is a Rich Media-related object, contains an url to download Rich Media and its timestamp
- u is your custom data sent with "data" object or specified as "Custom data" in Action tab when sending a push from Pushwoosh Control Panel.
Comments
0 comments
Please sign in to leave a comment.