Marketora

Technical & Integration Support

Webhooks and Cache Clearing (Next.js & Frappe)

Understanding On-Demand ISR

Marketora avoids the sluggish rebuild cycles of traditional static site generators by pairing Next.js On-Demand ISR (Incremental Static Regeneration) with Frappe Document Event Hooks.

How the Revalidation Loop Operates

  1. Frappe doc_events: Whenever a content document (e.g., MK Help Article or MK Blog Post) is created, updated, or trashed, Frappe triggers marketora_cms.revalidate.on_content_change.
  2. Tag Resolution: The CMS calls doc.revalidation_tags() to gather the precise cache tags affected. For an article with slug welcome-to-marketora, the tags include help-article:welcome-to-marketora and help-articles.
  3. Secure POST Webhook: Frappe sends a POST request to your Next.js application at /api/revalidate containing the tags and the shared secret:
  4. {
      "secret": "YOUR_REVALIDATE_SECRET",
      "tags": ["help-article:welcome-to-marketora", "help-articles"]
    }
  5. Timing-Safe Validation: Next.js verifies the secret using a timing-safe equality check, calls revalidateTag(tag) for each tag, and confirms revalidation with HTTP 200.

Debugging Cache Issues

If updates are not reflected immediately, ensure that:

  • The marketing_url and revalidate_secret keys are present in site_config.json on your Frappe bench.
  • The Next.js environment has the matching REVALIDATE_SECRET variable set.
We use first-party analytics to improve Marketora, and Google Analytics to understand site traffic. Nothing loads until you accept.