feat(channels): implement WhatsApp Web channel with wa-rs integration

- Add wa-rs dependencies with custom rusqlite storage backend
- Implement functional WhatsApp Web channel using wa-rs Bot
- Integrate TokioWebSocketTransportFactory and UreqHttpClient
- Add message handling via Bot event loop with proper shutdown
- Create WhatsApp storage trait implementations for wa-rs
- Add WhatsApp config schema and onboarding support
- Implement Meta webhook verification for WhatsApp Cloud API
- Add webhook signature verification for security
- Generate unique message keys for WhatsApp conversations
- Remove unused Node.js whatsapp-web-bridge stub

Supersedes: baileys-based bridge approach in favor of native Rust wa-rs
This commit is contained in:
mmacedoeu 2026-02-18 18:23:03 -03:00 committed by Chummy
parent 9381e4451a
commit c2a1eb1088
10 changed files with 2502 additions and 516 deletions

View file

@ -367,12 +367,16 @@ pub async fn run_gateway(host: &str, port: u16, config: Config) -> Result<()> {
});
// WhatsApp channel (if configured)
let whatsapp_channel: Option<Arc<WhatsAppChannel>> =
config.channels_config.whatsapp.as_ref().map(|wa| {
let whatsapp_channel: Option<Arc<WhatsAppChannel>> = config
.channels_config
.whatsapp
.as_ref()
.filter(|wa| wa.is_cloud_config())
.map(|wa| {
Arc::new(WhatsAppChannel::new(
wa.access_token.clone(),
wa.phone_number_id.clone(),
wa.verify_token.clone(),
wa.access_token.clone().unwrap_or_default(),
wa.phone_number_id.clone().unwrap_or_default(),
wa.verify_token.clone().unwrap_or_default(),
wa.allowed_numbers.clone(),
))
});