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.
import lettr "github.com/lettr-com/lettr-go"

client := lettr.NewClient("your-api-key")

List Webhooks

webhooks, err := client.Webhooks.List(ctx)

API Reference

GET /webhooks

Create a Webhook

// Receive all events
created, err := client.Webhooks.Create(ctx, &lettr.CreateWebhookRequest{
    Name:       "My Webhook",
    URL:        "https://example.com/webhook",
    AuthType:   "none",
    EventsMode: "all",
})

// Receive selected events with basic auth.
// Event names use the namespaced form — see the lettr.Event* constants.
created, err = client.Webhooks.Create(ctx, &lettr.CreateWebhookRequest{
    Name:         "Delivery Webhook",
    URL:          "https://example.com/webhook",
    AuthType:     "basic",
    AuthUsername: "user",
    AuthPassword: "pass",
    EventsMode:   "selected",
    Events: []string{
        lettr.EventMessageDelivery,
        lettr.EventMessageBounce,
        lettr.EventMessageSpamComplaint,
    },
})

API Reference

POST /webhooks

Get a Webhook

webhook, err := client.Webhooks.Get(ctx, "webhook-id")

API Reference

GET /webhooks/

Update a Webhook

Set only the fields you want to change. Optional booleans like Active are pointers:
active := false
updated, err := client.Webhooks.Update(ctx, "webhook-id", &lettr.UpdateWebhookRequest{
    Name:   "Renamed Webhook",
    URL:    "https://example.com/new-webhook",
    Active: &active,
})

API Reference

PATCH /webhooks/

Delete a Webhook

_, err = client.Webhooks.Delete(ctx, "webhook-id")

API Reference

DELETE /webhooks/

What’s Next

Webhook Events

Event types and payload format

Webhook Authorization

Verify webhook authenticity