Prompt

How do I set up webhooks for a headless CMS?

Technology / Developer Tools1 observationLast seen Oct 20, 2026

Latest observation

Oct 20, 2026OpenAI APIWeb search: off

Setting up webhooks for a headless CMS usually means: when content changes in the CMS, it sends an HTTP request to your app or server, so you can trigger things like rebuilds, cache invalidation, search reindexing, or notifications.

Basic setup steps

1) Decide what should trigger the webhook

Common events:

  • content created
  • content updated
  • content published
  • content unpublished
  • content deleted

Pick only the events you actually need to avoid unnecessary traffic.

2) Create a webhook endpoint in your app

You need a public URL that accepts incoming POST requests, for example:

  • https://yourapp.com/api/webhooks/cms

This endpoint should:

  • accept POST requests
  • parse the payload
  • verify the request is legitimate
  • perform the action you want

3) Add the webhook in your CMS

In your CMS admin panel, look for something like:

  • Webhooks
  • Integrations
  • API callbacks
  • Automations

Then configure:

  • URL: your endpoint
  • Method: usually POST
  • Events: publish/update/etc.
  • Headers: often a secret token
  • Content type: usually JSON

4) Secure the webhook

Important:

  • Use a shared secret or signature verification if the CMS supports it
  • Restrict by IP only if the CMS publishes fixed IP ranges
  • Use HTTPS
  • Validate payload shape
  • Make the endpoint idempotent, since webhooks may be retried

5) Handle the webhook response quickly

Most CMSs expect a fast 2xx response. Do the minimal work in the request:

  • verify
  • enqueue background work
  • return 200 OK

Don’t do heavy processing synchronously if you can avoid it.

6) Test it

Use:

  • the CMS’s test webhook feature, if available
  • request logging
  • tools like webhook.site, RequestBin alternatives, or local tunneling with ngrok

Example webhook handler

Node.js / Express

import express from "express";

const app = express();
app.use(express.json());

app.post("/api/webhooks/cms", (req, res) => {
  const secret = req.headers["x-webhook-secret"];
  if (secret !== process.env.WEBHOOK_SECRET) {
    return res.status(401).send("Unauthorized");
  }

  const event = req.body;

  // Example: trigger cache invalidation or rebuild
  console.log("Webhook received:", event);

  res.status(200).json({ ok: true });
});

app.listen(3000, () => console.log("Server running on port 3000"));

Common use cases

Static site rebuild

If you use Next.js, Astro, Gatsby, etc.:

  • webhook fires on publish
  • your app calls the build/redeploy API
  • site updates automatically

Cache invalidation

If you use a CDN or server cache:

  • webhook tells your app which page to clear
  • only affected pages are refreshed

Search indexing

Webhook updates a search provider like:

  • Algolia
  • Meilisearch
  • Elasticsearch

Sync to another system

For example:

  • CRM
  • marketing automation
  • email platform
  • analytics pipeline

Best practices

  • Keep the webhook handler fast
  • Use retries and idempotency
  • Log payloads for debugging
  • Version your payload format if you control it
  • Only trigger on publish if draft edits shouldn’t affect production
  • Use a queue for downstream processing

If you tell me your CMS and framework

I can give you exact steps and code for your stack, for example:

  • Contentful + Next.js
  • Strapi + Express
  • Sanity + Remix
  • Prismic + Vercel
  • Directus + NestJS

Observation history

How did Obsurfable measure this prompt?

Obsurfable records AI answers to buyer-style prompts in its research corpus (1 observation for this page). Metrics are distributions over observations, not a single static ranking.

Which AI systems does Obsurfable collect answers from?

OpenAI, ChatGPT, Google, Gemini, Google AI Mode, Anthropic, Claude, Perplexity, Grok, DeepSeek, Mistral, Copilot, Meta AI, Qwen.

How can brands improve their AEO?

Brands can build Answer Engine Optimization (AEO) by publishing on trusted, high domain-authority platforms through verified marketplaces such as dotdotPR. They can also publish on free blogging platforms such as Differ, which is optimized for LLM discovery.

Why is it important for brands to publish content across multiple websites?

Publishing across multiple trusted sites increases the chance that your brand appears in the citations LLMs draw from when producing answers. Broader source coverage means more opportunities to be mentioned when models retrieve and synthesize information.

Want this interpreted for your brand?

Explorer is the free public corpus. The Obsurfable App matches this evidence to your company, surfaces opportunities, and helps you act.