Integrate Hygraph with Algolia

Get started with syncing published content to Algolia with GraphCMS webhooks, and Next.js API routes.

InstallView repoCheck out the demo


Using Hygraph webhooks to sync data to Algolia on new published content.

Hygraph boasts granular webhooks that give you the power to watch specific changes to data. This example is using a simple schema that contains products and watching for any new product drafts being promoted to the PUBLISHED stage.

When they do, a webhook to a Next.js API route is triggered, in this case /api/webhook.

The code in this webhook checks if the request is in fact a POST request, and has a Authorization header value that matches what we have record. If all is well, the rest of the serverless function is responsible for syncing data to Algolia.

Was this useful?


Built by Algolia's developer community, not supported by Algolia




GraphCMS gives you instant GraphQL Content APIs to create, enrich, unify, and deliver your content across platforms.

Jamie Barton

Jamie Barton

A software engineer turned developer advocate. Born and bred in North East England, he loves learning and teaching others through video and written tutorials. Jamie maintains Build your DXP, Headless Commerce Resources, and GraphQL WTF.

Recommended content

Backend Tools
Algolia pick

Integrate Wordpress with Algolia

Integrate Algolia with WordPress. Improve search on your site. Autocomplete is included, along with full control over look, feel and relevance.

  • PHP
  • Vanilla Javascript

Integrated with: