Contentful Webhook Integrations Setup

Our company is engaged in the development, support and maintenance of sites of any complexity. From simple one-page sites to large-scale cluster systems built on micro services. Experience of developers is confirmed by certificates from vendors.
Development and maintenance of all types of websites:
Informational websites or web applications
Business card websites, landing pages, corporate websites, online catalogs, quizzes, promo websites, blogs, news resources, informational portals, forums, aggregators
E-commerce websites or web applications
Online stores, B2B portals, marketplaces, online exchanges, cashback websites, exchanges, dropshipping platforms, product parsers
Business process management web applications
CRM systems, ERP systems, corporate portals, production management systems, information parsers
Electronic service websites or web applications
Classified ads platforms, online schools, online cinemas, website builders, portals for electronic services, video hosting platforms, thematic portals

These are just some of the technical types of websites we work with, and each of them can have its own specific features and functionality, as well as be customized to meet the specific needs and goals of the client.

Our competencies:
Development stages
Latest works
  • image_website-b2b-advance_0.png
    B2B ADVANCE company website development
    1212
  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1161
  • image_websites_belfingroup_462_0.webp
    Website development for BELFINGROUP
    852
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1041
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    822
  • image_bitrix-bitrix-24-1c_fixper_448_0.png
    Website development for FIXPER company
    815

Setting up Contentful Webhook Integrations

Webhooks in Contentful trigger on content changes: publishing, archiving, entry creation, asset deletion. Primary use — cache invalidation and static site rebuilds without polling.

Creating a Webhook

In Web App: Settings → Webhooks → Add Webhook. Via CMA:

const space = await cmaClient.getSpace(spaceId);
await space.createWebhook({
  name: 'Next.js ISR Revalidation',
  url: 'https://mysite.com/api/revalidate',
  topics: ['Entry.publish', 'Entry.unpublish', 'Asset.publish'],
  filters: [
    // Only for specific Content Type
    {
      equals: [{ doc: 'sys.contentType.sys.id' }, 'blogPost'],
    },
  ],
  headers: [
    {
      key: 'x-webhook-secret',
      value: process.env.CONTENTFUL_WEBHOOK_SECRET,
      secret: true, // value hidden in UI
    },
  ],
  active: true,
});

Webhook Handler in Next.js

// app/api/revalidate/route.ts
export async function POST(request: Request) {
  const secret = request.headers.get('x-webhook-secret');
  if (secret !== process.env.CONTENTFUL_WEBHOOK_SECRET) {
    return Response.json({ error: 'Unauthorized' }, { status: 401 });
  }

  const payload = await request.json();
  const contentTypeId = payload.sys?.contentType?.sys?.id;
  const slug = payload.fields?.slug?.['en-US'];
  const topic = request.headers.get('x-contentful-topic'); // e.g. 'ContentManagement.Entry.publish'

  switch (contentTypeId) {
    case 'blogPost':
      if (slug) revalidatePath(`/blog/${slug}`);
      revalidatePath('/blog');
      break;
    case 'landingPage':
      revalidatePath('/');
      break;
    default:
      revalidateTag('contentful');
  }

  return Response.json({ revalidated: true, topic });
}

Integration with Vercel Deploy Hooks

For static regeneration of entire site — direct call to Vercel Deploy Hook:

// Separate webhook endpoint for full rebuild
export async function POST(request: Request) {
  await fetch(process.env.VERCEL_DEPLOY_HOOK_URL!, { method: 'POST' });
  return Response.json({ triggered: true });
}

Filtering by topics allows separation: small edits → ISR-invalidation of specific page, structural changes → full deploy.

Transformations and Retry

Contentful retries webhook requests on errors (non-2xx status) with exponential backoff. View call history — Settings → Webhooks → [webhook name] → Activity. For debugging use webhook.site as temporary URL during development.

Basic webhook setup (ISR + Netlify/Vercel build trigger) takes 2–4 hours.