Send Notifications
This section describes API to send push notifications.

Send Push

To send push notifications.
This API requires a JSON payload.
1
curl https://app.mpush.cloud/api/send
2
-X POST
3
-H "Accept: application/json"
4
-H "Content-Type: application/json"
5
-H "X-MPush-Token: <token>"
6
-H "X-MPush-Token: 2"
7
-d '<JSON payload>'
Copied!
On success is returned an HTTP 200 and JSON like this:
1
{
2
"status_code": 0,
3
"body": {
4
"total": 1
5
}
6
}
Copied!

HTTP Request

POST https://app.mpush.cloud/api/send

Parameters (JSON)

Key
Type
Required
Description
push.topics
array
Yes
Contains a list of all topics to send the push to.
push.payload.title
string
No
Notification title.
push.payload.body
string
Yes
Notification body.
push.payload.badge
int
No
Badge number.
push.payload.sound
string
No
Specify the sound path to play when the push arrives.
push.payload.title_loc_key
string
No
Specify the key to a body string in a localization file for the current locale.
push.payload.title_loc_args
array
No
Specify the values to appear in place of the format specifiers in title_loc_key.
push.payload.loc_key
string
No
Specify the key to a title string in a localization file for the current locale.
push.payload.loc_args
array
No
Specify the values to appear in place of the format specifiers in loc_key.
push.payload.action_loc_key
string
No
Custom sound to play.
push.payload.launch_image
string
No
Specify the image path to launch at the app launch.
push.payload.scheduled_at
int
No
A UNIX timestamp (UTC) that identifies the date when the notification should be sent.
push.payload.mutable_content
bool
No
Mutable content (only iOS).
push.payload.content_available
bool
No
Content available (only iOS).
push.payload.category
string
No
Specify a category (only iOS).
push.payload.thread_id
int
No
Specify a thread (only iOS).
push.payload.collapse_id
int
No
Multiple notifications with the same collapse identifier are displayed to the user as a single notification (only iOS).
push.payload.expiration_at
int
No
A UNIX timestamp (UTC) that identifies the date when the notification is no longer valid and can be discarded.
push.payload.custom
object
No
An object containing custom data.
This table is used the "dot" notation to show the payload JSON structure.
For a complete reference to all available values to include in the payload we remand to the official documentation: iOS and Android.

Examples

Payload example to send a basic notification:
1
{
2
"push": {
3
"topics": ["all"],
4
"payload": {
5
"body": "Hello"
6
}
7
}
8
}
Copied!
Payload example to send a basic notification to multiple topics with custom badge and sound:
1
{
2
"push": {
3
"topics": ["news", "user.12", "user.15"],
4
"payload": {
5
"title": "News!",
6
"body": "Hello",
7
"badge": 2,
8
"sound": "sound.aiff"
9
}
10
}
11
}
Copied!
Payload example to send a scheduled notification with custom data:
1
{
2
"push": {
3
"topics": ["user.12"],
4
"payload": {
5
"body": "Hello",
6
"scheduled_at": 1546300800,
7
"custom": {
8
"custom": "data",
9
"key": "value"
10
}
11
}
12
}
13
}
Copied!
Payload example to send a notification with localization:
1
{
2
"push": {
3
"topics": ["user.23"],
4
"payload": {
5
"loc_key": "LOCALIZED_PUSH",
6
"loc_args": [
7
"Name",
8
"Surname"
9
]
10
}
11
}
12
}
Copied!
In the sidebar a list of examples with the most common configurations.
Last modified 1yr ago
Copy link
Contents
Send Push