Publish a push notification to device(s)

POST /push/publish

A convenience endpoint to deliver a push notification payload to a single device or set of devices identified by their client identifier.

Body

  • recipient object Required

    Push recipient details for a device.

    Hide recipient attributes Show recipient attributes object
    • Defines which push platform is being used.

      Values are apns, fcm, or gcm.

    • when using APNs, specifies the required device token.

    • when using GCM or FCM, specifies the required registration token.

    • clientId string

      Client ID of recipient

    • deviceId string

      Client ID of recipient

  • push object
    Hide push attributes Show push attributes object
    • data string
    • Hide notification attributes Show notification attributes object
      • title string

        Title to display at the notification.

      • body string

        Text below title on the expanded notification.

      • icon string

        Platform-specific icon for the notification.

      • sound string

        Platform-specific sound for the notification.

      • Platform-specific, used to group notifications together.

    • apns object

      Extends and overrides generic values when delivering via APNs. See examples

      Hide apns attribute Show apns attribute object
      • Hide notification attributes Show notification attributes object
        • title string

          Title to display at the notification.

        • body string

          Text below title on the expanded notification.

        • icon string

          Platform-specific icon for the notification.

        • sound string

          Platform-specific sound for the notification.

        • Platform-specific, used to group notifications together.

    • fcm object

      Extends and overrides generic values when delivering via GCM/FCM. See examples

      Hide fcm attribute Show fcm attribute object
      • Hide notification attributes Show notification attributes object
        • title string

          Title to display at the notification.

        • body string

          Text below title on the expanded notification.

        • icon string

          Platform-specific icon for the notification.

        • sound string

          Platform-specific sound for the notification.

        • Platform-specific, used to group notifications together.

    • web object

      Extends and overrides generic values when delivering via web. See examples

      Hide web attribute Show web attribute object
      • Hide notification attributes Show notification attributes object
        • title string

          Title to display at the notification.

        • body string

          Text below title on the expanded notification.

        • icon string

          Platform-specific icon for the notification.

        • sound string

          Platform-specific sound for the notification.

        • Platform-specific, used to group notifications together.

Responses

POST /push/publish
curl \
 -X POST https://rest.ably.io/push/publish \
 -H "Content-Type: application/json" \
 -d '{"recipient":{"transportType":"apns","deviceToken":"string","registrationToken":"string","clientId":"string","deviceId":"string"},"push":{"data":"string","notification":{"title":"string","body":"string","icon":"string","sound":"string","collapseKey":"string"},"apns":{"notification":{"title":"string","body":"string","icon":"string","sound":"string","collapseKey":"string"}},"fcm":{"notification":{"title":"string","body":"string","icon":"string","sound":"string","collapseKey":"string"}},"web":{"notification":{"title":"string","body":"string","icon":"string","sound":"string","collapseKey":"string"}}}}'
Request example
{
  "recipient": {
    "transportType": "apns",
    "deviceToken": "string",
    "registrationToken": "string",
    "clientId": "string",
    "deviceId": "string"
  },
  "push": {
    "data": "string",
    "notification": {
      "title": "string",
      "body": "string",
      "icon": "string",
      "sound": "string",
      "collapseKey": "string"
    },
    "apns": {
      "notification": {
        "title": "string",
        "body": "string",
        "icon": "string",
        "sound": "string",
        "collapseKey": "string"
      }
    },
    "fcm": {
      "notification": {
        "title": "string",
        "body": "string",
        "icon": "string",
        "sound": "string",
        "collapseKey": "string"
      }
    },
    "web": {
      "notification": {
        "title": "string",
        "body": "string",
        "icon": "string",
        "sound": "string",
        "collapseKey": "string"
      }
    }
  }
}
Request examples
{
  "recipient": {
    "transportType": "apns",
    "deviceToken": "string",
    "registrationToken": "string",
    "clientId": "string",
    "deviceId": "string"
  },
  "push": {
    "data": "string",
    "notification": {
      "title": "string",
      "body": "string",
      "icon": "string",
      "sound": "string",
      "collapseKey": "string"
    },
    "apns": {
      "notification": {
        "title": "string",
        "body": "string",
        "icon": "string",
        "sound": "string",
        "collapseKey": "string"
      }
    },
    "fcm": {
      "notification": {
        "title": "string",
        "body": "string",
        "icon": "string",
        "sound": "string",
        "collapseKey": "string"
      }
    },
    "web": {
      "notification": {
        "title": "string",
        "body": "string",
        "icon": "string",
        "sound": "string",
        "collapseKey": "string"
      }
    }
  }
}
Response examples (default)
# Headers
x-ably-errorcode: 42
x-ably-errormessage: string
x-ably-serverid: string

# Payload
{
  "message": "string",
  "code": 42,
  "statusCode": 42,
  "href": "string",
  "serverId": "string"
}
Response examples (default)
# Headers
x-ably-errorcode: 42
x-ably-errormessage: string
x-ably-serverid: string

# Payload
{
  "message": "string",
  "code": 42,
  "statusCode": 42,
  "href": "string",
  "serverId": "string"
}