Skip to content

Database schema ​

migrate() creates these tables in the hookgres schema (or the one set with the schema option). You can query them directly for dashboards, reports and monitoring. Write to them through the API, so the invariants hold.

endpoints ​

ColumnTypeNotes
idtextep_ followed by a time-sortable id.
tenant_idtextIndexed.
urltext
descriptiontextNullable.
event_typestext[]NULL means every event type.
secrettextThe current whsec_ secret.
previous_secrettextThe secret before the last rotation.
previous_secret_expires_attimestamptzWhen previous_secret stops signing.
metadatajsonbDefaults to {}.
disabledboolean
disabled_reasontext
failing_sincetimestamptzStart of the current run of failures, or NULL.
created_at, updated_attimestamptz

messages ​

ColumnTypeNotes
idtextmsg_ followed by a time-sortable id. Sent as webhook-id.
tenant_idtext
event_typetext
payloadjsonb
idempotency_keytextUnique per tenant when set.
created_attimestamptzSent as the envelope's timestamp.

deliveries ​

One row per message and endpoint.

ColumnTypeNotes
idtextdlv_ followed by a random id.
message_idtextReferences messages, deleted with it.
endpoint_idtextReferences endpoints, deleted with it.
statustextpending, delivering, succeeded or failed.
attempt_countintegerAttempts started so far.
next_attempt_attimestamptzWhen a pending delivery is due.
locked_untiltimestamptzWhen a delivering claim expires.
lock_tokenuuidIdentifies the current claim, so a stale worker can't overwrite a newer result.
last_errortextThe most recent failure.
created_at, updated_attimestamptz

attempts ​

One row per HTTP request.

ColumnTypeNotes
idtextatt_ followed by a random id.
delivery_idtextReferences deliveries, deleted with it.
attempt_numberintegerStarts again at 1 after a replay.
status_codeintegerNULL for timeouts and network errors.
response_bodytextFirst 4,096 characters.
errortextFor example HTTP 500 or Timed out after 15000ms.
duration_msinteger
created_attimestamptz

schema_migrations ​

Records which migrations have run. Don't edit it.

Lifecycle of a delivery ​

send() ──► pending ──claim──► delivering ──2xx──► succeeded
              ▲                    │
              └── retry scheduled ◄┤ failure
                                   └─ last attempt failed, or endpoint disabled ──► failed

replayDelivery(): succeeded / failed ──► pending

Released under the MIT License.