Webhooks

Overview

Webhooks mechanism allows platform integrations by subscribing to certain Events. When the Event is triggered, the platform sends an HTTP POST request with the payload to the configured webhook URL.

Subscription

Subscription to the events is configured during instance handshake.

To change existing subscriptions, the handshake can be repeated with a different response body.

Webhook receiver

Here are some requirements and tips for webhook receiver endpoints:

  • An endpoint must respond with HTTP 200 (OK). Otherwise, webhook delivery is retried.

  • Webhook endpoint should respond as quickly as possible. If response time exceeds the predefined duration (5 seconds currently), delivery is considered as failed and retried. If heavy processing is possible within the endpoint routine, it is worth extracting it into background processing (queue).

Error handling and retries

Webhook delivery is considered as failed in such cases:

  • network error

  • response code is not 200 OK

  • it took too long for the receiver to respond (timeout)

In case of failure, delivery is retried. Currently, there are 5 attempts in total to deliver the webhook, with 3 seconds interval between each.

Each event payload has an ID parameter that uniquely identifies the triggered webhook event. It is the same for every delivery retry, so it can be used to guarantee that a specific event is processed once at most.

Webhook body schema

Event payload of any type has the following schema:

Example

{
  "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "ts": 1613718881527,
  "type": "event_created",
  "payload": {
    "event": {
      "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "name": "Event name",
      "source_event_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
    },
    "project": {
      "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "name": "Project name"
    },
    "brand": {
      "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "name": "Brand name"
    },
    "organisation": {
      "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "name": "Organisation name"
    }
  }
}

Webhook event types and payloads

Note that only payload schemas and examples are provided below. The whole structure of the webhook request body is described in Webhook body schema section.

Organisation

organisation_updated

Triggered when an Organisation is updated in Studio.

Payload schema

Payload example

{
  "organisation": {
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  }
}

Brand

brand_updated

Triggered when a Brand is updated in Studio.

Payload schema

Payload example

{
  "organisation": {
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  },
  "brand": {
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  }
}

Project

project_updated

Triggered when a Project is updated in Studio.

Payload schema

Payload example

{
  "project": {
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  },
  "brand": {
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  },
  "organisation": {
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  }
}

Event

event_created

Triggered when an Event is created in Studio.

Payload schema

Payload example

{
  "event": {
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "name": "Event name",
    "source_event_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
  },
  "project": {
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "name": "Project name"
  },
  "brand": {
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "name": "Brand name"
  },
  "organisation": {
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "name": "Organisation name"
  }
}

event_updated

Triggered when an Event is updated in Studio.

Payload schema

Payload example

{
  "event": {
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "source_event_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
  },
  "project": {
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
  },
  "brand": {
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
  },
  "organisation": {
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
  }
}

event_deleted

Triggered when an Event is deleted in Studio.

Payload schema

Payload example

{
  "event": {
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "source_event_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
  },
  "project": {
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
  },
  "brand": {
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
  },
  "organisation": {
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
  }
}

Event template

event_template_created

Triggered when an Event template is created in Studio.

Payload schema

Payload example

{
  "event_template": {
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "name": "Event template name",
    "source_event_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
  },
  "project": {
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "name": "Project name"
  },
  "brand": {
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "name": "Brand name"
  },
  "organisation": {
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "name": "Organisation name"
  }
}

event_template_updated

Triggered when an Event template is updated in Studio.

Payload schema

Payload example

{
  "event_template": {
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "source_event_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
  },
  "project": {
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
  },
  "brand": {
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
  },
  "organisation": {
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
  }
}

event_template_deleted

Triggered when an Event template is deleted in Studio.

Payload schema

Payload example

{
  "event_template": {
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "source_event_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
  },
  "project": {
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
  },
  "brand": {
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
  },
  "organisation": {
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
  }
}

Elements

element_created

Triggered when an Element is created in Studio.

Payload schema

Payload example

{
  "element": {
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  },
  "event": {
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  },
  "project": {
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
  },
  "brand": {
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
  },
  "organisation": {
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
  }
}

element_updated

Triggered when an Element is updated in Studio.

Payload schema

Payload example

{
  "element": {
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  },
  "event": {
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  },
  "project": {
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
  },
  "brand": {
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
  },
  "organisation": {
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
  }
}

element_deleted

Triggered when an Element is deleted in Studio.

Payload schema

Payload example

{
  "element": {
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  },
  "event": {
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  },
  "project": {
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
  },
  "brand": {
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
  },
  "organisation": {
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
  }
}