Webhook for draft posts & pages

I’m running Ghost v4 on the Ghost(Pro) platform and I’m looking to find a way to get notified when a draft post and page is created, edited and deleted.

There’s quite a few Webhook options in Ghost but none that appear to listen out for draft posts and pages. At present I’m using the Content API for generating my site. However I’d like to set up a preview instance which will show draft posts for previewing. I’ve gotten the Admin API working and generating posts as well as pages, however I need to have a method of triggering a redeploy when a draft is created, edited and deleted. Is there a Webhook that already does this? Is there some sort of work around? Finally question, could something like this be added? Granted it’s a very specific use case, but maybe it’s useful for some people.

Anywho, thanks for reading!

The post.{added,edited,deleted} web hooks will fire for all posts. In the payload you can look at the status property if there are specific statuses you want to filter by. Does that work for you?

Oh it does? I should’ve checked that one a bit more, I assumed the Site changed (rebuild) webhook would cover literally all events. I’ll take a closer look! Thanks :slight_smile:

Site changed (rebuild) doesn’t cover drafts because changes to those don’t actually cause a site to change :slight_smile: If it did fire on drafts it would also fire a lot because drafts autosave constantly which is probably not what you want when triggering a production static site build.

Webhooks for specific actions on resources will always occur, whether they cause the site to change or not.

1 Like

They worked! Thanks Kevin :heart: