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 lettr.webhooks() service manages your endpoints. For the event payload format and signature verification, see Webhooks.
import com.lettr.Lettr;
import com.lettr.services.webhooks.model.*;
import java.util.List;

Lettr lettr = new Lettr("your-api-key");

List Webhooks

ListWebhooksResponse webhooks = lettr.webhooks().list();
for (Webhook w : webhooks.getWebhooks()) {
    System.out.println(w.getName() + " -> " + w.getUrl() + " (enabled: " + w.isEnabled() + ")");
}

API Reference

GET /webhooks

Create a Webhook

Webhook webhook = lettr.webhooks().create(
    CreateWebhookOptions.builder()
        .name("Order Notifications")
        .url("https://example.com/webhook")
        .authType("basic")
        .authUsername("user")
        .authPassword("secret")
        .eventsMode("selected")
        .events(List.of("message.delivery", "message.bounce"))
        .build()
);
System.out.println("Webhook ID: " + webhook.getId());
Use eventsMode("all") to receive every event type, or eventsMode("selected") with an explicit events list. authType is "none", "basic", or "oauth2".

API Reference

POST /webhooks

Get a Webhook

Webhook webhook = lettr.webhooks().get("webhook-abc123");

API Reference

GET /webhooks/

Update a Webhook

Webhook updated = lettr.webhooks().update("webhook-abc123",
    UpdateWebhookOptions.builder()
        .name("Updated Webhook")
        .url("https://new.example.com/webhook")
        .active(false)
        .build()
);

API Reference

PATCH /webhooks/

Delete a Webhook

lettr.webhooks().delete("webhook-abc123");

API Reference

DELETE /webhooks/

What’s Next

Webhook Events

Event types and payload format

Webhook Authorization

Verify webhook authenticity