rust_webhook 0.1.1

The program is a utility crate that provides a function to send a webhook request with JSON content using the Reqwest library in Rust. It simplifies the process of sending HTTP POST requests to webhook URLs by handling JSON serialization and request configuration.
Documentation
rust_webhook-0.1.1 has been yanked.

rust_webhook

The 'rust_webhook' crate is a Rust library that provides functionality for sending webhooks using the 'reqwest' and 'serde_json' libraries. It allows you to easily send POST requests with JSON payloads to webhook endpoints.

How to Use

To use the 'rust_webhook' crate in your Rust project, follow these steps:

  1. Add the crate as a dependency in your Cargo.toml file:
[dependencies]
rust_webhook = { version = "0.1" }
reqwest = "0.11"
serde_json = "1.0"
  1. Import the send_hook function from the rust_webhook crate:
use rust_webhook::send_hook;
  1. Use the send_hook function to send a webhook. Provide the webhook URL and content as arguments. The function returns a Result<(), Box>, indicating success or failure.
#[tokio::main]
async fn main() {
    let hook_url = "https://your-webhook-url";
    let content = "Hello, webhook!";
  
    match send_hook(hook_url, content).await {
        Ok(()) => {
            println!("Webhook sent successfully!");
        }
        Err(err) => {
            eprintln!("Failed to send webhook: {}", err);
        }
    }
}

Replace "https://your-webhook-url" with the actual URL of your webhook endpoint.

  1. Run your Rust program. If the webhook is sent successfully, it will print a success message. If an error occurs, it will print the error message.

That's it! You can now use the rust_webhook crate to send webhooks in your Rust project.