A typical webhook is made of three parts. The
destination, and the
payload. Usually, a webhook is triggered by some kind of interaction like saving of content into a database or some service watching a condition on the web gets a truthy input. Once triggered, they make a request to an external endpoint on the web. The payload can be any data that was defined by the webhook, most commonly it includes dynamic content from the trigger source.
The most common use case for webhooks is in the context of a CMS is to trigger a static site build. After content is updated, a build tool is notified and it triggers a new build of the website. But webhooks have endless possibility. A webhook could update a calendar entry that new content is ready for review, could publish new content into the CMS itself, could update an external search index any many more possibilities.
Editing content as the
trigger, Slack notifications as the
destination and 'changed content ready for review' as the
payload is a great automation for your content team.
Netlify's webhook support allows for triggering a git pull from a predefined repo. When content is changed in GraphCMS, it sends a payload to Netlify, which then pulls content from your repo and generates a build. This is known as continous delivery.
Trigger an email to be sent to all subscribed users when you publish new pages with a specific url slug, ie
The possibilities are endless when you connect to one of these three Webhooks as a Service providers. All three of these technologies are great for non-technically savvy and expert developers alike!.
This is a basic Gatsbyjs starter template to use as an example. If you fork this, be sure to pay attention to the environment variables such as your GraphCMS API endpoint and token. As your content editor publishes any changes to your structured content such as a new blog post, updating news article or ecommerce product you can have webhooks trigger a new deploy your site. Blazing fast automation is what makes webhooks a fantastic asset to your workflow.
Webhooks are available starting from the basic plan. Webhooks are essential to a modern headless CMS workflow. You will need to set things up on both the
trigger and the
destination ends. We will be referencing the e-commerce gatsby template if you’d like to follow along. Want a specific example? Join our slack group to get personal help from our developers!
Build and Deploy>
Add build hook, name it, and select which branch to deploy. In our case, we will be deploying the master.
Headers:Section with Key, and Value is optional and not needed for this configuration of webhooks. If you are working with athenticated APIs, this is where you would add that data.
GraphCMS has all of the most important features of a robust content management system, while also pioneering proprietary features for the era of application content. Learn more in these landing pages all about GraphCMS' features.