Skip to content

PUSH

Sending

To send PUSH-notifications it is required to call POST /push/api/messages sending message parameters in the body with authorization data in the heading.

Info

To receive Push API access email to support@devinotele.com. You will receive a Sender ID required for using API.

Request parameters

Parameter Data type Description
from integer Sender ID
to string Addressee device ID
title string Heading of the notification
text string Text of the notification
badge
(optional)
integer A key setting the app badge value
- If the key is not included into the dictionary, the badge value will not change
- To remove a badge, set a key value as 0
validity
(optional)
integer Lifetime of the notification.
Minimum value, seconds: 15
- Maximum value, seconds: 2419200
- Default value, seconds: 86400
priority string Message priority level, between 0 and 3, where:
0 - low priority
3 - highest priority
The default priority level is 0
silentPush
(optional)
boolean A flag that delivers one of the values to SDK: if true, the notification will not be displayed on the device
options
(optional)
string Map additional parameters, which will be delivered to the device
apns
(optional)
Apns Fields, which are specific for apns
android
(optional)
Android Fields, which are specific for Android

Attention

To send a notification one of the objects is required: ApnsDto or AndroidDto.

ApnsDto

Parameter Data type Description
sound
(optional)
string Activate this key if you want the system to play sound. The value of this key is the name of the audio file in the root directory or Library / Sounds folder in the container of your app. If the audio file is not found or you have given the default value, the system will play the default warning sound.
Supported formats:
- AIF
- AIFF
- WAV
- MP3
- MP4
Maximum size: 5 МB
buttons
(optional)
list ActionButtons Maximum 3 ActionButtons objects
linkToMedia
(optional)
string URL to the file.
Supported formats:
- Audio (AIFF, WAV, MP3, MPEG-4), 5 MB
- Movie (MPEG, MPEG-2, AVI), 50 MB
- Image (JPEG. PNG, GIF), resolution: 1024 × 1024 or 1:1 aspect ratio, 10 MB
action
(optional)
string Url/Deep link denotes clicking on the notification

ActionButtons

Parameter Data type Description
caption
(optional)
string A button name, may consist of up to 30 characters
action
(optional)
string Url/Deep-link denotes clicking on the button in the notification

AndroidDto

Parameter Data type Description
iconCollor
(optional)
string Color of the notifications icon, #rrggbb
sound
(optional)
string A sound, which is played when the device received a notification. The key supports ‘default’ filename or the name of the audio file from the app. Audio files are to be kept in /res/raw. Supported formats:
- aif/aiff
- wav
- MP3
- MP4
Maximum size: 5MB
image
(optional)
string The name of the image file from the app with or without the filename extension. The image is used to depict the run of the app when users click on an action button or move an action slider. If this parameter is not chosen, the system uses the image identified by UILaunchImageFile key in the app file Info.plist or Default.png.
Supported formats:
- JPEG
- GIF
- PNG
Dimensions:
- Minimum: 512 × 256
- Recommended: 1440 × 720
- Maximum: 2880 × 1440
Resolution:
- 1440 × 720 or 2:1 aspect ratio
androidChannelId
(optional)
string Notification channel ID More details.
tag
(optional)
string ID for user selection (used for tagging users in user bases by FireBase)
buttons
(optional)
list ActionButtons Maximum 3 ActionButtons objects
collapseKey
(optional)
string When a newer message comes and contains an older associated message not relating to the client application, FCM replaces the older message.
icon
(optional)
string URL to the notifications icon. Supported icon formats:
- 24 × 24
- 36 × 36
- 48 × 48
- 72 × 72
- 96 × 96
action
(optional)
string Url/Deep link denotes clicking on the notification

ActionButtons

Parameter Data type Description
icon
(optional)
string URL to the notifications icon. Supported icon formats:
- 24 × 24
- 36 × 36
- 48 × 48
- 72 × 72
- 96 × 96
caption
(optional)
string A button name, may consist of up to 30 characters
action
(optional)
string Url/Deep link denotes clicking on the button in the notification

Request example

