ferro_whatsapp/lib.rs
1//! # ferro-whatsapp
2//!
3//! WhatsApp Business Cloud API integration for the Ferro framework.
4//!
5//! Provides outbound message sending (text and template messages) via the Meta
6//! Cloud API v23.0, with a static OnceLock facade matching the ferro-stripe pattern.
7//! Inbound webhook verification, message deduplication, and typed event dispatch
8//! are provided by the `webhook` and `dedup` modules.
9//!
10//! ## Quick Start
11//!
12//! ```rust,ignore
13//! use ferro_whatsapp::{WhatsApp, WhatsAppConfig, Message};
14//!
15//! // Initialize once at app startup
16//! let config = WhatsAppConfig::from_env(Box::new(|phone| phone == "393401234567"))
17//! .expect("WhatsApp config not set");
18//! WhatsApp::init(config);
19//!
20//! // Send a text message from any handler
21//! let result = WhatsApp::send("393409999999", Message::Text {
22//! body: "Your order is ready!".into(),
23//! }).await?;
24//! println!("Sent wamid: {}", result.wamid);
25//! ```
26
27pub mod client;
28pub mod config;
29pub mod dedup;
30pub mod error;
31pub mod message;
32pub mod webhook;
33
34pub use client::WhatsApp;
35pub use config::WhatsAppConfig;
36pub use dedup::{DeduplicationStore, InMemoryDeduplicationStore};
37pub use error::Error;
38pub use message::{DeliveryStatus, Message, SendResult, SenderIdentity};
39pub use webhook::events::{ProcessWhatsAppWebhook, WhatsAppStatusUpdate, WhatsAppTextReceived};
40pub use webhook::signed_whatsapp_payload;
41pub use webhook::verify_whatsapp_webhook;