dravr_canot/lib.rs
1// ABOUTME: Unified multi-platform messaging library for WhatsApp, Slack, Discord, Telegram, Messenger
2// ABOUTME: Trait-based architecture with transport adapters and response renderers per channel
3//
4// SPDX-License-Identifier: MIT OR Apache-2.0
5// Copyright (c) 2026 dravr.ai
6
7#![deny(unsafe_code)]
8
9//! # Dravr Channels
10//!
11//! A unified messaging interface for routing conversations through external chat
12//! platforms (Whatsapp, Messenger, Discord, Slack, Telegram).
13//!
14//! ## Integration Modes
15//!
16//! 1. **Programmatic** — use the [`MessagingChannel`] trait directly in your Rust code
17//! 2. **Server** — run `dravr-canot-server` as a standalone REST + MCP API server
18//!
19//! ## Architecture
20//!
21//! Each channel implements two traits:
22//! - [`TransportAdapter`] — webhook parsing, signature verification, raw HTTP send
23//! - [`ResponseRenderer`] — format [`OutgoingMessage`](models::OutgoingMessage) into channel-specific payloads
24
25/// Messaging error types
26pub mod error;
27
28/// Data models: channel types, messages, delivery receipts, configuration
29pub mod models;
30
31/// Runtime configuration loaded from environment variables
32pub mod config;
33
34/// Trait for pluggable channel configuration storage backends
35pub mod config_store;
36
37/// Environment-variable-based channel config store for standalone deployments
38pub mod env_config_store;
39
40/// Shared HTTP client for outbound API calls
41pub mod http_client;
42
43/// Channel trait combining transport and rendering
44pub mod channel;
45
46/// Channel descriptor metadata (name, type, webhook path, capabilities)
47pub mod descriptor;
48
49/// Transport adapter trait for webhook ingress and outbound HTTP
50pub mod transport;
51
52/// Response renderer trait for channel-specific message formatting
53pub mod renderer;
54
55/// Channel registry mapping `ChannelType` to adapter instances
56pub mod registry;
57
58/// Stateless adapter factory for on-demand channel adapter construction
59pub mod factory;
60
61/// Outbound retry worker with exponential backoff and dead-letter queue
62pub mod retry;
63
64/// Observability helpers for structured tracing spans and metrics
65pub mod observability;
66
67/// Slash command infrastructure for markdown-defined messaging commands
68pub mod commands;
69
70/// Shared Meta Platform (Messenger + Whatsapp) HMAC-SHA256 signature verification
71pub mod meta_signature;
72
73/// Per-channel adapter implementations
74pub mod channels;
75
76// Re-export primary types for consumers
77pub use channel::MessagingChannel;
78pub use config_store::ChannelConfigStore;
79pub use descriptor::ChannelDescriptor;
80pub use env_config_store::EnvConfigStore;
81pub use registry::ChannelRegistry;
82pub use renderer::ResponseRenderer;
83pub use transport::TransportAdapter;