Notification Architecture
camply separates availability detection from alert delivery so provider checks never block on outbound HTTP calls and every pending alert is revalidated right before sending.
Interface and payload
All notification channels implement BaseNotificationProvider under camply.notifications and accept a NotificationDTO (title, message, booking_url, url_title, park_name, campsite_name, start_date, end_date, metadata).
CAMPLY_NOTIFICATION_MODE controls alert granularity across both runtimes:
summary(default): Sends one alert per saved scan when new matching sites open, linking to{CAMPLY_APP_URL}/dashboard/scans/{scan_id}#results.direct: Sends individual site alerts pointing directly to the provider's booking URL.
Supported channels
Each user chooses either Pushover (default) or ntfy in account settings:
- Pushover: Requires a deployment
PUSHOVER_APP_TOKENand the user's Pushover user key. - ntfy: Assigns each user an editable unique topic (
camply-<7-char-id>), usingCAMPLY_NTFY_SUBSCRIPTION_URL(defaulthttps://ntfy.sh) for user subscriptions and optionalCAMPLY_NTFY_PUBLISH_URLfor private server-side publishing. Users can also supply a custom server URL and optional bearer token.
POST /api/me/notifications/test validates unsaved settings and sends a single test message directly through the chosen channel without creating a scan or outbox record.
Pre-send revalidation and delivery paths
Before sending any queued alert, both standalone and distributed adapters recheck scan ownership, active status, user eligibility, current UTC date cutoff, allowed_weekdays, min_stay_length, and target linkage (scan_revision for area scans). If no qualifying stay remains, the delivery is skipped cleanly.
- Standalone outbox: Inserts
notification_outboxintents atomically in the same transaction asscan_results, retries transient failures after 120 seconds (up to 4 total attempts), and prunes terminal rows after 24 hours. - Distributed tasks: Enqueues Celery tasks (
notifications.send_pushoverornotifications.send_ntfy). - Area scan coalescing:
area_alerts.pybatches new recreation-area openings underdelivery_key="area-summary"across a 5-second window so multi-campground rounds produce one clean summary instead of a flood of messages. Standalone mode drains due rows in its local outbox loop; distributed mode schedulesnotifications.send_area_alertson demand via Celeryetawhen windows are enqueued or retried, with heartbeat recovery for orphaned rows.