Skip to main content

Documentation Index

Fetch the complete documentation index at: https://import-docs.prequel.co/llms.txt

Use this file to discover all available pages before exploring further.

A webhook_record destination delivers one HTTP request per record. For the API call to register a destination with Prequel, including a complete example, see Create Destination. For higher-volume workloads, consider the Batch API, which delivers multiple records per request.

Authentication

Prequel signs every delivery request with the X-Prequel-Webhook-Signature header so your endpoint can validate the request originated from Prequel. Fetch the public key for verification from GET /public/signatures/webhook-public-key. See Webhook headers for the full header list and verification steps.

Creating your destination spec

The destination object allows you to customize the contract between data shared by your customers and the shape Prequel provides to your receiving endpoint. Example: Suppose you are importing a users table with string fields id, email, and subscription. Below are four possible shapes for a webhook_record destination. These are not exhaustive and features can be combined to conform to your endpoint’s requirements:
  1. Schema as body: Each request body is the record in the shape declared by record_schema, with no additional shaping.
  2. Custom body: Use a body template to customize each record.
  3. Routed by provider: uri and/or headers vary at delivery time using the ProviderID delivery-level identifier.
  4. Destination per provider: A separate destination is registered for each provider, with a record_schema that includes provider-specific custom fields.
POST destination payload
{
  "name": "users-record-destination",
  "type": "webhook_record",
  "record_schema": {
    "type": "object",
    "properties": {
      "id":    { "type": "string" },
      "email": { "type": "string" },
      "subscription": { "type": "string" }
    },
    "required": ["id", "email"]
  },
  "webhook_record": {
    "request_template": {
      "method": "POST",
      "uri": "https://example.com/prequel/records",
      "headers": { "Content-Type": "application/json" }
    }
  }
}
1

Name your destination

Set name (string, required) to a unique identifier for this destination within your account.
2

Set the destination type

Set type (string, required) to webhook_record for per-record deliveries.
3

Declare your record schema

Set record_schema (object, required) to a JSON Schema (draft-07) document that declares the fields each record contains. Prequel validates records against this schema before delivery.
4

Configure the request template

Set webhook_record.request_template (object, required) with the HTTP method (string, defaults to POST), uri (string, required), and optional headers (object). The uri and headers templates support the .Prequel.* namespace, .Record.* fields, and .IsDeleted. With no body template, Prequel sends each record as a JSON object.
5

Tune optional throughput limits

Optionally set webhook_record.max_records_per_minute (integer, default 3000) and webhook_record.max_concurrency (integer, default 1) to control delivery throughput.

Template variables

The body, uri, and headers templates all have access to every variable below.
VariableTypeDescription
{{.Record.<field>}}anyValue of a specific field from the record (e.g. {{.Record.email}}). The field must be declared in record_schema.
{{.Record.AsJson}}objectThe full record serialized as a JSON object.
{{.IsDeleted}}booleantrue when Prequel is delivering a record deletion, false otherwise.
{{.Prequel.ProviderID}}stringIdentifier for the provider whose data is being delivered.
{{.Prequel.LoadID}}stringIdentifier for the active load job.
{{.Prequel.DestinationID}}stringIdentifier for the destination receiving this delivery.
{{.Prequel.StreamID}}stringIdentifier for the stream this delivery came from.

Webhook headers

Prequel includes the following headers on every delivery request.
HeaderDescription
X-Prequel-Webhook-SignatureSHA-256 RSA PKCS1 v1.5 signature of the payload. To verify, fetch the public key from GET /public/signatures/webhook-public-key and check the hex-decoded signature against the SHA-256 of <X-Prequel-Webhook-Timestamp>.<raw body> using PKCS1 v1.5.
X-Prequel-Webhook-TimestampRFC 3339 timestamp of when the request was sent. Reject stale timestamps to prevent replay attacks.
X-Prequel-Webhook-DigestSHA-256 hash of the raw request body.
Content-TypeDefaults to application/json unless overridden by the headers template.

Response codes

Your endpoint should respond with an appropriate HTTP status code. Prequel uses the response to determine whether to retry delivery.
CodeDescription
2xxSuccess. Prequel treats a 2xx response as a successful delivery.
400Bad Request. Malformed or missing fields. Prequel will not retry.
403Forbidden. Invalid signature or credentials. Prequel will not retry.
404Not Found. Endpoint or resource could not be found. Prequel will not retry.
413Payload Too Large. Request body exceeds your endpoint’s size limit. Prequel will not retry.
422Unprocessable Entity. Validation failed for specific fields. Prequel will not retry.
429Too Many Requests. Rate limit exceeded. Prequel will back off and retry.
431Request Header Fields Too Large. Prequel will not retry.
Other 4xxOther client error. Prequel will not retry.
500Internal Server Error. Unexpected error during processing. Prequel will retry.
502Bad Gateway. Upstream error. Prequel will retry.
503Service Unavailable. Prequel will retry.
504Gateway Timeout. Request timed out. Prequel will retry.
Other 5xxOther server error. Prequel will retry.