Expand description
Lightweight Webex Mercury WebSocket + KMS decryption for receiving bot messages.
This crate provides a minimal, standalone way to receive and decrypt Webex messages over the Mercury WebSocket, without the full Webex SDK.
§Example
use webex_message_handler::{WebexMessageHandler, Config, HandlerEvent};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let handler = WebexMessageHandler::new(Config {
token: std::env::var("WEBEX_BOT_TOKEN")?,
..Default::default()
})?;
let mut rx = handler.take_event_rx().await.unwrap();
handler.connect().await?;
while let Some(event) = rx.recv().await {
match event {
HandlerEvent::MessageCreated(msg) => {
println!("[{}] {}", msg.person_email, msg.text);
}
_ => {}
}
}
Ok(())
}Re-exports§
pub use errors::WebexError;pub use handler::HandlerEvent;pub use handler::WebexMessageHandler;pub use types::Config;pub use types::ConnectionStatus;pub use types::DecryptedMessage;pub use types::DeletedMessage;pub use types::DeviceRegistration;pub use types::FetchFn;pub use types::FetchRequest;pub use types::FetchResponse;pub use types::HandlerStatus;pub use types::InjectedWebSocket;pub use types::MercuryActivity;pub use types::MercuryActor;pub use types::MercuryObject;pub use types::MercuryTarget;pub use types::NetworkMode;pub use types::WebSocketFactory;
Modules§
- device_
manager - WDM device registration, refresh, and unregistration.
- errors
- Error types for webex-message-handler.
- handler
- Main orchestrator: device registration, Mercury WebSocket, KMS, decryption.
- jwe
- Pure-Rust JWE compact serialization (RFC 7516) for the algorithms used by Webex KMS.
- kms_
client - KMS client for ECDH key exchange and encryption key retrieval.
- mercury_
socket - Mercury WebSocket connection with auth, heartbeat, and reconnection.
- message_
decryptor - JWE message decryption for Webex activities.
- types
- Data types for webex-message-handler.