Expand description
§Discourse Webhooks
A type-safe Rust library for handling Discourse webhook events.
This crate provides:
- Type-safe event parsing for Discourse webhooks
 - HMAC-SHA256 signature verification
 - Trait-based event handling system with async support
 - Support for all major Discourse webhook events
 
§Quick Start
use discourse_webhooks::{WebhookEventHandler, WebhookProcessor, TopicWebhookEvent};
use async_trait::async_trait;
struct MyHandler;
#[async_trait]
impl WebhookEventHandler for MyHandler {
    type Error = String;
    async fn handle_topic_created(&mut self, event: &TopicWebhookEvent) -> Result<(), Self::Error> {
        println!("New topic: {}", event.topic.title);
        Ok(())
    }
}
// Process webhook events
let processor = WebhookProcessor::new();
let mut handler = MyHandler;
// processor.process_json(&mut handler, "topic_created", payload, None).await?;Re-exports§
pub use error::Result;pub use error::WebhookError;pub use events::parse_webhook_payload;pub use events::PostWebhookEvent;pub use events::TopicWebhookEvent;pub use events::WebhookEventPayload;pub use events::WebhookPost;pub use events::WebhookTopic;pub use events::WebhookUser;pub use signature::verify_json_signature;pub use signature::verify_signature;pub use signature::SignatureVerificationError;
Modules§
- error
 - Error types for the discourse-webhooks crate
 - events
 - Event types and parsing for Discourse webhooks
 - signature
 
Structs§
- Discourse
Webhook Payload  - Represents a Discourse webhook payload structure
 - Webhook
Processor  - A webhook processor that handles signature verification and event dispatching
 
Traits§
- Webhook
Event Handler  - Trait for handling different types of webhook events
 
Functions§
- process_
webhook_ event  - Process a webhook event using the provided handler (synchronous version)