11tyThe possum is Eleventy’s mascot

Eleventy Documentation

Menu

Quick Tip #008—Trigger a Netlify Build Every Day with IFTTT

In Quick Tip #007 we talked about migrating away from using a Client-side third-party JavaScript widget to display GitHub stargazer counts and towards a Data fetched at Build time approach.

Updating this data at build time means that the data isn’t necessarily “live” (although the counts are likely cached at by at least one of the upstream dependencies of this widget, with a frequency that is out of your control).

I’m comfortable with these numbers being a little delayed (more than the JS widget method was) and with this new approach I get more control over the frequency of updates BUT I do probably want to run the build at least once a day. To do this, I used an IFTTT applet to trigger my Netlify build to run every morning using Netlify’s Build Hooks.

Heavily inspired by Phil Hawksworth’s work on RSS Jamstack.

Get a Netlify Build Hook #

  1. Go into your Netlify site’s Build & Deploy settings
  2. Select Continuous Deployment
  3. Add a Build hook
  4. Name it Deploy every day (or whatever you’d like)
  5. I selected the master branch for my site.
  6. Save this and it will provide you with a long URL a la https://api.netlify.com/build_hooks/SOME_ID_HERE. This is the URL you want.

Add an IFTTT Applet #

  1. Go to New Applet on ifttt.com
  2. Click +this
  3. Select the Date & Time service
  4. Select the Every day at option (or whatever frequency you’d like)
  5. Select the time you’d like the build to run.
  6. Click +that
  7. Select the Webhooks service
  8. Select the Make a web request option
  9. For the URL field, use the Build Hook URL you’ve already retrieved from Netlify.
  10. For the Method field, choose POST.
  11. For the Content Type field, choose application/x-www-form-urlencoded.
  12. For the Body field, type {}.
  13. Click the Create action button.
  14. Click Finish.