Setting up a publication flow with webhooks
To start, we need a URL to send a webhook to when content is published in Hygraph. A webhook is a mechanism where a service sends a request when something happens within that service. The request can run and trigger other services to do various actions. In this example, Hygraph will send out a request when content is published. The request will go to Netlify and trigger a build so that our site has fresh content.
To do that, we can go to our host and use a build hook. This functionality may be named differently in each host, but this is what Netlify calls the functionality. This is a URL that a request can be sent to and have Netlify rebuild the site.
To set this up, we need to add some additional information in Netlify and Hygraph:
- Navigate to your project’s Netlify Site Settings and go to the Build and Deploy settings. This page has a section titled Build hooks:
Figure 9.12 – The Build...