capabilities.work

Register Webhook for Query

A 3-step recipe with Sanity. We can help you get access.

Recipe · 3 steps

Register Webhook for Query

with Sanity

Confirm a GROQ filter resolves, then register and verify a webhook on it.

  1. Run the GROQ filter as a query so an invalid filter is caught before a webhook is registered against it.
  2. Register a webhook bound to the validated GROQ filter and the requested document event types.
  3. List the project's webhooks to confirm the new webhook is present.
What you'll need to have ready
  • projectId: The project id the webhook is registered against.
  • apiToken: Sanity API token used as a Bearer credential.
  • dataset: Dataset the webhook and validation query target.
  • filter: GROQ filter expression selecting documents to notify on.
  • webhookName: Human-readable name for the webhook.
  • webhookUrl: Destination URL the webhook posts events to.
  • true: Document events to fire on (create, update, delete).
For your developer

Arazzo workflow sanity:register-webhook-for-query, 3 operations: queryDocumentsPost → createWebhook → listWebhooks. Specs on APIs.io.