POST /push/api/messages
Authorization: Key QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Content-Type: application/json
Accept: application/json
[ 
   { 
      "from":400,
      "to":"r0Fo0EjfqKjTeZZpPW4s63PpMEYpgKIj55DT",
      "title":"title",
      "text":"Hello",
      "badge":1,
      "valitity":86400,
      "priority":"NORMAL",
      "options":{ 
         "name":"Ivan",
         "phone":"79169492211"
      },
      "apns":{ 
         "linkToMedia":"Default.png",
         "sound":"hi.mp3",
         "action":"https://test.com/apple-app-site-association"
      },
      "android":{ 
         "icon":"Default.png",
         "iconCollor":"#FF4500",
         "sound":"hi.mp3",
         "action":"https://test.com/android-app-site-association"
      }
   }
]
curl
-X POST
-H "Authorization: Key QWxhZGRpbjpvcGVuIHNlc2FtZQ=="
-H "Content-Type: application/json"
-d '[{
   "from":400,
   "to":"r0Fo0EjfqKjTeZZpPW4s63PpMEYpgKIj55DT",
   "title":"title",
   "text":"Hello",
   "badge":1,
   "valitity":86400,
   "priority":"NORMAL",
   "options":{
      "name":"Ivan",
      "phone":"79169492211"
   },
   "apns":{
      "linkToMedia":"Default.png",
      "sound":"hi.mp3",
      "action":"https://test.com/apple-app-site-association"
   },
   "android":{
      "icon":"Default.png",
      "iconCollor":"#FF4500",
      "sound":"hi.mp3",
      "action":"https://test.com/android-app-site-association"
   },
}]' "https://api.devino.online/push/api/messages"
[
  {
    "from": 0,
    "validity": 0,
    "to": "string",
    "title": "string",
    "text": "string",
    "badge": 0,
    "priority": "LOW",
    "silentPush": true,
    "options": {
      "additionalProp1": "string",
      "additionalProp2": "string",
      "additionalProp3": "string"
    },
    "apns": {
      "action": "string",
      "linkToMedia": "string",
      "sound": "string",
      "image": "string",
      "buttons": [
        {
          "caption": "string",
          "action": "string"
        }
      ]
    },
    "android": {
      "icon": "string",
      "action": "string",
      "iconColor": "string",
      "sound": "string",
      "image": "string",
      "androidChannelId": "string",
      "tag": "string",
      "buttons": [
        {
          "icon": "string",
          "caption": "string",
          "action": "string"
        }
      ],
      "collapseKey": "string"
    }
  }
]

Response example

{ 
   "result":[ 
      { 
         "code":"string",
         "description":[ 
            { 
               "errorMessage":"string",
               "fieldName":"string"
            }
         ],
         "index":0,
         "pushId":0,
         "pushToken":"string"
      }
   ]
}
{
  "description": "string",
  "reasons": [
    {
      "key": "string",
      "params": [
        {}
      ],
      "ref": "string"
    }
  ],
  "result": [
    {
      "code": "string",
      "description": [
        {
          "errorMessage": "string",
          "fieldName": "string"
        }
      ],
      "index": 0,
      "pushId": 0,
      "pushToken": "string"
    }
  ]
}

Response parameters

Parameter Data type Description
description string Answer description
reasons object Reasons named in the answer
key string A localization key
params list A list of parameters in case of an error
ref string A reason path
result object A result object
code string Points out the result of message processing
1. OK - Processed successfully
2. REJECTED - An error has occurred while processing the request
description object Description of the processing result
errorMessage string A message describing an error
fieldName string A field the error occurred in
index integer Message numbering
pushId integer Push ID
pushToken string The user’s device ID

Getting status

Attention

To enable status sending by callbacks, contact your manager or technical support at support@devinotele.com

When forming the message status, a POST request will be sent to the URL of the remote server with a list of objects of the following type:

Parameter Data type Description
pushToken string Device token
pushId long Notification ID
state State Notification status
stateDesc
(optional)
string Status description
actionId
(optional)
string Clicked action
pushApplicationId integer Application ID, field from in the send request
reportedTimestamp long Timestamp status creation

Possible statuses

State Description
delivered The notification has been delivered
opened The notification or link from it was opened
canceled The user has swiped the notification out of the screen
expired The notification was not delivered in the allotted time.