Show alert to online users when a new release is published

Hi,

We have a react app running on netlify.

We aim to notify the online users when a new release has been deployed on netlify.

But, For now netlify supports only events for build/lock/unlock events, but not for the case when a build is published.

Only approach we have in mind right now is triggering that event manually.

However, we are still looking for a solution to achieve this without manual intervention.
Feel free to comment about how can we do this.

Thanks

You wouldn’t want to use our notifications for this; first off you can’t really specify a dynamic list of recipients, but also, sometimes you might redeploy and NOT want to tell people about a new version - say you fix a typo - that’s not really “notification-worthy”, right?

What is the thing that is important about a new release that requires notification? Does your site not function after a redeploy? If not then there are much better patterns to pursue to fix the root cause rather than notifying people about every deploy/build.

Yes, our site stops functioning after publishing a deploy. And we are working towards fixing the root cause too.

But also, In many cases we would like to prompt the users to refresh for the newer version.
Also, We have already solved the notification and recipient problem.

The issue we are asking about here is how can we get that trigger/event from netlify that a deploy(locked) has been published. Either we get a hook or a lambda function against that event, our problem is solved. But, events exists for the build only, not when we publish a build manually.

Re: your site benefitting from a refresh - why not force a refresh, then? The pattern most folks use to do that is to deploy something like a version.txt file, and upon every web request, check that file, and if it has changed from last-seen, force a reload.

We don’t have any notifications for publishing right now - only deploying - so you’ll have to build your own to poll the current deploy and notice it has changed and then do the thing. It would likely be easier to instrument the publish process to include a step to harvest the new deploy ID and do whatever you need with it, than to leave this running all the time, but if you wanted to poll, the API call to check the deploy is this one:

e.g. GET https://api.netlify.com/api/v1/sites/yoursitename.netlify.com

and we return a deploy_id in there which you’d have to check for change.

It is a good suggestion that we should have a notification on deploy published and I have added your name to the open feature request to that effect so I can let you know in this thread in case we implement it.