Monitor TypeScript Cron Jobs

Learn how to monitor TypeScript scheduled tasks with full type safety using the official Haspulse SDK.

Features

  • Full TypeScript support with exported types
  • Built-in wrap() helper for automatic lifecycle
  • Zero-config retry and timeout handling
  • Works with all Node.js schedulers

Code Examples

SDK with wrap()
import { HasPulse } from 'haspulse';
import cron from 'node-cron';

const haspulse = new HasPulse({
  apiKey: process.env.HASPULSE_API_KEY!
});

// wrap() automatically sends start/success/fail
cron.schedule('*/5 * * * *', async () => {
  await haspulse.wrap('YOUR_CHECK_ID', async () => {
    await processQueue();
  });
});
SDK manual ping
import { HasPulse, type PingOptions } from 'haspulse';

const haspulse = new HasPulse({
  apiKey: process.env.HASPULSE_API_KEY!
});

// Full control with type-safe options
await haspulse.ping('YOUR_CHECK_ID', { type: 'start' });

try {
  const result = await processQueue();
  await haspulse.ping('YOUR_CHECK_ID'); // success
  return result;
} catch (error) {
  await haspulse.ping('YOUR_CHECK_ID', { type: 'fail' });
  throw error;
}

How It Works

  1. 1
    Create a check in Haspulse
    Set your expected schedule (e.g., every 5 minutes)
  2. 2
    Add the ping to your code
    Ping the unique URL when your job runs successfully
  3. 3
    Get alerted on failures
    If a ping doesn't arrive on time, we notify you

Related Integrations

Start monitoring in minutes

Create your first check and start receiving alerts when your scheduled jobs fail.

Get started free