Heroku Scheduler is a simple add-on for running one-off tasks on a schedule. Like cron, it fails silently — if a job fails or the add-on has an issue, you won't know without external monitoring. Alert24 heartbeat checks give you a simple dead-man's switch.
Before you start
- In Alert24, go to Monitoring → Add check → Heartbeat
- Name it after your Heroku task (e.g., "Daily summary job")
- Set Expected interval to match your scheduler frequency:
- Every 10 minutes → 600 seconds
- Every hour → 3600 seconds
- Every day → 86400 seconds
- Set Grace period to 5–10 minutes (Heroku Scheduler has variable timing)
- Save and copy the heartbeat URL
Add the ping to your job command
Shell command (simplest)
In Heroku Scheduler, update your job's Command field to append the curl ping:
your-existing-command && curl -fsS https://app.alert24.net/api/hb/YOUR_TOKEN
Ruby / Rails
# lib/tasks/daily_summary.rake
task daily_summary: :environment do
DailySummary.generate
# Ping Alert24 on success
require 'net/http'
Net::HTTP.get(URI("https://app.alert24.net/api/hb/#{ENV['ALERT24_HB_TOKEN']}"))
end
Python
# jobs/daily_summary.py
import urllib.request, os
def run():
generate_summary()
send_emails()
# Ping Alert24 on success
urllib.request.urlopen(
f"https://app.alert24.net/api/hb/{os.environ['ALERT24_HB_TOKEN']}",
timeout=5
)
if __name__ == '__main__':
run()
Node.js
// jobs/daily_summary.js
const https = require('https');
async function run() {
await generateSummary();
// Ping Alert24 on success
await new Promise(r => https.get(
`https://app.alert24.net/api/hb/${process.env.ALERT24_HB_TOKEN}`, r
));
}
run().catch(e => { console.error(e); process.exit(1); });
Store the token as a config var
heroku config:set ALERT24_HB_TOKEN=YOUR_TOKEN --app your-heroku-app
Tips
- Heroku Scheduler timing: Heroku Scheduler runs jobs "approximately" at the scheduled time — it can be up to a few minutes off. Set your grace period to at least 10 minutes for hourly jobs and 30 minutes for daily jobs.
- Exit codes: Heroku Scheduler considers a job successful when the process exits 0. Make sure exceptions in your job code cause a non-zero exit (they typically do by default). If the job exits non-zero, the curl ping won't run — Alert24 fires after the grace period.
- Separate jobs: Create one Alert24 heartbeat check per Heroku Scheduler job. Don't combine multiple jobs behind a single heartbeat — you won't know which one stopped.
- Dyno size: Scheduler jobs run on one-off dynos. Ensure your app has available dyno capacity, otherwise Heroku queues the job and it may run late — account for this in your grace period.