Ntfy

Description
Rust library for sending notifications over ntfy.
Example
use ntfy::prelude::*;
#[tokio::main]
async fn main() -> Result<(), Error> {
let dispatcher = dispatcher::builder("https://ntfy.sh")
.credentials(Auth::credentials("username", "password")) .build_async()?;
let action = Action::new(
ActionType::Http,
"Turn down",
Url::parse("https://api.nest.com")?,
);
let payload = Payload::new("mytopic")
.message("Hello, **World**!") .title("Alert") .tags(["warning"]) .priority(Priority::High) .actions([action]) .click(Url::parse("https://example.com")?) .attach(Url::parse("https://example.com/file.jpg")?) .delay("30min") .markdown(true);
dispatcher.send(&payload).await?;
Ok(())
}
Crate Feature Flags
The following crate feature flags are available:
| Feature |
Default |
Description |
async |
Yes |
Use reqwest as dispatcher client |
blocking |
No |
Use ureq as dispatcher client |
socks |
No |
Enables socks proxy support |
rustls |
Yes |
Enables rust TLS |
native-tls |
No |
Enables native TLS (openssl) |
More examples can be found in the examples directory.
License
This project is distributed under the MIT software license - see the LICENSE file for details