When I was making my Gatsby site, I had to keep logging into the Netlify interface to see if my site was deploying, and if there were any bugs. I wanted to find a way to remove this minor inconvenience from my life. It also meant that if I have scripts which automatically build my site, I can see if the build ever fails.
I initially thought this could be a good use for a slackbot, but this requires the premium tier of Netlify. However, when looking, I saw you could set up an outgoing webhook whenever a deploy is started, finishes, or fails. I also remembered there is an IFTTT service for webhooks, and so I got to work.
First, I had to create the url to send the POST request to on IFTTT. This is simple. Just log into IFTTT (I did it on the web) and find the webhooks service. Go to settings, and then to the webhook maker URL. Here you can make a trigger. I made one called site_build_succeeded
.
Then I set up an IFTTT which when received a webhook with this trigger, sends me a rich iOS notification saying the time the site was built, and links to the site.
The last thing to do was to actually call this endpoint. To do this, I logged into Netlify and went to 'Deploy Notifications' in settings. I added an outgoing webhook when a deploy succeeds to the URL generated by the IFTTT webhook maker.
There you have it! Whenever my site builds, I'm the first to know. I also set one up for build failures, with a link to the Netlify 'Deploys' page, so I can quickly see why it failed.