Skip to main content

InboundWebhook

Trait InboundWebhook 

Source
pub trait InboundWebhook: Send + Sync {
    // Required methods
    fn provider(&self) -> &'static str;
    fn parse_inbound(
        &self,
        headers: &Headers,
        body: &[u8],
    ) -> Result<InboundMessage, SmsError>;

    // Provided method
    fn verify(&self, _headers: &Headers, _body: &[u8]) -> Result<(), SmsError> { ... }
}
Expand description

Provider-agnostic interface for processing inbound SMS webhooks.

Each provider crate implements this trait on its client type, enabling the unified InboundRegistry and WebhookProcessor to handle any provider without compile-time knowledge of which ones are in use.

Required Methods§

Source

fn provider(&self) -> &'static str

A stable, lowercase identifier for this provider (e.g. "plivo", "twilio", "aws-sns"). Used as the lookup key in InboundRegistry.

Source

fn parse_inbound( &self, headers: &Headers, body: &[u8], ) -> Result<InboundMessage, SmsError>

Parse the raw HTTP payload (headers + body) into a normalized InboundMessage.

Provided Methods§

Source

fn verify(&self, _headers: &Headers, _body: &[u8]) -> Result<(), SmsError>

Verify the cryptographic signature on the incoming request.

The default implementation is a no-op (always succeeds). Providers that support webhook signatures should override this.

Implementors§