Connect

Webhooks

Receive an HTTP callback when records change.

You may receive an HTTP callback when a record is created, updated, replaced or deleted. Charter POSTs a JSON payload to a URL you choose. Delivery runs on the webhooks job queue. charter serve, charter dev and charter work process that queue.

For an in-process stream on the same GET paths as JSON:API, see Realtime (Server-Sent Events). Webhooks remain the outbound HTTP path when another service should receive events.

Define a subscription#

In the config file, you may declare a subscription like this:

[[webhooks]]
name = "posts-to-slack"
url = "https://hooks.example.com/charter/posts"
eventPattern = "posts.*"
enabled = true

[webhooks.headers]
X-Source = "charter"

[webhooks.retryConfig]
maxAttempts = 5
backoffMultiplier = 2.0
initialDelayMs = 1000
maxDelayMs = 300000

On import, Charter generates an HMAC secret. Do not put a secret in the file. You can also manage webhooks with charter webhooks or the MCP webhook tools (create, list, get, delete; update is CLI-only today).

Event patterns#

Lifecycle event names are {resource}.created, {resource}.updated, {resource}.replaced and {resource}.deleted.

Pattern Matches
posts.created Exact event
posts.* Every event on posts
*.created Creates on any resource
* Everything

Payload#

{
  "event": "posts.created",
  "resource": "posts",
  "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "before": null,
  "after": { "title": "Hello", "status": "draft" },
  "actor": { "userId": "…", "role": "user" },
  "trace": {
    "traceId": "…",
    "spanId": "…",
    "traceparent": "…"
  }
}

before and after hold the record attributes for the change. Deletes set after to null; creates set before to null.

Info

Config may list fieldIds to trim before / after on each delivery. Despite the name, each entry is a field name (JSON attribute key), not a registry UUID. When the list is non-empty, Charter keeps id plus those keys and drops the rest; omit fieldIds (or leave it empty) to send the full record.

Delivery headers#

  • x-charter-event: the event name (for example posts.created)
  • X-Charter-Signature: sha256=<hex>: HMAC of the body when the webhook has a secret
  • Optional W3C traceparent when a trace context was captured at dispatch

Non-2xx responses and transport errors retry with backoff until the attempt budget is exhausted. Disabled or deleted webhooks are skipped. Delivery refuses non-public target addresses (SSRF protection).

Operations#

Keep a worker running wherever you expect deliveries (charter serve embeds one; use charter work if you split the worker). Disable a subscription with enabled = false or charter webhooks disable without deleting it.