Skip to content

tomaThomas/ntfy-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ntfy-api

This library contains async rust bindings for the ntfy API. It uses reqwest as HTTP client.

Features implemented:

  • Publish as JSON
  • Post directly to topic
  • File attachments
  • Websockets

Usage

Cargo.toml:

[dependencies]
tokio = { version = "1", features = ["full"] }
ntfy-api = "^0.1.1"
use ntfy_api::{NtfyApi, NtfyMsg};

#[tokio::main]
async fn main() {
   let api = NtfyApi::default();
   let ntfy_msg = NtfyMsg::builder("topic").message("Hello world!").build();
   match api.post(&ntfy_msg).await {
       Ok(_) => println!("Message sent"),
       Err(_) => println!("Error sending message"),
   }
}

Configuration

let api = NtfyApi::new(NtfySettings {
   host: String::from("https://ntfy.sh/"),
   authorization: Some(NtfyAuthorization::new(String::from("username"), String::from("password"))),
});

About

Rust bindings for ntfy API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages