1. Development guide
Warning
THIS IS FOR INTERNAL USE ONLY!!
1.1. Push Notification format
1.1.1. FcmXmppApiProvider
This provider sends APNs notifications using following fields and values.
Field |
Value |
Description |
|||||||||||||||
me ssage_id |
“m-” + UUID |
Random id for the notification |
|||||||||||||||
priority |
high |
Priority of the notification |
|||||||||||||||
data |
Description of fields used within “data” object
|
Note
Any of fields described above may be not passed if notification sent to PUSH provider does not contain values for a particular fields.
1.1.2. APNsBinaryApiProvider
This provider sends APNs notifications using following fields and values.
Field |
Value |
Description |
content -available |
1 |
Mark notification as there is a content waiting for download (ie. XMPP message to retrieve) |
account |
Bare JID of user account |
|
unread- messages |
2 |
Number of unread messages waiting |
sender |
Full JID of a sender of the last message |
|
body |
“Text of a message body” |
Text of a message body limited to 500 chars with ellipsis added if message body exceeds 512 chars |
Note
Any of fields described above may be not passed if notification sent to PUSH provider does not contain values for a particular fields.
1.2. Disabling Push while not connect to the XMPP account
In some cases users may want/need to disable push notifications for
their device while not being able to connect to the XMPP server (ie.
password was changed, server is offline, user is blocked, etc.). To
allow that we have created REST API call available at:
/rest/push/unregister-device/{push-component-jid}
where
push-component-jid
is a jid of a push component. This endpoint
answers POST calls with JSON payload in the following format:
{
"account": "[email protected]",
"provider": "provider-id",
"device-token": "XXXXXXX"
}
where:
account
is a bare jid of users account for which we want to disable push notificationsprovider
is a provider id for which client registered (provider is responsible for delivering pushes to proper push service, ie. APNs or FCM)device-token
is a device id or token used to register for push notifications
On the request handler with answer with:
On success.
{
"result": "success"
}
On failure.
{
"result": "failure"
}
Warning
If push component is not a local component, or a payload is incorrect (fields are missing), then endpoing will respond with HTTP error code 404. This is intentional as this API is exposed publicly and we do not want easy for anyone else except client authors to be able to execute those calls.