Rust
Features
- Upsert Event Types: Easily manage event types with upsert operations.
- Send Events: Send events to Hook0.
- Verifying Webhook Signatures: Ensure the authenticity and integrity of incoming webhooks.
Examples
Actix-web Example
The examples/actix-web.rs
file demonstrates how to set up a simple Actix-web server to handle webhooks signature verification.
use actix_web::{web, App, HttpServer};
#[actix_web::main]
async fn main() -> std::io::Result<()> {
HttpServer::new(|| App::new().route("/webhook", web::post().to(handle_webhook)))
.bind("127.0.0.1:8081")?
.run()
.await
}
This example sets up a server listening on 127.0.0.1:8081
and handles incoming POST requests to the /webhook
route.
Getting Started
To use the Hook0 Rust client in your project, make a cargo add hook0-client
in your project.
Or you can add the following to your Cargo.toml
:
[dependencies]
hook0-client = "hook0-client-version"
Enabling Features
The client supports several optional features:
reqwest-rustls-tls-webpki-roots
: Use Rustls with WebPKI roots for TLS.consumer
: Enable webhook consumer functionality.
Consumer features is for verifying and processing webhooks from Hook0.producer
: Enable webhook producer functionality.
Producer features is for upsert event types and send events to Hook0.
Updated 6 days ago