Expand description
Webhook handler trait and types for application-provided processing logic.
This module defines the interface that applications implement to process GitHub webhook events. Handlers receive normalized EventEnvelope instances and can perform async processing without blocking webhook HTTP responses.
§Fire-and-Forget Pattern
Handlers execute asynchronously after the HTTP response is sent to GitHub. This ensures GitHub receives a response within the 10-second timeout while allowing handlers to perform longer-running operations.
§Examples
use github_bot_sdk::webhook::WebhookHandler;
use github_bot_sdk::events::EventEnvelope;
use async_trait::async_trait;
struct MyHandler;
#[async_trait]
impl WebhookHandler for MyHandler {
async fn handle_event(&self, envelope: &EventEnvelope) -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
println!("Processing event: {}", envelope.event_id);
// Perform async processing here
Ok(())
}
}Traits§
- Webhook
Handler - Application-provided webhook event handler.