Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.lettr.com/llms.txt

Use this file to discover all available pages before exploring further.

Webhooks deliver real-time notifications when emails are delivered, opened, clicked, bounced, or marked as spam. The client.webhooks service manages your endpoints. For the event payload format and signature verification, see Webhooks.
use lettr::Lettr;
use lettr::webhooks::{CreateWebhookOptions, UpdateWebhookOptions, WebhookAuthType, WebhookEventsMode};

let client = Lettr::new("your-api-key");

List Webhooks

let webhooks = client.webhooks.list().await?;
for webhook in &webhooks {
    println!("{}: {} (enabled: {})", webhook.id, webhook.url, webhook.enabled);
}

API Reference

GET /webhooks

Create a Webhook

let options = CreateWebhookOptions::new(
    "Order Notifications",
    "https://example.com/webhook",
    WebhookAuthType::Basic,
    WebhookEventsMode::Selected,
)
.with_events(vec!["message.delivery".into(), "message.bounce".into()])
.with_basic_auth("user", "secret");

let webhook = client.webhooks.create(options).await?;
println!("Created webhook: {}", webhook.id);
Use WebhookEventsMode::All to receive every event, or WebhookEventsMode::Selected with .with_events(...). WebhookAuthType is None, Basic, or Oauth2.

API Reference

POST /webhooks

Get a Webhook

let webhook = client.webhooks.get(&webhook_id).await?;

API Reference

GET /webhooks/

Update a Webhook

let options = UpdateWebhookOptions::new()
    .with_name("Updated Webhook")
    .with_active(false);
client.webhooks.update(&webhook_id, options).await?;

API Reference

PATCH /webhooks/

Delete a Webhook

client.webhooks.delete(&webhook_id).await?;

API Reference

DELETE /webhooks/

What’s Next

Webhook Events

Event types and payload format

Webhook Authorization

Verify webhook authenticity