hookburn-slack 0.2.0

A Rust crate for sending messages to Slack via webhooks
Documentation
//! Send a plain-text message to a Discord webhook using the unified Hookburn client.
//!
//! This example shows how to use the unified `hookburn` crate with Discord.
//! The same pattern works for Slack, Teams, and other services.
//!
//! ```bash
//! DISCORD_WEBHOOK_URL=https://discord.com/api/webhooks/ID/TOKEN \
//!     cargo run -p hookburn --example discord_basic
//! ```

use hookburn::{GenericMessage, Hookburn, ServiceConfig};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Read the webhook URL from environment
    let url =
        std::env::var("DISCORD_WEBHOOK_URL").expect("Set DISCORD_WEBHOOK_URL to your webhook URL");

    // Create a new Hookburn instance with all registered services
    let hookburn = Hookburn::new();

    // Configure the service
    let config = ServiceConfig::new(url).with_timeout(std::time::Duration::from_secs(30));

    // Create a sender for Discord
    let sender = hookburn.create_sender("discord", config)?;

    // Create a generic message
    let message = GenericMessage::new("Hello from Hookburn! 👋").with_username("hookburn");

    // Send the message
    sender.send(&message).await?;

    println!("✅ Message sent to Discord!");
    Ok(())
}