Webhook Reference

All webhooks are POST requests with JSON bodies sent to the webhookUrl specified when publishing.

Request Body Schema

  • publishId (string): The unique identifier returned from the Publish API for this notification.
  • status (string): Code describing the type of webhook.
  • requestBody (string): The body of the request sent to the Publish API when publishing this notification.
  • results (object): A mapping from the platfom name ("apns", "fcm") to the result object for that platform.

Response Schema

  • failed (boolean): If this field istrue this means that the publishing process for the specified platform has failed completely and no other statistics can be given.
  • numSuccessfulPublishes (number): The number of devices we successfully published to.
  • numFailedPublishes (number): The number of devices that we failed to publish to.

Publish Started Hook

Status

STARTED

Description

We have started publishing to the devices subscribed to the specified interests.

Example

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
{
  "publishId": "pubid-9e5f186a-93d9-4b79-af37-2a946d73e2b5",
  "status": "STARTED",
  "requestBody": {
    "interests": [
      "my_interest",
    ],
    "webhookUrl": "http://mysite.com/push-webhook",
    "fcm": {
      "notification": {
        "title": "New Message",
        "body": "Alex Smith just sent you a new message"
      }
    },
    "apns": {
      "aps": {
        "alert": {
          "title": "New Message",
          "body": "Alex Smith just sent you a new message"
        }
      }
    }
  }
}

Publish Finished Hook

Status

FINISHED

Description

We have finished publishing the push notiification to devices subscribed to the specified interests.

Example

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
{
  "publishId": "pubid-9e5f186a-93d9-4b79-af37-2a946d73e2b5",
  "status": "FINISHED",
  "requestBody": {
    "interests": [
      "my_interest",
    ],
    "webhookUrl": "http://mysite.com/push-webhook",
    "fcm": {
      "notification": {
        "title": "New Message",
        "body": "Alex Smith just sent you a new message"
      }
    },
    "apns": {
      "aps": {
        "alert": {
          "title": "New Message",
          "body": "Alex Smith just sent you a new message"
        }
      }
    }
  },
  "results": {
    "apns": {
      "numSuccessfulPublishes": 486546,
      "numFailedPublishes": 5
    },
    "fcm": {
      "numSuccessfulPublishes": 98423
    }
  }
}