Refresh your site with a webhook
Page
Guide
Updated 13/11/2026
After publishing, the site should show the new version at once. There are three layers of assurance; the webhook is the fastest.
- Webhook (about 1 second in the CMS measurements): the CMS calls the site, the site clears the entry’s cache.
- 60-second TTL on every CMS call the site makes: the safety net when a webhook is missed or the endpoint is paused.
- CDN in front: entries carry
s-maxage=300. Either purge the CDN by tag when the webhook arrives, or keep the CDN TTL at 60 seconds or less.
Before you start
- The CMS server runs background jobs (
CMS_WORKERS_ENABLED=true). Without it there are no webhooks, only the 60-second TTL. - The site endpoint uses
httpsand a public address. The CMS blocks internal addresses and checks again on every delivery. - Permission
cms.webhook.writeto register.
Steps
- Register the endpoint:
POST /admin/cms/webhookswith the siteurl(the sample code uses/api/cms-webhook) and the events you need:cms.entry.published,cms.entry.unpublished,cms.entry.deleted,cms.entry.undeleted. - Save the
whsec_…secret immediately: the CMS returns it once. - In the endpoint, verify the signature per Standard Webhooks before anything else: the signed content is
webhook-id.webhook-timestamp.raw-body, HMAC-SHA256, headerwebhook-signature. Use the raw body, not a re-serialised one. The sampleneutral/revalidate-handler.mjsdoes this. - Clear the cache tag (or path) of the entry and answer 2xx quickly. The same
webhook-idcan arrive more than once: handling a repeat must be harmless. - Set
revalidate: 60(Next) orttlMs: 60000on every CMS call as the safety net.
Operating it
- Rotate the secret with
POST /admin/cms/webhooks/{id}/rotate-secret; the old secret keeps working forgrace_seconds(up to 7 days) so no event is lost. - An endpoint that fails many times in a row is paused; read the delivery log at
GET /admin/cms/webhooks/{id}/deliveriesand retry with…/deliveries/retry. - The event only says which entry changed. The site always re-reads content from the Store API and never trusts data in the webhook body.