Skip to main content

Crate sendclipper

Crate sendclipper 

Source
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.
ClientBuilder
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::message is a sentence meant for a person.
MailboxMessages
Reads mail filed under an address. Reading never marks anything read.
Mailboxes
Manages addresses on receiving domains.
SandboxMessages
Reads what a sandbox trapped.
Sandboxes
Manages sandboxes: inboxes that trap mail while you develop.
Suppressions
Manages the suppression list.
TemplateAssets
Manages images templates can show.
TemplateTags
Manages template tags.
Templates
Manages email templates.
VerifyOptions
Tunes verify_webhook.
WebhookDispatches
Reads and replays undelivered events.
WebhookVerificationError
Why crate::verify_webhook refused a delivery.
Webhooks
Manages webhook endpoints.
WorkspaceResource
Reads the key’s workspace.

Enums§

Headers
Where verify_webhook finds the signature: an http::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_url or SENDCLIPPER_BASE_URL says 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) from t=<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. None signs at the current time.

Type Aliases§

Result
Result<T, sendclipper::Error>.