Skip to content

Lead drought alert

When no lead is captured for a configured period (e.g. 30 minutes), the system can send an alert so the team can investigate (form down, tracking broken, Make.com issue, etc.).

Behaviour

  • Check: A cron runs every 10 minutes (UTC). It reads the most recent CreatedAt from the Leads table. If that time is older than the configured threshold (default 30 minutes), an alert is triggered.
  • Delivery: If a webhook URL is set in Settings (e.g. a Make.com webhook), the Worker POSTs a JSON payload to that URL. If the URL is empty, the event is only logged (no webhook).
  • Cooldown: After an alert is sent, no further alert is sent for the cooldown period (default 120 minutes), to avoid spam. The last-alert time is stored in KV.

Configuration (Settings page)

All options are configured from the dashboard Settings page (stored in AppSettings in D1):

SettingDescriptionDefault
Enable lead drought alertWhen on, the cron runs the check every 10 minutes. When off, the check is skipped.Off
Make.com webhook URLURL to POST the alert payload when a drought is detected. Leave empty to only log.Empty
Threshold (minutes)Alert when no lead has been received for this many minutes.30
Cooldown (minutes)After sending an alert, do not send another for this many minutes.120
Only alert during business hoursWhen on, alerts are sent only when the current time (in the chosen timezone) is between Start and End.Off
Start (24h)Business hours start, 24-hour format (e.g. 09:00).09:00
End (24h)Business hours end, 24-hour format (e.g. 18:00).18:00
TimezoneIANA timezone for start/end (e.g. Asia/Kolkata, UTC).UTC

Save changes with Save changes at the bottom of the Settings page.

Webhook payload

When the webhook URL is set and a drought is detected, the Worker sends a POST request with:

  • Content-Type: application/json
  • Body (example):
json
{
  "event": "lead_drought",
  "last_lead_at": "2025-03-07T12:00:00.000Z",
  "minutes_without_leads": 35,
  "message": "No leads in the last 30 minutes. Last lead: 2025-03-07T12:00:00.000Z."
}

You can use a Make.com scenario to receive this webhook and then notify your team (e.g. Slack, email, PagerDuty).

Business hours

When Only alert during business hours is on, the drought check still runs every 10 minutes, but the webhook is sent only when the current time in the configured timezone falls between Start and End (same-day window). Outside that window, the run is skipped for sending (logged as outside_business_hours). Use this to avoid night/weekend alerts.

Edge cases

  • Empty Leads table: No alert is sent (nothing to report).
  • Outside business hours: If business hours are enabled and current time is outside the window, no webhook is sent (check runs again at the next cron).
  • Webhook failure: The Worker retries with exponential backoff (same as lead webhooks). On final failure, the event is logged and the KV cooldown is not updated, so the next run (10 minutes later) will try again.
  • First deploy / no leads yet: If there are no rows in Leads, the check is skipped.

See also