Sending push messages
Sends one or several push messages to the specified devices.
This operation allows you to send messages with different properties (e.g. text, media attachment, etc.) in a single HTTP request. Each request can contain up to 250,000 devices to which messages will be sent.
Note
We recommend using this operation instead of the obsolete POST /push/v1/send
.
Request format
POST https://push.api.appmetrica.yandex.net/push/v1/send-batch
Request body
{
"push_batch_request": {
"group_id": 1,
"client_transfer_id": long,
"tag": "string",
"batch": [
{
"messages": {
"android": {
"silent": false,
"content": {
"title": "string",
"text": "string",
"icon": "string",
"icon_background": "#AARRGGBB",
"image": "https://example.com/picture.jpg",
"banner": "https://example.com/picture.jpg",
"data": "string",
"channel_id": "string",
"priority": -2,
"collapse_key": 2001,
"vibration": [0, 500],
"led_color": "#RRGGBB",
"led_interval": 50,
"led_pause_interval": 50,
"time_to_live": 180,
"visibility": "public",
"urgency": "high"
},
"open_action": {
"deeplink": "yandexmaps://?"
}
},
"iOS": {
"silent": false,
"content": {
"title": "string",
"text": "string",
"badge": 1,
"sound": "disable",
"thread_id": "string",
"category": "string",
"mutable_content": 1,
"expiration": 3600,
"data": "string",
"collapse_id": "string",
"attachments": [
{
"id": "string",
"file_url": "string",
"file_type": "string"
},
...
]
},
"open_action": {
"url": "https://ya.ru"
}
}
},
"devices": [
{
"id_type": "appmetrica_device_id",
"id_values": ["123456789", "42"]
},
{
"id_type": "ios_ifa",
"id_values": ["8A690667-6204-4A6A-9B38-85DE016....."]
},
{
"id_type": "google_aid",
"id_values": ["eb5f3ec8-2e3e-492f-b15b-d21860b....."]
},
{
"id_type": "android_push_token",
"id_values": ["eFfxdO7uCMw:APA91bF1tN3X3BAbiJXsQhk-..."]
},
{
"id_type": "ios_push_token",
"id_values": ["F6A79E9F844A24C5FBED5C58A4C71561C180F........."]
},
{
"id_type": "huawei_push_token",
"id_values": ["0866422030....."]
},
{
"id_type": "huawei_oaid",
"id_values": ["ecef47f7-fcce-ad....."]
}
]
},
{
"messages": {
...
}
}
]
}
}
|
Request to send batch push messages |
|
|
Group ID. |
|
|
Sending ID specified by the user. It is used for checking the status of the sending. Alert The |
|
|
The sending tag. |
|
|
Array of |
|
|
Push message. |
|
|
The device platform. |
|
|
A flag that indicates silent push sending. Possible values: `true |
false`. |
|
The content of the push message. |
|
|
The title of the push message. The value is mandatory for the non-silent push messages. |
|
|
The text of the message. The value is mandatory for the non-silent push messages. |
|
|
The icon is shown in the notification bar. By default, the standard app icon is displayed. To change the icon, set the icon resource ID in the standard |
|
|
The color of the message icon. It is specified as a string in the format of the hex code |
|
|
The URL of the image which is displayed in the push message next to the notification text. |
|
|
The URL of the image that is shown in the push message. |
|
|
An arbitrary data string. You can pass any data you need as a string value. You can process the data string by using the appropriate AppMetrica Push SDK methods. |
|
|
ID of the notification channel. If the ID is not specified, the default channel is used. Available for Android 8 or higher. For more information about channels, see Android documentation. |
|
|
Notification priority. Acceptable values are in the range of |
|
|
Notification ID. The default value is 0. Ignored if there are no push notifications currently displayed for this application. If one or more notifications are displayed and the new message has the same notification ID, the content of this notification will be updated. If the ID is different, the new message is displayed. |
|
|
Vibration pattern on message arrival. Format: |
|
|
LED color. It is specified as a string in the format of the hex code |
|
|
The duration of the glow of the LED indicator in ms. |
|
|
Pause time for the glow of the LED indicator in ms. |
|
|
The duration of the interval in seconds that FireBase will store the push message if the device is offline or out of range. |
|
|
Displaying the push message on the lock screen. Ignored on Android 8 and higher (API level 26+), where it's set at the channel level. Acceptable values: |
|
|
Urgency (priority) of push message delivery. Acceptable values: |
|
|
The action to be taken when a user clicks on a push notification. If the field is empty, the user click opens the application. |
|
|
The deeplink with an application screen to take a user to after clicking on a push message. |
|
|
The device platform. |
|
|
A flag that indicates silent push sending. Possible values: `true |
false`. |
|
The content of the push message. |
|
|
The title of the push message. The value is mandatory for the non-silent push messages. |
|
|
The text of the message. The value is mandatory for the non-silent push messages. |
|
|
Badge number to be displayed on the application icon on message arrival. |
|
|
The message sound. Possible values: `default |
disable` |
|
ID for grouping push notifications. The value is specified in the threadIdentifier property of the UNNotificationContent object. |
|
|
Push notifications category. The value is specified in the identifier property of the |
|
|
Indicates Notification Service Extension. If the value is To track the delivery, set up push notification statistics collection and pass |
|
|
The duration of time to continue trying to deliver the notification to the user's device. The value should be specified in seconds. If this time expires and the device is still unavailable (for example, it doesn't have internet access), the notification isn't delivered. By default, the time is unrestricted. |
|
|
An arbitrary string of data. You can pass any data you need as a string value. You can process the data string by using the appropriate AppMetrica Push SDK methods. |
|
|
Collapse ID apns-collapse-id. Multiple notifications with the same ID are displayed to the user as a single notification. |
|
|
An array of attachments to be added in a push message. Read more in the article Step 6. (Optional) Configure uploading attached files. |
|
|
ID of the push message contents. |
|
|
URL of the file from the push message. |
|
|
Type of the attached file in the push message. For acceptable types, see File types in push messages. |
|
|
The action to be taken when a user clicks on a push notification. If the field is empty, the user click opens the application. |
|
|
The URL to go to when the push message is clicked. |
|
|
Devices to send push notifications to. Each dispatch of messages can contain up to 250,000 devices.
Devices are grouped by |
|
|
The type of the ID. Acceptable values: Note When you use a push token as an identifier, AppMetrica checks the presence of a token and device information in the database before sending. If there is no device information, the push message is not sent. This is necessary to control sending messages to the desired addressees and display information in the reports. |
|
|
List of devices to send push messages to. Alert The list can't be empty. |
Response format
{
"push_response": {
"transfer_id": 1,
"client_transfer_id": long
}
}
|
The response after sending push messages. |
|
ID of the dispatch. It is used for checking the status of the dispatch. |
|
Sending ID, specified by the user in the body of the request. It is used for checking the status of the dispatch. Note The field is returned only if it was specified in the body of the request. |
If you didn't find the answer you were looking for, you can use the feedback form to submit your question. Please describe the problem in as much detail as possible. Attach a screenshot if possible.
A tag is an arbitrary string that labels every sending performed by the API. You can label an arbitrary number of sendings by one tag. The report displays tag at the second level.
A message processed by the application in the background without being displayed to the user. You can transfer additional data to the application via silent push messages or check the delivery of notifications.