Expand description
The official Rust client for the SendClipper email API.
use sendclipper::{Client, SendEmailParams};
let client = Client::new("sc_live_xxxxxxxxxxxxxxxx"); // or Client::from_env()
let email = client
.emails()
.send(&SendEmailParams {
from: "hello@send.acme.io".into(),
to: "ada@lumen.io".into(),
subject: Some("Your receipt".into()),
html: Some("<p>Thanks for your order.</p>".into()),
..Default::default()
})
.await?;
println!("Email {} accepted", email.id);Every failure is a Error whose name is SendClipper’s machine-readable
code (validation_failed, rate_limited, network_error, …). Network
errors, 429 and 5xx answers are retried with backoff, honouring
Retry-After, and every JSON write carries an Idempotency-Key, so a
retried send never goes out twice. Verify webhook deliveries with
verify_webhook.
Re-exports§
pub use types::*;
Modules§
- types
- Request and response shapes of the SendClipper REST API (
/v1).
Structs§
- ApiKeys
- Lists API keys. Keys are created and revoked in the dashboard only.
- Audiences
- Lists audiences.
- Automations
- Starts automations.
- Batch
- Sends up to 500 messages in one request.
- Client
- The SendClipper API client. Cheap to clone and safe to share across tasks.
- Client
Builder - Builds a
Client. - Contacts
- Manages contacts.
- Domains
- Manages sending and receiving domains.
- Emails
- Sends mail and reads the sent-mail log.
- Error
- What every failed call returns: an API refusal, or a request that never
got an answer. Branch on
Error::name, SendClipper’s machine-readable code;Error::messageis a sentence meant for a person. - Mailbox
Messages - Reads mail filed under an address. Reading never marks anything read.
- Mailboxes
- Manages addresses on receiving domains.
- Sandbox
Messages - Reads what a sandbox trapped.
- Sandboxes
- Manages sandboxes: inboxes that trap mail while you develop.
- Suppressions
- Manages the suppression list.
- Template
Assets - Manages images templates can show.
- Template
Tags - Manages template tags.
- Templates
- Manages email templates.
- Verify
Options - Tunes
verify_webhook. - Webhook
Dispatches - Reads and replays undelivered events.
- Webhook
Verification Error - Why
crate::verify_webhookrefused a delivery. - Webhooks
- Manages webhook endpoints.
- Workspace
Resource - Reads the key’s workspace.
Enums§
- Headers
- Where
verify_webhookfinds the signature: anhttp::HeaderMap(axum, actix-web, hyper, reqwest), name/value pairs, or just the header’s value.
Constants§
- DEFAULT_
BASE_ URL - Where requests go unless
ClientBuilder::base_urlorSENDCLIPPER_BASE_URLsays otherwise. - SIGNATURE_
HEADER - The header SendClipper signs deliveries in.
- VERSION
- This SDK’s version, as on crates.io.
- WEBHOOK_
TOLERANCE_ SECONDS - SendClipper’s documented tolerance: five minutes.
Functions§
- parse_
signature_ header (timestamp, signatures)fromt=<seconds>,v1=<hex>[,v1=<hex>].- sign_
payload hex(HMAC-SHA256(secret, "{timestamp}.{raw_body}")). Exported for tests of your own handler.- verify_
webhook - Verify a webhook delivery and return its parsed event.
- webhook_
signature_ header - A valid header value for a body, e.g. to test your endpoint locally.
Nonesigns at the current time.
Type Aliases§
- Result
Result<T, sendclipper::Error>.