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§
- Inbound
Mail - 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.
- Owlpost
Events - The venture’s hooks:
OwlpostEvents::new().on_inbound(|mail| ...).
Constants§
- EVENTS
- Every event this module emits:
EVENT_INBOUNDplus one per provider delivery type, the wire’semail.<what>asowlpost.<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 anInboundMail.- MODULE_
NAME - The module’s name: mounted at
/v1/owlpost, config keys prefixedOWLPOST_. - SECRET_
KEY - The config key holding the signing secret. Read per request; absent
fails closed, present-but-blank fails
Module::validate_config.
Type Aliases§
- Inbound
Hook - 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.