PUSH¶
Sending¶
To send push-notifications it is required to:
- Receive sender's ID and enable Push API access. To do this, you need to contact the technical support.
- Call POST /push/messages, sending notification parameters in the request body with the authorization data in the header.
Note
You can also use Web SDK to send push notifications automatically.
Request parameters¶
Parameter | Data type | Description |
---|---|---|
from | integer | Approved sender's ID. |
to | string | Recipient's device token. |
title | string | Notification title. The maximum length is 200 characters. |
text | string | Notification text. The maximum length is 1024 characters. |
priority | string | Notification priority level.
|
badge (optional) |
integer | The key that sets the value for the application badge - the icon with a number in the upper corner of the application icon. The number indicates unread notifications in the application. You can set any integer. |
validity (optional) |
integer | Lifetime of the notification in seconds. Minimum value: 30 Maximum value: 86400, 1 day Default value: 86400, 1 day |
platform (optional) |
string | Platform or operating system of devices to which the notification will be sent. Available values: |
silentPush (optional) |
boolean | If true , the notification will not be displayed on the recipient's device. False by default. |
options (optional) |
object | An object with the data which will be specified in the callback with the notification status. Any |
apns (optional) |
Apns | Fields, which are specific for Apple device. |
android (optional) |
Android | Fields, which are specific for Android and Huawei device. |
Apns¶
Notification parameters for iOS devices.
Parameter | Data type | Description |
---|---|---|
sound (optional) |
string | Push notification sound on iOS. Supports Supported formats: AIF, AIFF, WAV, MP3, MP4 |
buttons (optional) |
array[ActionButtons] | Includes a maximum of 3 button objects. |
linkToMedia (optional) |
string | URL to the file attached to the notification. Supported formats: |
image (optional) |
string | The filename of the image in the application bundle, with or without a filename extension. The image is displayed directly in the notification. If the parameter is not specified, the system uses the image with the key Supported formats: JPEG, GIF, PNG |
action (optional) |
string | The URL/deep link to open when the notification is clicked. |
Android¶
Notification parameters for Android and Huawei devices.
Parameter | Data type | Description |
---|---|---|
smallIcon (optional) |
string | Link to the notification icon. The icon will be displayed as a preview in the notification bar. The link must point to an icon in the main application package. |
iconColor (optional) |
string | Notification icon color in #RRGGBB format. |
sound (optional) |
string | Android push notification sound. Supports a Supported formats: AIF/AIFF, WAV, MP3, MP4 |
buttons (optional) |
array[ActionButtons] | Includes a maximum of 3 button objects. |
image (optional) |
string | The filename of the image in the application bundle, with or without a filename extension. The image is displayed directly in the notification. If the parameter is not specified, the system uses the image identified by the Supported formats: JPEG, GIF, PNG |
androidChannelId (optional) |
string | Notification channel ID. |
tag (optional) |
string | ID for selecting users. Used for tagging subscribers in customer databases in FireBase. |
collapseKey (optional) |
string | When receiving notifications with the same collapseKey , Firebase Cloud Messaging (FCM) replaces the older notification with the new one. |
action (optional) |
string | The URL/deep link to open when the notification is clicked. |
ActionButtons¶
Parameter | Data type | Description |
---|---|---|
icon (optional) |
string | Notification icon URL. Used only for Android. Supported icon formats: 24x24, 36x36, 48x48, 72x72, 96x96 |
caption (optional) |
string | Button name. The maximum length is 30 characters. |
action (optional) |
string | URL/deep link to go when clicking on the button in the notification. |
Request example¶
[
{
"from":400,
"to":"r0Fo0EjfqKjTeZZpPW4s63PpMEYpgKIj55DT",
"title":"title",
"text":"Hello",
"badge":1,
"validity":86400,
"priority":"MEDIUM",
"options":{
"name":"James",
"phone":"79169492211"
},
"apns":{
"linkToMedia":"Default.png",
"sound":"hi.mp3",
"action":"https://test.com/apple-app-site-association"
},
"android":{
"iconColor": "#2F2F2F",
"sound":"hi.mp3",
"action":"https://test.com/android-app-site-association"
}
}
]
Response parameters¶
Parameter | Data type | Description |
---|---|---|
index | integer | Sequence number of the recipient from the notification array. |
pushToken | string | The recipient's device token. |
pushId | integer | Notification ID. To be given with "code": "ok" only. |
code | string | Shows the result of notification processing. 1. |
description | array | An array of the errors that occurred while processing the notification. To be given with "code": "validation_error" only. |
description.errorMessage | string | Message with error description. |
Response examples¶
{
"result": [
{
"index": 0,
"pushToken": "IOvpeJ0ECENA3WrrRHG1ghopWkVgiFNLSWWZoqLAUgIllcDF3j19ay9-0-Nanfo-0VjrnA1G6CGSvE_TyRUaea7mXmDUapY3YA",
"pushId": 3703545281276230700,
"code": "ok"
}
]
}
{
"result": [
{
"index": 0,
"pushToken": "IOvpeJ0ECENA3WrrRHG1ghopWkVgiFNLSWWZoqLAUgIllcDF3j19ay9-0-Nanfo-0VjrnA1G6CGSvE_TyRUaea7mXmDUapY3YA",
"code": "validation_error",
"description": [
{
"errorMessage": "Unknown from"
}
]
}
]
}
Callbacks¶
How to enable
To set up callbacks with notification statuses, please contact your account manager or technical support.
Possible statuses¶
Status | Description |
---|---|
accepted | The notification has been accepted for delivery. |
send | Sent to device notification service. |
delivered | The notification has been delivered. |
opened | The notification or link from it was opened. |
rejected | The notification has been rejected. |
canceled | The user has swiped the notification away. |
expired | The notification was not delivered during the allotted time. |
unsubscribed | The user has disabled notifications. |
Callback example¶
[
{
"messageId": 1,
"ts": 1636976602504,
"status": "delivered",
"errorCode": 0,
"options": "string"
}
]
Details¶
To get the sent notifications detailed information, you need to call GET /push-statistics/statistics/detail, sending filter parameters with the authorization data in the header.
Request parameters¶
Parameter | Data type | Description |
---|---|---|
limit | integer | The number of notifications in the search results. |
offset | integer | Search results offset. For example, if the number 5 is specified in the parameter, the received array of notifications will be displayed only from the 5 in the pull. |
taskId (optional) |
integer | Notification campaign ID for which you want to get the details. Used in required combination with the other parameters. |
triggerId (optional) |
integer | Notification campaign trigger ID. Used in required combination with the other parameters. |
dateTimeFrom (optional) |
datetime | Start date of the notification search. Used in required combination with the other parameters. The format is YYYY-MM-DDThh:mm:ss . |
dateTimeTo (optional) |
datetime | End date of the notification search. Used in required combination with the other parameters. The format is YYYY-MM-DDThh:mm:ss . |
messageIds (optional) |
array[integer] | Notification IDs for which you want to get the details. Used in required combination with the other parameters. |
applicationId (optional) |
integer | Devino.Online app ID the push notifications are sent from. |
order (optional) |
string | How to display the request results. Possible values: |
selectionField (optional) |
string | Field by which to sort the request results. |
outFields (optional) |
array[string] | Fields to be shown in request results. Fields that are not specified in this parameter will be excluded. |
recipient (optional) |
string | Recipient's phone number. |
status (optional) |
string | The notification status in the request results. Possible values: |
timeOffset (optional) |
integer | Recipient's time zone. |
userId (optional) |
integer | Campaign sender user ID. |
Parameters combinations¶
To get the correct request results, you should use one of these parameters combinations in accordance with the list:
- Notification campaign ID:
taskId
- Notification campaign ID and trigger ID:
taskId
,triggerId
- Start and end dates for the notification search:
dateTimeFrom
,dateTimeTo
- Notification campaign ID, trigger ID; start and end dates for the notification search:
taskId
,triggerId
,dateTimeFrom
,dateTimeTo
- Notification IDs:
messageIds
Fields for selectionField
and outFields
parameters¶
Used in the selectionField
parameter to sort the search results and in the outFields
parameter to filter fields.
Field name | Description |
---|---|
APPLICATION_ID | ID of the app from which the push notifications are sent (from Devino.Online). |
APPLICATION_NAME | App name. |
BODY | Push notification text. |
BUTTONS | Push notification button information (ActionButtons object). |
COMPANY_ID | Company ID. |
COMPANY_NAME | Company name. |
CUSTOM_DATA | The options parameter value when sending the notification. |
DEEP_LINK | URL/deep link to which the user went after clicking the notification. |
EVENT_DATE_TIME | Date and time the status of the message was last updated. |
MEDIA_FILE | Image link attached to the notification. In the response will be indicated as an image parameter. |
MESSAGE_ID | Notification ID. |
PRICE | Notification price. |
RECIPIENT | Recipient's push token. |
SEND_ROUTE | Route the notification has been sent. |
SENT_DATE_TIME | Date and time the notification has been sent. |
STATUS | Notification status from the Devino.Online personal account. |
STATUS_DETAILS | Notification status from the database. |
TASK_ID | Campaign ID. |
TASK_NAME | Campaign name. |
TASK_TYPE | Campaign type. |
TITLE | Push notification title. |
TRIGGER_CONTACT_GROUP | The name of the contact list to which the campaign was sent. In the response will be indicated as a list parameter. |
TRIGGER_SEGMENT | The name of the contact list segment to which the campaign was sent. In the response will be indicated as a segment parameter. |
TRIGGER_ID | Campaign trigger ID. |
USER_ID | Sender's user ID. |
USER_LOGIN | Sender's user login. |
Request examples¶
curl -X GET https://api.devino.online/push-statistics/statistics/detail?dateTimeFrom=2023-02-12T00:00:00&dateTimeTo=2023-02-24T00:00:00&limit=20&offset=1
-H 'Authorization: Key QWxhZGRpbjpvcGVuIHNlc2FtZQ==' \
curl -X GET https://api.devino.online/push-statistics/statistics/detail?taskId=8742&triggerId=2312&limit=20&offset=1
-H 'Authorization: Key QWxhZGRpbjpvcGVuIHNlc2FtZQ==' \
Response parameters¶
Parameter | Data type | Description |
---|---|---|
data | array[object] | An array of objects with detailed information on each notification. The parameters are defined by the fields that were set in the original request. Additional parameters also appear. |
size | integer | Number of items per page and notifications in search results. Set by limit parameter. |
offset | integer | Search results offset. For example, if the number 5 is specified in the parameter, the received array of notifications will be displayed only from the 5 in the pull. |
number | integer | The number of the received page. Defined by the ○ If the ○ If the ○ If the |
pageExists | boolean | Whether the displayed page exists. |
total | integer | The total number of notifications for which the details can be received. |
pages | integer | The total number of pages for which the details can be received. Determined by integer division of the total parameter by limit (total / limit ). |
more | boolean | Indicator: whether there are pages after the current one specified in the number parameter. |
Data¶
Parameter | Data type | Description |
---|---|---|
recipientPlatform | string | Platform or operating system of devices to which the notification will be sent. Available values: |
isListDeleted | boolean | Whether the contact list from which the message was sent has been deleted. |
isSegmentDeleted | boolean | Whether the contact list, the contact from which the message was sent, has been deleted. |
Response example¶
{
"result": {
"offset": 1000,
"number": 21,
"size": 50,
"pageExists": true,
"data": [
{
"messageId": "234567865432456787634",
"applicationId": 111,
"applicationName": "App",
"taskId": "11111",
"taskName": "task",
"taskType": "SIMPLE",
"triggerId": "11111111",
"list": "Contact_list",
"isListDeleted": false,
"segment": "Segment",
"isSegmentDeleted": false,
"recipient": "71110000999:APA91bFdDBjCi_6sePNogM3eJ...",
"sentDateTime": "2022-12-14 05:55:32",
"status": "UNDELIVERED",
"statusDetails": "REJECTED",
"eventDateTime": "2022-12-14 05:54:52",
"companyId": 234,
"companyName": "MyCompany",
"userId": 88,
"userLogin": "79991112233",
"price": "1.0000",
"body": "Notification text",
"title": "Notification title",
"recipientPlatform": "FIREBASE",
"image": "https://devinotele.com/media.jpg",
"deepLink": "http://devinotele.com",
"actionButtons": [
{
"buttonName": "PUSH ME 1",
"buttonUrl": "1"
},
{
"buttonName": "PUSH ME 2",
"buttonUrl": "2"
},
{
"buttonName": "PUSH ME 3",
"buttonUrl": "3"
}
],
"customData": {
"OMNI": {
"contactId": "21dfswarfsg3423ede2",
"triggerId": 11111111,
"taskId": 11111
}
}
},
...
],
"more": true,
"pages": 100,
"total": 1000
}
}
Notification statistics¶
To get the general statistics on notification statuses, you need to call GET /push-statistics/statistics/of-group, sending filter parameters with the authorization data in the header.
Request parameters¶
Parameter | Data type | Description |
---|---|---|
groupBy | string | Results grouping: |
startDate | datetime | Start of the date range. The format is YYYY-MM-DDThh%3Amm%3Ass . |
endDate | datetime | End of the date range. The format is YYYY-MM-DDThh%3Amm%3Ass . |
taskId (optional) |
integer | Campaign ID for which the statistics is needed. |
triggerId (optional) |
integer | Campaign trigger ID for which the statistics is needed. |
timeOffset (optional) |
integer | Recipient's time zone. The format is offset in minutes, for example, 180 for Moscow (GMT+3). |
Request example¶
curl -X GET https://api.devino.online/push-statitics/statistics/of-group?startDate=2022-10-06T13%3A45%3A30&endDate=2023-02-06T13%3A45%3A30&groupBy=MONTH
-H 'Authorization: Key QWxhZGRpbjpvcGVuIHNlc2FtZQ==' \
Response parameters¶
Parameter | Data type | Description |
---|---|---|
messages | array[MessageStatusObject] | The number of notifications for the selected period, grouped by status. |
MessageStatusObject¶
The object contains information about the number of notifications with statuses:
Code | Description |
---|---|
accepted | The notification has been accepted for delivery. |
send | Sent to device notification service. |
delivered | The notification has been delivered. |
opened | The notification link was opened. |
rejected | The notification has been rejected. |
canceled | The user has swiped the notification away. |
expired | The notification was not delivered during the allotted time. |
unsubscribed | The user has disabled notifications. |
Each status includes the parameters:
Parameter | Data type | Description |
---|---|---|
date | string | Statistics collection date depending on the value of the groupBy parameter. |
amount | integer | The number of notifications. |
Response example¶
{
"result": {
"messages": {
"accepted": [],
"send": [
{
"date": "2022-09-01 00:00:00",
"amount": 11
},
{
"date": "2022-10-01 00:00:00",
"amount": 24
},
{
"date": "2023-01-01 00:00:00",
"amount": 2
}
],
"delivered": [
{
"date": "2023-01-01 00:00:00",
"amount": 2
}
],
"opened": [
{
"date": "2022-10-01 00:00:00",
"amount": 49
},
{
"date": "2022-09-01 00:00:00",
"amount": 23
},
{
"date": "2022-11-01 00:00:00",
"amount": 1
}
],
"rejected": [],
"canceled": [],
"expired": [],
"unsubscribed": []
}
}
}