How to to callback when clicked [Publish deploy] button

Hi,

Is there any way that I can get callback via plugin or netlify function when clicked the Publish deploy
button on the UI ?

i don’t think that it would be possible to capture the click of the button - but it might (i am not sure) be able to capture when a deploy has been triggered, if that would be helpful?

could you describe in a bit more detail what you are trying to accomplish? we might be able to suggest a different way if we know your end goal.

Hi Perry,

Thanks for your reply.

I’ve noticed that [Publish Deploy] would invoke [Restore API] https://docs.netlify.com/api/get-started/#restore-deploy-rollback when clicked. Can we get notification when restored?

In our scenario, we want to know which deploy is live(via auto publishing or click the button manually).

If you’re planning to use the API, you can trigger a notification yourself. There’s no other way at the moment.

We have a similar use case. We have written a webhook endpoint that we want to call whenever a publish happens. For staging sites, things just autodeploy and we listen for “Deploy succeeded” when setting up our Webhook:

However for production sites, we want to review and have more manual control over when they are released, so we locked publishing and to make the changes in any given deploy public, we manually click a button to publish:


The problem is that none of the events given as options for webhooks seem to be triggered by pushing that button:

I had guessed that perhaps Deploy succeeded or Deploy request accepted might be it, but that does not seem to be the case, and none of the others seem correct either. Surely this is not an uncommon scenario? Is there some way to wire a webhook call to that button push?

The only way to hook a webhook to tha trigger is to build your own publishing flow that would allow you to use Netlify’s API to publish a deploy and then you can trigger your own webhook from the same flow.