Skip to main content

Crate ryu_notify

Crate ryu_notify 

Source
Expand description

Shared notification-delivery wire types + send primitives.

This crate is the narrow surface that both Core (the kernel notification store + fan-out orchestration in apps/core/src/notify) and the out-of-process monitors engine (apps-store/monitors/backend) need in common: the channel-target enum and the dep-light HTTP send functions. It has ZERO dependency on apps/core.

Placement (Core vs Gateway): a notification decides what runs (open a delivery socket) → Core-side. Nothing here is policy. The store, deliver_user_notification, dedupe, and the tiered notify_all fan-out that wires in the desktop event bus / plugin hooks / BYO SMTP live in Core; only the shared types + primitives live here.

The set of targets is an extensible enum — the “nothing hardcoded, everything swappable” rule applied to channels: a webhook covers Slack/Discord/any HTTP endpoint, Telegram is a direct Bot-API send, Expo handles mobile, and Email carries only the recipient (the SMTP transport is a shared node resource resolved once at the Core call site, never stored per-target).

Every send is best-effort unless its name ends in _text: those return Ok(()) only on a 2xx so a workflow node can surface a failed delivery.

Structs§

AlertDeliveryTargets
Node-level alert delivery targets (self-host): the fan-out channels (webhook / Telegram / Expo push) + email recipients that policy alerts deliver to. Distinct from per-monitor targets, which are scoped to one watched site. Persisted in the Core notify store (alert_delivery table).

Enums§

NotifyTarget
A notification destination (per-monitor or node-level policy-alert channel).

Functions§

push_expo_message
Send a plain title/body push to a set of Expo tokens. Best-effort: a failure is logged, never propagated. data rides through to the device payload.
send_telegram_alert
Best-effort Telegram alert send (with a bell emoji prefix).
send_telegram_text
Send a plain-text message via the Telegram Bot API (sendMessage). Returns Ok(()) only on a 2xx so a workflow node can surface a failed send.
send_webhook_alert
Best-effort webhook alert send: {text, content, alert} so both Slack/Discord framing and the structured payload ride one URL. alert is the full JSON carrier (embedded under "alert").
send_webhook_text
Post a plain-text message to a Slack/Discord/generic incoming webhook. Sends both text (Slack) and content (Discord) so one URL fits either service. Returns Ok(()) only on a 2xx response.