You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 4, 2020. It is now read-only.
Copy file name to clipboardExpand all lines: docs/PAYLOAD.md
+47-2Lines changed: 47 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -966,6 +966,51 @@ You will get an inbox view so you can display multiple notifications in a single
966
966
967
967
If you use `%n%` in the `summaryText` of the JSON coming down from FCM it will be replaced by the number of messages that are currently in the queue.
968
968
969
+
By default, inbox notifications are ordered in descending order (last notification is displayed first). You can use the `inbox-order` parameter to change the order to ascending:
970
+
971
+
```json
972
+
{
973
+
"registration_ids": ["my device id"],
974
+
"data": {
975
+
"title": "My Title",
976
+
"message": "My first message",
977
+
"style": "inbox",
978
+
"inbox-order": "asc",
979
+
"summaryText": "There are %n% notifications"
980
+
}
981
+
}
982
+
```
983
+
984
+
Here is an example using fcm-node that sends the above JSON:
985
+
986
+
```javascript
987
+
constFCM=require('fcm-node');
988
+
// Replace these with your own values.
989
+
constapiKey='replace with API key';
990
+
constdeviceID='my device id';
991
+
constfcm=newFCM(apiKey);
992
+
993
+
constmessage= {
994
+
to: deviceID,
995
+
data: {
996
+
title:'My Title',
997
+
message:'My second message',
998
+
style:'inbox',
999
+
'inbox-order':'asc',
1000
+
summaryText:'There are %n% notifications'
1001
+
}
1002
+
};
1003
+
1004
+
fcm.send(message, (err, response) => {
1005
+
if (err) {
1006
+
console.log(err);
1007
+
console.log('Something has gone wrong!');
1008
+
} else {
1009
+
console.log('Successfully sent with response: ', response);
1010
+
}
1011
+
});
1012
+
```
1013
+
969
1014
## Action Buttons
970
1015
971
1016
Your notification can include a maximum of three action buttons. You register the event callback name for each of your actions, then when a user clicks on one of notification's buttons, the event corresponding to that button is fired and the listener you have registered is invoked. For instance, here is a setup with two actions `emailGuests` and `snooze`.
@@ -2128,12 +2173,12 @@ On iOS, using the FCM app server protocol, if you are trying to send a silent pu
2128
2173
"custom_var_2:""custom value here"/* Retrieved on app as data.additionalData.custom_var_2 */
2129
2174
},
2130
2175
/* Forces FCM silent push notifications to be triggered in the foreground of your iOS device. */
2131
-
"content_available":true
2176
+
"content_available":true
2132
2177
}
2133
2178
```
2134
2179
*Doc modification came in response to @andreszs - Issue [#2449](https://github.com/phonegap/phonegap-plugin-push/issues/2449).
2135
2180
2136
-
** IMPORTANT: When using the content_available field, Android payload issues may occur. [Read here](../docs/PAYLOAD.md#user-content-use-of-content_available-true) Make sure you separate your Android/iOS server payloads to mitigate any problems that may arise.
2181
+
** IMPORTANT: When using the content_available field, Android payload issues may occur. [Read here](../docs/PAYLOAD.md#user-content-use-of-content_available-true) Make sure you separate your Android/iOS server payloads to mitigate any problems that may arise.
2137
2182
2138
2183
More information on how to send push notifications using the FCM HTTP protocol and payload details can be found here:
0 commit comments