| Crates.io | rocket-webhook |
| lib.rs | rocket-webhook |
| version | 0.1.0-alpha.2 |
| created_at | 2025-10-10 04:17:17.518879+00 |
| updated_at | 2025-10-14 05:36:09.200236+00 |
| description | Webhook validation for Rocket applications |
| homepage | https://github.com/fa-sharp/rocket-webhook |
| repository | https://github.com/fa-sharp/rocket-webhook |
| max_upload_size | |
| id | 1876502 |
| size | 150,130 |
⚠️ This crate is in alpha and may not work as expected yet.
Streamlined webhook validation for Rocket applications, with built-in support for popular providers.
.manage() and data guardsYou can use another webhook by utilizing one of the generic implementations,
or implementing one of the signature traits (WebhookHmac or WebhookPublicKey) along with the Webhook trait. See the src/webhooks/built_in folder for examples.
Add to your Cargo.toml:
[dependencies]
rocket-webhook = { version = "0.1.0-alpha", features = ["github", "slack"] } # Enable provider(s) you want to use
serde = { version = "1.0", features = ["derive"] }
use rocket::{post, routes, serde::{Deserialize, Serialize}};
use rocket_webhook::{RocketWebhook, WebhookPayload, webhooks::built_in::GitHubWebhook};
#[derive(Deserialize, Serialize)]
struct GitHubPayload {
action: String,
}
#[post("/webhooks/github", data = "<payload>")]
async fn github_webhook(
payload: WebhookPayload<'_, GitHubPayload, GitHubWebhook>,
) -> &'static str {
println!("Received GitHub action: {}", payload.data.action);
"OK"
}
#[rocket::launch]
fn rocket() -> _ {
let github_webhook = RocketWebhook::builder()
.webhook(GitHubWebhook::with_secret(b"your-webhook-secret"))
.build();
rocket::build()
.manage(github_webhook)
.mount("/", routes![github_webhook])
}