Closed weotch closed 4 years ago
You would need to set this up as two separate webhooks – one for element saves, and one for deletes.
Both of them could use the craft\base\Element
class, and the event names would be afterSave
and afterDelete
.
Thanks! And would these be all just up the middle? It's been unclear to me what the 3 statuses mean.
That’s explained here: https://github.com/craftcms/webhooks#filtering-events
The only thing I don't want to trigger the webhook for is changes to drafts, autosaves, or non-enabled entries; essentially anything that isn't ready for production.
So in your case you’d want to set the filters up like so:
In other words, only trigger the webhook when all of the following are true:
Note that the “Element is enabled” filter was just added in v2.3.1, so you will need to update to get access to that.
Assuming no actual element info is needed to be sent along with the webhook, you should give each of your webhooks a Debouncing Key Format of something like element
, so that multiple element saves in the same request don’t result in multiple webhook requests.
Ha it really was just added, wasn't it? Thanks!!
I was hoping to get some advice on how to best use webhooks to trigger a new static build at Netlify whenever content changes. I'm coming from a Contentful background where my configuration looks like this:
I want to trigger a rebuild on any change of content, whether it's a creating a new entry, an update, a bulk change, a re-order in a list, a change of publish status, a delete, etc. The only thing I don't want to trigger the webhook for is changes to drafts, autosaves, or non-enabled entries; essentially anything that isn't ready for production.
I think this is useful for anyone using Craft headlessly with a static site generator.
Thanks!