Tutorials 9 min read

Scheduled Webhooks with Cron Jobs: Automate Recurring Tasks

Use HookWatch cron jobs to schedule recurring webhook calls—health checks, data syncs, daily reports, and more—without managing your own scheduler.

H

HookWatch Team

February 12, 2026

Not every webhook is triggered by an external event. Sometimes you need to send a webhook on a schedule—every 5 minutes, once a day, or at a specific time each week. HookWatch's built-in cron scheduler makes this simple.

Why Scheduled Webhooks?

Many workflows require periodic actions:

  • Health checks: Ping your services every few minutes to verify uptime
  • Data synchronization: Pull updates from third-party APIs on a schedule
  • Daily reports: Trigger report generation every morning
  • Cache warming: Pre-populate caches before peak traffic hours
  • Cleanup tasks: Archive old data or rotate logs weekly

Traditionally, you'd set up a cron job on a server, manage a task queue, or use a third-party scheduler. HookWatch handles this natively.

How Cron Jobs Work in HookWatch

A HookWatch cron job is a scheduled task that sends an HTTP request to a URL at defined intervals:

Code
┌─────────────┐     Schedule      ┌──────────┐     HTTP      ┌──────────┐
│  HookWatch  │ ──────────────→  │   Cron   │ ──────────→  │  Your    │
│  Scheduler  │   (*/5 * * * *)  │  Worker  │   POST       │  Server  │
└─────────────┘                  └──────────┘              └──────────┘

The scheduler runs in the HookWatch CLI on your local machine or server, polling the cloud for pending executions and running them automatically.

Setting Up a Cron Job

From the Dashboard

  1. Navigate to the Cron Jobs section
  2. Click "Create Job"
  3. Configure the schedule, target URL, and HTTP method
  4. Set optional headers and request body
  5. Save and activate

Using Cron Expressions

HookWatch uses standard cron syntax:

Code
┌───────────── minute (0-59)
│ ┌───────────── hour (0-23)
│ │ ┌───────────── day of month (1-31)
│ │ │ ┌───────────── month (1-12)
│ │ │ │ ┌───────────── day of week (0-6, Sun=0)
│ │ │ │ │
* * * * *

Common schedules:

ExpressionDescription
*/5 * * * *Every 5 minutes
0 * * * *Every hour
0 9 * * *Daily at 9:00 AM
0 9 * * 1Every Monday at 9:00 AM
0 0 1 * *First day of every month
*/30 9-17 * * 1-5Every 30 min during business hours

Real-World Use Cases

1. Service Health Checks

Monitor your API uptime by pinging endpoints on a schedule:

Javascript
// Your health check endpoint
app.post('/health-check', async (req, res) => {
  const services = ['database', 'cache', 'queue', 'storage'];
  const results = {};

  for (const service of services) {
    try {
      await checkService(service);
      results[service] = 'healthy';
    } catch (err) {
      results[service] = 'unhealthy';
      await sendAlert(service, err.message);
    }
  }

  const allHealthy = Object.values(results)
    .every(s => s === 'healthy');

  res.status(allHealthy ? 200 : 503).json(results);
});

Configure a cron job with */5 * * * * to check every 5 minutes. HookWatch tracks the response status, so you can see at a glance if any check failed.

2. Daily Report Generation

Trigger a daily summary email every morning:

Javascript
app.post('/daily-report', async (req, res) => {
  const yesterday = new Date();
  yesterday.setDate(yesterday.getDate() - 1);

  const stats = await getStats(yesterday);

  await sendEmail({
    to: 'team@company.com',
    subject: `Daily Report - ${yesterday.toLocaleDateString()}`,
    body: formatReport(stats)
  });

  res.json({ sent: true, date: yesterday });
});

Schedule with 0 9 * * * to run at 9 AM daily.

3. Third-Party Data Sync

Pull data from external APIs periodically:

Javascript
app.post('/sync-inventory', async (req, res) => {
  // Fetch latest inventory from supplier API
  const inventory = await supplierAPI.getInventory();

  // Update local database
  let updated = 0;
  for (const item of inventory) {
    const changed = await db.products.updateStock(
      item.sku,
      item.quantity
    );
    if (changed) updated++;
  }

  res.json({
    total: inventory.length,
    updated,
    syncedAt: new Date()
  });
});

4. Cache Warming

Pre-populate caches before your users wake up:

Javascript
app.post('/warm-cache', async (req, res) => {
  const pages = [
    '/api/products/featured',
    '/api/categories',
    '/api/deals/today'
  ];

  for (const page of pages) {
    const data = await fetchFromDB(page);
    await cache.set(page, data, { ttl: 3600 });
  }

  res.json({ warmed: pages.length });
});

Schedule with 0 6 * * * to warm caches at 6 AM.

Running the Cron Service

The HookWatch CLI includes a cron service daemon that polls for pending executions and runs them locally:

Bash
# Start the cron service
hookwatch cron service

# The service runs continuously:
# [09:00:00] Polling for pending executions...
# [09:00:00] Executing daily-report (cron_002)
# [09:00:02] ✓ daily-report completed (200 OK, 2.1s)
# [09:05:00] Executing health-check (cron_001)
# [09:05:01] ✓ health-check completed (200 OK, 0.8s)

Run as a Background Service

For production environments, run the cron service as a system daemon:

Bash
# Using systemd
sudo systemctl enable hookwatch-cron
sudo systemctl start hookwatch-cron

# Or with Docker
docker run -d --name hookwatch-cron \
  -e HOOKWATCH_API_KEY=your_key \
  hookwatch/cli cron service

Monitoring Executions

Every cron execution is tracked with full details:

Bash
hookwatch cron executions --job cron_001 --limit 5
Code
ID            STATUS     DURATION   RESPONSE   EXECUTED
exec_001      success    0.8s       200        2 min ago
exec_002      success    1.1s       200        7 min ago
exec_003      failed     2.3s       503        12 min ago
exec_004      success    0.9s       200        17 min ago
exec_005      success    0.7s       200        22 min ago

Execution statuses flow through: pending → running → success | failed | timeout | canceled

Failed executions are logged with response details so you can quickly identify what went wrong.

Best Practices

Choose the Right Interval

Don't schedule more frequently than needed. A health check every 5 minutes is usually sufficient—every 10 seconds creates unnecessary load.

Handle Failures Gracefully

Your endpoint should return meaningful status codes. Return 200 for success, 503 for partial failures, and log details for debugging.

Make Jobs Idempotent

Cron jobs may occasionally run twice due to timing. Design your endpoints to handle duplicate calls without side effects.

Getting Started

Scheduled webhooks eliminate the need to manage your own cron infrastructure. Set up a job in HookWatch, point it at your endpoint, and let the scheduler handle the rest.

Start with a simple health check, then expand to reports, syncs, and automations as your needs grow.

Tags: cronschedulingautomationwebhooksmonitoring

Share this article

Ready to try HookWatch?

Start monitoring your webhooks in minutes. No credit card required.

Start Free Today