When you publish a message with mobile push payload attributes (pn_apns and pn_fcm), the specified mobile push messages will always be sent to all devices registered for mobile push notifications on the channel that the message was published to.
{
"pn_apns": {
"aps": {
"alert": {
"body": "You have been invited to 'quiz' chat",
"title": "Chat invitation"
},
"sound": "default"
},
"pn_push": [
{
"targets": [
{
"environment": "development",
"topic": "com.meetings.chat.app"
}
],
"version": "v2",
"collapse_id": "invitations",
"push_type": "alert",
"auth_method": "token"
}
]
},
"pn_fcm": {
"notification": {
"title": "Chat Invitation",
"body": "John invited you to chat"
},
"android": {
"collapse_key": "group",
"data": {
"age": "99"
},
"ttl": "30s"
},
"pn_exceptions": ["device-token1", "device-token2"]
}
}
The entire payload above will be sent to active PubNub subscribers (including the pn_apns
and pn_fcm data), but only the data inside the pn_apns
section will be sent as an APNS message to registered iOS devices and data inside the pn_fcm section as an FCM message to registered Android devices, and displayed a push notification.
To learn more, visit our official Mobile Push Notification technical documentation.