What are Webhooks?

Webhooks are a powerful concept that enable you to execute your own business logic an event occurs. Or in more plain terms, they are the secret messengers of the internet, connecting information between many different platforms. There are 3 main parts to a webhook:

  • Trigger: An action that signals that information needs to be sent.
  • Destination: Where the information gets sent.
  • Payload: The information/data that gets sent.

Webhooks are available starting from the Basic Plan. New Projects can be started in a two-week trial, where you get access to higher-tier features like Webhooks and Content Localization.

Setting up a Webhook in GraphCMS

Webhook card in GraphCMS

Creating a webhook in GraphCMS is straight forward. Navigate to the WEBHOOKS view in the sidebar and click the CREATE button.

1. Name Give your webhook a name. What is its purpose?

2. Description (optional) Help yourself and others know what the webhook does by giving it a memorable description.

3. Scope Choose between MINIMAL and EXTENDED. Minimal is ideal for deployment webhooks, for example to Netlify, as it sends the minimal amount of data. Extended is sending the full body of what was provided to the executing mutation.

4. URL Define what url should be requested by the webhook. This will be the external url from a destination such as Netlify.

5. Headers (optional) Define the key and value pairs for which header values your URL will expect. If you are working with authenticated APIs, this is where you would add that data.

This is only half of the equation though, you'll need to hook up the destination! Check out the webhooks landing page for inspiration on how to do this including setting up Netlify build hooks with GraphCMS.

Currently webhooks are global in GraphCMS. The trigger is any content action such as create, save, update, etc. We are working on granular controls for webhooks. Stay up-to-date on granular webhooks here.