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.
POST /push/v1/send-batch
POST /push/v1/send
.Request format
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": {
...
}
}
]
}
}
push_batch_request
group_id
*client_transfer_id
client_transfer_id
value must be unique in the specified group (group_id
).batch
messages
objects. It contains push messages with properties.messages
android
ios
silent
true | false
.content
title
text
icon
icon_background
#AARRGGBB
.This field is available only for the Android platform.
image
banner
This field is available only for the Android platform.
data
collapse_id
channel_id
Available for Android 8 or higher. For more information about channels, see Android documentation.
priority
[-2; 2]
. The platform determines the priority of messages and takes appropriate actions: interrupts the user (displays a message on the screen), or does not notify the user about the message. On different devices, priority is interpreted differently.This field is available only for the Android platform.
collapse_key
This field is available only for the Android platform.
vibration
[pause in ms, duration of vibration in ms, pause in ms, duration of vibration in ms, ...]
.This field is available only for the Android platform.
led_color
#RRGGBB
.This field is available only for the Android platform.
led_interval
This field is available only for the Android platform.
led_pause_interval
This field is available only for the Android platform.
time_to_live
This field is available only for the Android platform.
open_action
deeplink
badge
sound
default | disable
thread_id
ID for grouping push notifications. The value is specified in the threadIdentifier property of the UNNotificationContent object.
category
Push notifications category. The value is specified in the identifier property of the UNNotificationCategory
object. More information about push actions and categories in the Apple documentation.
mutable_content
Indicates Notification Service Extension. If the value is 1
, the push notification is processed by the extension. AppMetrica uses it to track the delivery of push notifications.
To track the delivery, set up push notification statistics collection and pass 1
as a field value. If the value is omitted, the number of delivered push notifications in reports is equal to the number of opened messages.
expiration
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.
url
visibility
secret
, private
, public
. Not set by default. For more information about the visibility
property, see the Android documentation.urgency
high
, normal
. The default value is high
. Urgent push messages wake up the device, launch the app in background mode, and get access to the internet for a short time. Urgent push messages are delivered faster and more reliably. For more information about priority of FCM messages, see the Android documentation.devices
Devices are grouped by id_type
. One sending can have from 1 to 5 groups. All groups can contain up to 250,000 devices in total in a single HTTP request. For example, if the appmetrica_device_id
group contains 100,000 devices, only 150,000 can be specified in the others.
id_type
appmetrica_device_id
, ios_ifa
, google_aid
, android_push_token
, ios_push_token
, huawei_push_token
, huawei_oaid
.id_values
attachments
This field is only available for the iOS platform.
id
This field is only available for the iOS platform.
file_url
This field is only available for the iOS platform.
file_type
This field is only available for the iOS platform.
* Required
Response format
{
"push_response": {
"transfer_id": 1,
"client_transfer_id": long
}
}
push_response
transfer_id
client_transfer_id