- Platform based push notification will be delivered to the specified platform only, for example, iOS or Android only.
- Universal push notifications will be delivered to all possible devices/platforms for specified users.
Platform-based push notification
A platform-based push notification will be delivered to a specified platform only, for example, iOS or Android. To specify platform useevent.push_type
parameter within Create Event request. With platform-based push notification, you can use all specified features of a particular platform. There are no restrictions.
General requirements
A message format is akey=value
string where a key
is raw text and value
is CGI escaped and Base64 encoded. Each pair should be separated by &
.
Example:
Plain message: key1=c29tZXZhbHVlMQ==&key2=YW5vdGhlcnZhbHVlMg==&key3=dGhpcmRleGFtcGxl
Symbol
&
should be escaped by %26.iOS
To meet Apple payload requirements review this document. Example:- Initial JSON payload:
{ "aps" : { "alert" : "You got your emails.", "badge" : 9, "sound" : "bingbong.aiff" }, "acme1" : "bar", "acme2" : 42 }
- Base64 Encoded data:
ew0KICAgICJhcHMiIDogew0KICAgICAgICAiYWxlcnQiIDogIllvdSBnb3QgeW91ciBlbWFpbHMuIiwNCiAgICAgICAgImJhZ GdlIiA6IDksDQogICAgICAgICJzb3VuZCIgOiAiYmluZ2JvbmcuYWlmZiINCiAgICB9LA0KICAgICJhY21lMSIgOiAiYmFyIiwNCiAg ICAiYWNtZTIiIDogNDINCn0=
- Final message (for iOS pushes you should add
payload=
beforemessage
):event.message=payload=ew0KICAgICJhcHMiIDogew0KICAgICAgICAiYWxlcnQiIDogIllvdSBnb3QgeW91ciBlbWFpbHMuIiwNCiAgICAgICAg ImJhZGdlIiA6IDksDQogICAgICAgICJzb3VuZCIgOiAiYmluZ2JvbmcuYWlmZiINCiAgICB9LA0KICAgICJhY21lMSIgOiAiYmFyIiwNCi AgICAiYWNtZTIiIDogNDINCn0=
Android
To meet FCM requirements review this document. The overall principles are as follows:data.message
key is required and should be first.- Values should be CGI escaped before Base64 encoding.
- The required field
collapse_key
is added automatically before sending and contains valueevent<ID>
. - Message format is a
data.key1=value1&...&data.keyN=valueN
.
- Initial plain message:
data.message=I love M&M's! Especially red one!
- CGI-escaped:
data.message=I+love+M%26M%27s%21+Especially+red+one%21
- Base64-encoded:
data.message=SStsb3ZlK00lMjZNJTI3cyUyMStFc3BlY2lhbGx5K3JlZCtvbmUlMjE=
- Final message:
event.message=data.message=SStsb3ZlK00lMjZNJTI3cyUyMStFc3BlY2lhbGx5K3JlZCtvbmUlMjE=
Universal Push Notifications
Universal push notifications will be delivered to all possible devices/platforms for specified users. To send Universal push notifications just omitevent.push_type
parameter within a Create Event request.
Send a simple text
If you would like to send just a text push message (without any parameters) use the format below. Example:- Initial plain message:
I love M&M's! Especially red one!
- Base64-encoded:
SSBsb3ZlIE0mTSdzISBFc3BlY2lhbGx5IHJlZCBvbmUh
- Final message:
event.message=SSBsb3ZlIE0mTSdzISBFc3BlY2lhbGx5IHJlZCBvbmUh
Use custom parameters
Custom parameters are available for iOS and Android platforms only.
message
push text will be translated toaps.alert.body
for iOS and todata.message
for Android.ios_badge
will be translated toaps.badge
for iOS. Ignored for Android.ios_sound
will be translated toaps.sound
for iOS. Ignored for Android.ios_content_available=1
will be translated toaps.content-available
for iOS. Ignored for Android.ios_mutable_content=1
will be translated toaps.mutable-content
for iOS. Ignored for Android.ios_category
will be translated toaps.category
for iOS. Ignored for Android.ios_voip=1
will initiate VoIP push notification for iOS if user has VoIP push subscription. Otherwise, iOS user will receive standard iOS push. For Android, it will be a standard push.
data.X
.
Example:
- Initial JSON message:
{"message": "Message received from Bob", "ios_badge": 5, "ios_sound": "mysound.wav", "user_id": "234"}
- Base64-encoded:
c29tZXZhbHVlMQc29tZXZhbHVlMQc29tZXZhbHVlMQc29tZXZhbHVlMQc29tZXZhbHVlMQ
- Final message:
event.message=c29tZXZhbHVlMQc29tZXZhbHVlMQc29tZXZhbHVlMQc29tZXZhbHVlMQc29tZXZhbHVlMQ