Skip to main content

Prerequisites

The connector should already be set up, with a Connector Profile and a Linked Account. See Getting Started on the Sanity connector page.

How webhooks are set up

StackOne creates and manages the webhook subscription automatically when the account is connected. StackOne creates one GROQ-powered document webhook named StackOne in your Sanity project that covers all datasets and exactly the events you enable, and deletes it when the account is disconnected. There is nothing to configure in Sanity.

  • Connect with a project API token that includes Blueprints Deployer (sanity.io/manage > your project > API > Tokens > Add API token > Permissions > Other roles). Blueprints Deployer alone is enough to create and delete the webhook; add Editor and Access Manager only if the same connection also runs document or access-management actions.
  • The webhook appears in sanity.io/manage under your project > API > Webhooks as StackOne. Do not edit or delete it — changing its URL, dataset, or triggers stops event delivery.
  • Draft (drafts.) and release version (versions.) documents are ignored — only changes to published documents fire events.

Available webhook events

The following Sanity events can be enabled. Only events selected in StackOne are included in the webhook triggers — Sanity does not deliver events that are not subscribed.

1

Document events

Events fired when published documents change in any dataset of the project.

  • Document Created (create) — Fired when a new published document is created.
  • Document Updated (update) — Fired on every change to an existing published document.
  • Document Deleted (delete) — Fired when a published document is deleted or unpublished.

Delivery format

Details of how Sanity delivers events to StackOne.

1

One request per document

Sanity sends one JSON POST per changed document, even when a single transaction changes several documents. The body contains _id, _type, _rev, operation, and the document before and after the change (before is null on create, after is null on delete).

2

Operation headers

Each delivery carries the sanity-operation header (create, update, or delete), which StackOne uses to route the event, plus sanity-document-id, sanity-dataset, sanity-transaction-id, sanity-transaction-time, and an idempotency-key for de-duplicating retries.

3

Retries

Sanity retries a failed delivery twice, 30 seconds apart, on timeouts, 429, and 5xx responses. StackOne responds with 200 OK automatically.

Verify

Your Connector should now be able to receive and process events. Try triggering an event and you should see an Event appear in the Connector logs.