omnihook 0.1.2

Webhook client with payload builders for Slack, Discord, Telegram and generic webhooks with optional HMAC signing and idempotency key support.
Documentation
use omnihook::{GenericWebhookPayloadBuilder, WebhookConfig};
use url::Url;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Load .env file if it exists
    let _ = dotenvy::dotenv();

    let url = Url::parse(&std::env::var("GENERIC_WEBHOOK_URL")?)?;

    let client = WebhookConfig::new(url)
        .with_secret("my-shared-secret-key")
        .build()?;

    let builder = GenericWebhookPayloadBuilder::default();

    let title = "Omnihook: Generic Webhook";
    let body = "This message was sent from **omnihook** using the `GenericWebhookPayloadBuilder` with HMAC signing enabled.";

    // You may include an idempotency key if your endpoint supports it.
    let idempotency_key = Some("unique-request-id-123");

    client
        // Alternatively, you can call `client.notify(title, body, &builder)` if you don't need idempotency keys
        .notify_with_key(title, body, &builder, idempotency_key)
        .await?;

    Ok(())
}