Skip to main content

Overview

watch() creates a real-time alert for a specific user. When that user’s risk score exceeds threshold, ChurnKit POSTs a signed payload to your webhook URL. The cooldown prevents repeat alerts from firing too frequently.

Signature

WatchOptions

number
required
Fire the webhook when score >= threshold. Must be between 0 and 1.
string
required
HTTPS URL to POST the alert payload to. Must be a valid https:// URL.
CooldownString
required
Minimum time between repeated alerts for this user. Format: positive integer + d (days) or h (hours). Examples: "24h", "7d", "1d".

WatchedUser (return value)

Examples

Basic watch

Watch all trial users

Webhook payload

When the alert fires, ChurnKit POSTs this JSON to your webhook URL:
Always verify the webhook signature before processing the payload.

Handling the webhook in Next.js

Errors