Webhooks are a convenient and powerful way to let external systems know when content in Sapwood has changed. Webhooks work on a per-template basis and can be configured via the webhook_url option.

When an element is created or updated using a template that has a webhook_url configured, it will send a POST request to the URL you specified, the body of which will be a JSON object that matches what that element would return if you queried it directly through the API.

We see webhooks being used for purposes of all shapes and sizes. Consider a couple examples:

Say you're building a simple website with pages and posts and using Sapwood as your CMS. And perhaps you are building a navigation menu with data from Sapwood. Well, it could be a lot of heavy-lifting to need to hit the Sapwood API every time you need to render the menu, so you decide to cache it. But you need to know when one of the menu items is updated, so you add an endpoint on your app and use that URL to rebuild the menu cache whenever a menu item is updated in Sapwood.

What if you're using Sapwood to power a todo list? Maybe you want to post to Slack whenever an item is marked as complete. You could use a Sapwood webhook to have an external app that forwards the todo item to Slack if marked as complete.

There are tons and tons of uses for Sapwood webhooks. We want to hear how you use webhooks so we can share with the community. Let us know!.