Send Notifications

This section describes API to send push notifications.

Send Push

To send push notifications.

This API requires a JSON payload.

curl https://app.mpush.cloud/api/send
-X POST 
-H "Accept: application/json" 
-H "Content-Type: application/json" 
-H "X-MPush-Token: <token>" 
-H "X-MPush-Token: 2" 
-d '<JSON payload>' 

On success is returned an HTTP 200 and JSON like this:

{
  "status_code": 0,
  "body": {
    "total": 1
  }
}

HTTP Request

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

Parameters (JSON)

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:

{
  "push": {
    "topics": ["all"],
    "payload": {
      "body": "Hello"
    }
  }
}

Payload example to send a basic notification to multiple topics with custom badge and sound:

{
  "push": {
    "topics": ["news", "user.12", "user.15"],
    "payload": {
      "title": "News!",
      "body": "Hello",
      "badge": 2,
      "sound": "sound.aiff"
    }
  }
}

Payload example to send a scheduled notification with custom data:

{
  "push": {
    "topics": ["user.12"],
    "payload": {
      "body": "Hello",
      "scheduled_at": 1546300800,
      "custom": {
        "custom": "data",
        "key": "value"
      }
    }
  }
}

Payload example to send a notification with localization:

{
  "push": {
    "topics": ["user.23"],
    "payload": {
      "loc_key": "LOCALIZED_PUSH",
      "loc_args": [
        "Name",
        "Surname"
      ]
    }
  }
}

In the sidebar a list of examples with the most common configurations.

Last updated