Skip to main content

Crate rungbot_notify

Crate rungbot_notify 

Source
Expand description

rungbot-notify — getting a message to a person, shared by the rungbot and rungbot-exec binaries.

Three channels, each a plain HTTPS POST:

  • email — the Resend HTTP API, text with an optional HTML part.
  • telegram — a bot sendMessage, plain text.
  • webhook — a JSON POST to any URL.

Notifier is the config block that names them, deserializable from YAML. Secrets are never part of it: the config names the environment variable that holds a token, so a config file stays safe to paste into an issue, and no Debug output or error message in this crate carries a token.

signal_notices is the dedupe that decides which ladder signals are worth a mail.

Every send honours RUNGBOT_OFFLINE=1: the request is built, then refused before it leaves the process. That is what lets tests assert the exact bytes of a request without ever sending one.

This crate holds no venue key and signs nothing. A failed send is a value, never a panic: a notification that cannot go out must not take the run down with it.

Re-exports§

pub use config::Delivery;
pub use config::Notifier;
pub use email::EmailConfig;
pub use email::EmailMessage;
pub use http::HttpRequest;
pub use http::HttpResponse;
pub use telegram::TelegramConfig;
pub use webhook::WebhookConfig;

Modules§

config
The notify: block: which channels exist, and the one-call alert the watchers use.
email
Email through the Resend HTTP API.
http
One POST, built as a value first and sent second.
pyjson
JSON text byte-identical to Python’s json.dumps defaults.
signal_notices
Signal-mail dedupe: one mail per new signal state, one reminder a day, never a 30-minute loop.
telegram
Telegram through the Bot API sendMessage.
webhook
A JSON POST to a URL you choose. Whatever is on the other end is your business and none of rungbot’s, which is the point.

Enums§

NotifyError

Constants§

OFFLINE_ENV
The switch that keeps tests and dry runs from reaching the network.
USER_AGENT
The User-Agent every request sends unless its channel config names another.

Functions§

json_escape
JSON-encode one string the way serde_json does (UTF-8 kept as is).
offline
True when RUNGBOT_OFFLINE=1, the project-wide convention.