Beeper Desktop API - Rust Client Library
A type-safe, ergonomic Rust client library for the Beeper Desktop API. Manage chats, messages, and accounts across multiple messaging networks (WhatsApp, Telegram, Signal, Matrix, and more) through a unified interface.
Features
- π Authentication: Bearer token and OAuth2 PKCE flow support
- π¬ Chat Management: List, create, search, and archive chats across all networks
- π¨ Message Operations: Send, fetch, and search messages with pagination support
- π₯ Account Management: List and manage connected messaging accounts
- π― Type-Safe: Full type safety with serde serialization/deserialization
- β‘ Async: Built on tokio for high-performance async operations
- π§ͺ Well-Tested: Comprehensive unit and integration tests
Installation
Add this to your Cargo.toml:
[]
= { = "." }
= { = "1", = ["full"] }
Quick Start
1. Create a Client
use BeeperClient;
async
2. Fetch Accounts
// List all connected messaging accounts
let accounts = client.get_accounts.await?;
for account in accounts
3. Fetch Chats
// List all chats
let chats_response = client.list_chats.await?;
for chat in &chats_response.items
4. Fetch Messages
// Get first chat
if let Some = chats_response.items.first
Examples
Ready-to-run examples are provided in the examples/ directory:
Run Examples
Set environment variables and run:
# optional, uses this by default
# Fetch and display all accounts
# Fetch and display all chats
# Fetch and display messages from the first chat
# Search chats and messages
# Or use default search term
Example Output
fetch_accounts
π€ Fetching connected accounts...
β
Successfully retrieved 3 account(s):
1. Beeper (Matrix) Account
ββ User: Erdem GΓΆksel
ββ Account ID: hungryserv
ββ User ID: @erdemdev:beeper.com
ββ Phone: +905325965386
ββ Email: zahrakon06@gmail.com
2. Instagram Account
ββ User: myinsta
ββ Account ID: instagramgo
ββ User ID: 17842413400511926
3. WhatsApp Account
ββ User: erdem
ββ Account ID: whatsapp
ββ User ID: 905325965386
fetch_chats
π Fetching chats from Beeper...
β
Successfully retrieved 25 chats:
1. Beeper Developer Community
2. DM: Annem
3. DM: umut
4. DM: ozgen
...
fetch_messages
π¬ Fetching messages from first chat: 'Beeper Developer Community'
β
Successfully retrieved 20 messages:
1. [2025-12-12T09:36:18.075Z] erdemdev: i will send its link when its finished
2. [2025-12-12T09:36:10.876Z] erdemdev: also i am currently making and api wrapper for rust
3. [2025-12-12T09:33:26.464Z] erdemdev: i just want to setup main beeper communication at my server
...
search
Searching for: "api"
π Searching chats...
β
Found 50 matching chat(s):
1. Beeper Developer Community (group)
ββ Network: Beeper (Matrix)
ββ Participants: 345
ββ Unread: 0
2. @erdemdev:beeper.com (single)
ββ Network: WhatsApp
ββ Participants: 2
ββ Unread: 0
3. Annem (single)
ββ Network: WhatsApp
ββ Participants: 2
ββ Unread: 0
π¨ Searching messages...
β
Found 20 matching message(s):
Chat: Beeper Developer Community
ββ 8 message(s) found:
1. [2025-12-12T09:36:18.075Z] erdemdev: i will send its link when its finished
2. [2025-12-12T09:36:10.876Z] erdemdev: also i am currently making and api wrapper for rust
3. [2025-12-12T09:33:26.464Z] erdemdev: i just want to setup main beeper communication...
π Search Summary for "api":
β’ Chats: 50
β’ Messages: 20
β’ Total Results: 70
API Overview
Core Types
Account
Represents a connected messaging account.
Chat
Represents a conversation (direct message or group).
Message
Represents a message in a chat.
User
Represents a person on the messaging platform.
Client Methods
Account Operations
// Get all connected accounts
let accounts: = client.get_accounts.await?;
Chat Operations
// List all chats with pagination
let chats = client.list_chats.await?;
// Get a specific chat
let chat: Chat = client.get_chat.await?;
// Create a new chat
let input = CreateChatInput ;
let output = client.create_chat.await?;
// Archive/unarchive a chat
let chat = client.archive_chat.await?;
// Search chats
let results = client.search_chats.await?;
Message Operations
// List messages in a chat with pagination
let messages = client.list_messages.await?;
// Send a message
let input = SendMessageInput ;
let output = client.send_message.await?;
// Search for messages with pagination
let results = client.search_messages.await?;
// Search for chats with pagination
let results = client.search_chats.await?;
Authentication
Bearer Token
Get a token from Beeper Desktop (Settings > API) and use it:
let client = new;
OAuth2 PKCE Flow
For MCP servers and applications requiring user authorization:
GET http://localhost:23373/oauth/authorize?
client_id=your-client-id&
response_type=code&
scope=read%20write&
redirect_uri=http://localhost:3000/callback
Exchange authorization code for token:
POST http://localhost:23373/oauth/token
code=authorization-code&
client_id=your-client-id&
grant_type=authorization_code&
redirect_uri=http://localhost:3000/callback
Pagination
Many list endpoints support pagination:
// Get first page
let page1 = client.list_chats.await?;
// Use cursor and direction for next page
if page1.has_more
For messages, use message.sort_key as the cursor:
let messages = client.list_messages.await?;
if messages.has_more
Error Handling
All operations return Result<T, BeeperError>:
match client.list_chats.await
Development
Building
# Build library
# Build with optimizations
# Build examples
Testing
# Run all tests
# Run with output
# Run integration tests (requires BEEPER_TEST_TOKEN env var)
BEEPER_TEST_TOKEN="token"
Code Quality
The library follows Rust best practices:
- Comprehensive error handling
- Type-safe abstractions
- Proper use of Options and Results
- Async/await patterns
- Idiomatic Rust naming conventions
Supported Networks
Beeper Desktop API provides access to these messaging networks:
- Telegram
- Signal
- Matrix
- Instagram (Direct Messages)
- Twitter/X (Direct Messages)
- Slack
- Discord
- Email (experimental)
- And more...
API Reference
For detailed API documentation, see:
License
MIT License - See LICENSE file for details
Contributing
Contributions are welcome! Please ensure:
- All tests pass (
cargo test) - Code is formatted (
cargo fmt) - No clippy warnings (
cargo clippy) - Changes include tests and documentation
Support
- API Issues: Beeper Support
- Library Issues: Open an issue on GitHub
- Documentation: See
/docsfolder and inline code comments
Changelog
v0.1.0 (2025-12-12)
- Initial release
- Support for accounts, chats, and messages
- Bearer token authentication
- Pagination support
- Three working examples (fetch_accounts, fetch_chats, fetch_messages)
- Comprehensive test suite