Crate pling

source ·
Expand description

Send notifications via Slack, Telegram, E-Mail, …

The name of this Rust crate is inspired by the notification arrival sound.

Usage

Add something like this to your Cargo.toml based on what you (or your users) need:

[dependencies.pling]
version = "…"
features = ["email"]
let notifiers = pling::Notifier::from_env();
for notifier in notifiers {
  notifier.send_sync("Hello world!");
}

Available Cargo features

  • serde-derive provides serde Serialization / Deserialization implementations for structs.
  • email provides Email sending via lettre
  • http-sync provides HTTP APIs via ureq (Enabled by default)
  • http-async provides HTTP APIs via reqwest

Structs

  • Execute the command on the host system. The last argument will be the message for the notification.
  • Send desktop notifications for Linux, macOS and Windows
  • Send an E-Mail
  • Send a Matrix message
  • Send a Slack message
  • Send a Telegram message
  • Send a POST request to the given URL. The body will contain the text of the notification.

Enums

  • Notifiers which can be used to provide easily configurable notifications for your application.
  • Unique identifier for the target chat or username of the target channel (in the format @channelusername)