Scheduled Webhooks — aka Cron for the Cloud

Travis Reeder
Iron.io Technical Blog
2 min readJun 25, 2015

Have you ever wanted an endpoint in your application to be called at a certain time every day to perform some action? Maybe you want to generate some reports using the previous days data or send out notifications to your users.

Some of you might use Cron or maybe some scheduling library for your language like Quartz. But if you use Cron, you have a single point of failure problem and if you use a library in your app, you need to make sure it’s only doing the schedule on one instance, or it’s synchronized somehow between the boxes, so you don’t run your actions more than once!

Well here’s another solution that doesn’t have the problems listed above, requires no maintenance or servers and is super easy to setup.

Scheduling a Webhook with IronWorker

IronWorker is an easy to use, Event-Driven compute service that allows you to upload some code and have it execute by hitting the IronWorker API or by scheduling it for repeated executions using the built in scheduler. It’s easy to use and requires no servers or maintenance. Just set it and forget it.

A worker that hits URL’s is very easy to make, here’s a full example:

The above worker will hit the URL’s defined in the `urls` array when it runs. So all you need to do is upload the code to IronWorker and schedule it to run every X seconds using the scheduling API. From the command line, that’s as simple as:

iron worker schedule --start-at 2015-06-24T08:00:00Z --run-every 86400 webhooker

The command above will schedule your worker to run every 24 hours, like clockwork.

Full code and documentation for this Webhook Worker example is available here: https://github.com/treeder/webhook_worker . Clone it, follow the README and you’ll have your scheduled webhooks running in minutes.

--

--