Creating a client
paubox.New accepts optional functional options:
| Option | Description |
|---|---|
paubox.WithBaseURL(url) | Override the API base URL (useful for testing) |
paubox.WithHTTPClient(c) | Supply a custom *http.Client |
paubox.WithTimeout(d) | Set a per-request timeout (default: 30 s) |
paubox.WithRetry(cfg) | Configure retry behavior (see below) |
paubox.WithUserAgent(s) | Append a string to the User-Agent header |
Retry configuration
By default the client retriesGET requests up to 3 times on 429 and 5xx responses, with exponential backoff between 500 ms and 30 s.
Send a message
Message fields
paubox.Ptr[T] helper creates a pointer to any value, which is required for optional fields typed as *T:
Response
Send a batch
Send up to 50 messages in a single API call. Each message gets its own tracking ID.Check delivery status
disp.Data.Message.MessageDeliveries is a slice of per-recipient records:
DeliveryStatus values: delivered, opened, failed, pending.
Dynamic templates
Templates use Handlebars syntax ({{variable_name}}).
Create a template
List templates
Get a template
Update a template
Delete a template
Send a templated message
Error handling
All methods return a typederror. Use errors.As to inspect details and errors.Is to match sentinels:
Sentinel errors
| Sentinel | HTTP status |
|---|---|
paubox.ErrBadRequest | 400 |
paubox.ErrUnauthorized | 401 |
paubox.ErrForbidden | 403 |
paubox.ErrNotFound | 404 |
paubox.ErrRateLimit | 429 |
paubox.ErrServerError | 5xx |