Subscription Feeds

Each subscription object has a set of activity feeds -

  • https://api.intercom.io/subscriptions/{id}/sent : A feed of notifications sent.
  • https://api.intercom.io/subscriptions/{id}/error : A feed of errors returned by the webhook.

Where {id} is the value of the subscriptions's id field.

The feeds are not permanent archives and notifications may only retrievable for a period of time; a best effort is made to keep 30 days of activity data.

Subscription Error Feed

Example Notification with error

{
  "type" : "notification.list",
  "notifications" : [
    {
      "type": "notification_event",
      "topic": "company.created",
      "id": "notif_ccd8a4d0-f965-11e3-a367-c779cae3e1b3",
      "created_at": 1392731331,
      "data": {
        "item": {
          "type": "company",
          "id": "531ee472cce572a6ec000006",
          "name": "Blue Sun",
          "company_id": "6",
          "remote_created_at": 1394531169,
          "created_at": 1394533506,
          "updated_at": 1396874658,
          "custom_attributes": {
          }
        }
      },
      "http_request" : {
        "request_method" : "POST",
        "request_uri" : "https://example.org/hooks/1",
        "request_headers" : {
          "Accept" : "application/json",
          "User-Agent" : "intercom-parrot-service-client/1.0",
          "Content-Type" : "application/json"
        },
        "request_entity" : "{\"type\":\"self\"}",
        "response_status_code" : 500,
        "response_headers" : {
          "X-Frame-Options" : "SAMEORIGIN",
          "Server" : "Apache",
          "Connection" : "keep-alive",
          "Vary" : "Accept-Encoding",
          "Content-Length" : "7",
          "Date" : "Tue, 12 Aug 2014 02:14:54 GMT",
          "Content-Type" : "text/plain"
        },
        "response_entity" : "You might wanna look to that\n"
      }
    },
    ...list of errors...
  ]
}
NotificationErrorCollection errs =
  Subscription.errorFeed(subscription.getId());

while (errs.hasNext()) {
  NotificationError err = errs.next();

  RequestResponseCapture c = err.getCapture();

  URI requestURI = c.getRequestURI();
  String method = c.getRequestMethod();
  Map<String, String> reqHeaders = c.getRequestHeaders();
  String reqEntity = c.getRequestEntity();

  int statusCode = c.getResponseStatusCode();
  Map<String, String> resHeaders = c.getResponseHeaders();
  String resEntity = c.getResponseEntity();
}

The error feed for a subscription,https://api.intercom.io/subscriptions/{id}/error, contains a list delivery failures. Each item in the list is the notification that also contains a http_request object that captures the request details.

The http_request object has the following fields -

AttributeTypeDescription
typestringvalue is 'http.request'
request_methodstringThe HTTP method.
request_uristringThe fully qualified request URI
request_headersobjectAn object containing the request header names and values sent to the server
response_status_codenumberThe HTTP response code returned by the server
response_headersobjectAn object containing the response header names and values returned by the server
response_entitystringThe response body returned by the server. If the response was JSON, the data will be escaped.
request_entitystringThe request body sent to the server.

The request_entity will contain an escaped JSON document with a field called "type" whose value is "self" indicating the containing notification JSON was what was submitted to the server.

A notification may appear multiple times in the error feed, once for each failed attempt to send.