Sparkbox Webhook Documentation

HTTP POST payloads that are delivered to your webhook's configured URL endpoint contain several important properties.

HTTP Headers

Sparkbox webhooks contain special HTTP headers. Below are the headers used:

HTTP Body

Sparkbox webhooks deliver payloads in JSON format. Below is an overview of the payload structure.

Payload Structure

1. Event Object

2. Data Object

Example:

{
  "event": {
    "id": "abcdefgh-ijkl-mnop-qrst-uvwxyz012345",
    "event_type": "model.submitted",
    "timestamp": "2023-11-16T12:30:45Z",
    "api_version": "v1"
  },
  "data": [
    // Event-specific data
  ]
}

Event Types

1. Event Type: model.submitted

2. Event Type: model.approved

3. Event Type: model.retracted

HTTPS

Using HTTPS is recommended for your webhook URL because it is more secure. Sparkbox webhooks support either HTTP or HTTPS. If you are using HTTPS, your SSL/TLS certificate must be validated. (Self-signed certificates are not supported.)

Validate payloads

Ensure your server only processes webhook payloads that were sent by Sparkbox by validating the signature before processing the payload further.

If one is provided, Sparkbox will use a secret token to create an HMAC signature sent as the value of the X-Sparkbox-Signature header.

To validate the payload, generate the signature yourself by creating a hash of the entire received payload (using the shared secret as a key) and compare that signature with the signature you receive from Sparkbox.