Receiving a Webhook Event

How Guru delivers events, how retries and error responses work, and what SINGLE and BATCH payloads look like.

Process webhook events as quickly as possible. Delays in processing the HTTP request can cause subsequent events to back up and, in extreme cases, cause events to be lost. Requests are made with a 15-second timeout; if the event is not consumed within that time, the request is considered a failure and is retried.

👍

Consume events asynchronously

The best practice is to submit each event to an internal queue and return from the HTTP request immediately. This isolates Guru (the sender) from delays and failures in your actual event processing.

Error responses

Connection failures and error responses (any status code other than 2xx) are retried a limited number of times.

  • 4xx responses alert the webhook owner aggressively, because they typically indicate a terminal failure that requires user intervention, such as a misconfiguration.
  • 410 is handled specially: if Guru receives it, the webhook is automatically disabled.
  • 5xx responses and general connection failures are treated as transient and will not trigger alerts unless enough failures accumulate to result in an undeliverable event.

Example event (SINGLE)

{
  "id": "64753163-9817-4500-9651-96177c32e3d1",
  "eventType": "card-created",
  "user": "[email protected]",
  "eventDate": "2021-04-13T13:53:00.000+0000"
}

Example event (BATCH)

{
  "items": [
    {
      "data": {
        "channelId": "wh:b6109be3-9b86-4fb3-ae1a-5faa94b4fc97",
        "messages": [
          {
            "id": "0d765ec1-72c8-4443-970a-459faa3e5aa2:0",
            "timestamp": 1620666399291,
            "data": "{\"id\":\"64753163-9817-4500-9651-96177c32e3d1\",\"eventType\":\"card-created\",\"user\":\"[email protected]\",\"eventDate\":\"2021-04-13T13:53:00.000+0000\"}",
            "name": "card-created"
          }
        ]
      }
    }
  ]
}

A few notes on the examples:

  • They are edited to remove additional fields that are unimportant for consumers.
  • The items and messages fields are both arrays and can contain more than one element.
  • The data value inside messages is a string that must be parsed in order to be processed as JSON.