Skip to main content

Crate cratefield_module_owlpost

Crate cratefield_module_owlpost 

Source
Expand description

cratefield-module-owlpost: turns Owlpost’s signed webhooks into harness events (issue #673).

use cratefield_module_owlpost::{Owlpost, OwlpostEvents};

let module = Owlpost::new(OwlpostEvents::new().on_inbound(|mail| {
    Box::pin(async move { Ok(()) })
}));

POST /v1/owlpost/events verifies with the adapter’s webhook verifier against OWLPOST_WEBHOOK_SECRET — the signature is the only authorisation, and a deployment without the secret fails closed. Every verified delivery deduplicates on the envelope’s id through the Inbox ledger shipped as the module’s one migration, so a redelivery is a 200 no-op.

Structs§

InboundMail
What an inbound delivery said, metadata only. A held message carries nothing beyond its id and reason — no sender, recipients, subject or body — because the adapter’s envelope never carries them; a hook that wants them fetches from Owlpost itself.
Owlpost
The Owlpost inbound-events module.
OwlpostEvents
The venture’s hooks: OwlpostEvents::new().on_inbound(|mail| ...).

Constants§

EVENTS
Every event this module emits: EVENT_INBOUND plus one per provider delivery type, the wire’s email.<what> as owlpost.<what>. A type Owlpost adds later is claimed but emits nothing until it is named here.
EVENT_INBOUND
owlpost.inbound: mail that reached the venture, received or held. The payload is an InboundMail.
MODULE_NAME
The module’s name: mounted at /v1/owlpost, config keys prefixed OWLPOST_.
SECRET_KEY
The config key holding the signing secret. Read per request; absent fails closed, present-but-blank fails Module::validate_config.

Type Aliases§

InboundHook
The venture’s inbound hook: called inline per verified received or held delivery, before the dedup claim commits. Its error is the delivery’s 5xx — which is what makes Owlpost retry.