whatsapp-rust
A high-performance, async Rust library for the WhatsApp Web API. Inspired by whatsmeow (Go) and Baileys (TypeScript).
Features
Authentication
- QR code pairing
- Pair code (phone number) linking
- Persistent sessions with automatic reconnection
Messaging
- End-to-end encrypted messages (Signal Protocol)
- One-on-one and group chats
- Message editing and reactions
- Quoting/replying to messages
- Delivery, read, and played receipts
Media
- Upload and download images, videos, documents, GIFs, and audio
- Automatic encryption and decryption
Contacts & Groups
- Check if phone numbers are on WhatsApp
- Fetch profile pictures and user info
- Query group metadata and participants
- List all groups you're participating in
Presence & Chat State
- Set online/offline presence
- Typing indicators (composing, recording, paused)
- Block and unblock contacts
Architecture
- Modular design - Pluggable storage, transport, and HTTP clients
- Runtime agnostic - Works with Tokio, async-std, or WASM
- SQLite included - Default storage backend, easily swappable
Quick Start
use Arc;
use Bot;
use SqliteStore;
use TokioWebSocketTransportFactory;
use UreqHttpClient;
use Event;
async
Run the included demo bot:
Project Structure
whatsapp-rust/
├── src/ # Main client library
├── wacore/ # Platform-agnostic core (no_std compatible)
│ ├── binary/ # WhatsApp binary protocol
│ ├── libsignal/ # Signal Protocol implementation
│ └── appstate/ # App state management
├── waproto/ # Protocol Buffers definitions
├── storages/sqlite-storage # SQLite backend
├── transports/tokio-transport
└── http_clients/ureq-client
Custom Backends
Implement your own storage, transport, or HTTP client by implementing the respective traits. See the default implementations for reference.
Disclaimer
This is an unofficial, open-source reimplementation. Using custom WhatsApp clients may violate Meta's Terms of Service and could result in account suspension. Use at your own risk.