Webhooks are an essential part of any headless content management system. Webhooks enable you to perform custom business logic, detached from the core workings of GraphCMS.

You can attach webhooks to one or more model, and when any data is added, updated, deleted, published or unpublished. Webhooks can also be triggered per content stage.

When a webhook is invoked, a custom specified URL is triggered, along with any custom configured headers.

Webhooks are great for, and not limited to:

  • Syncing data to external search engine,
  • Syncing data with external PIM,
  • Redeploying your static website when content or assets change,
  • Triggering email campaigns based on new content added.

Webhooks are a paid upgrade. See pricing for further details.

How do our Webhooks Work?

When you create a model in GraphCMS, it registers a worker directly on the database instance. Under the hood, these services generate messages. When the messages get processed, it looks for a registered webhook that matches the conditions of the message created (content stage, action, etc) and will then call the URL defined in the webhook. When you declare that the webhook should include a payload, a basic query from the model definition is generated, including all simple fields (everything except relations).

All webhooks are guaranteed to be attempted exactly once and are executed with near immediacy. A failed response will not retry the webhook.

Working with Webhooks

Create a Webhook

  1. Navigate to Webhooks in the sidebar. Webhooks are in the lower group of icons.

  2. Press "Create" in the upper right corner of the window.

  3. Fill out the details for your Webhook:

    • A name for organzing and finding your webhooks
    • A short description to inform others what your webhook does
    • Toggle if you want to include the payload or not
    • The URL to be called
    • The content model(s) that will be watched
    • The content stage to be watched
    • The action to be watched
    • Any additional headers to pass along

    Note, if you leave Model, Stage or Action empty, it will behave as a wildcard.

  4. Press Create

Enable / Disable a Webhooks

  1. Navigate to Webhooks in the sidebar.
  2. Move your cursor to the title of the webhook, and click the pencil icon that appears.
  3. Switch the the "Active" toggle in the upper right corner to switch between on or off.

Delete a Webhook

  1. Navigate to Webhooks in the sidebar.
  2. Move your cursor to the title of the webhook, and click the trash icon that appears.
  3. Confirm you want to delete the webhook.

Were you expecting something more?

We are constantly contributing to our documentation, but if you spot something we're missing, let us know and we'll be sure to add it.

This site uses cookies to provide you with a better user experience. For more information, refer to our Privacy Policy