Rosetta is a modular, multi-protocol chat bridge written in Rust. It connects different chat services (Matrix, WhatsApp, Discord) together, allowing seamless communication across platforms.
- Multi-Service Support: Connects Matrix, WhatsApp, and Discord.
- Flexible Bridging: Define multiple bridges to link specific channels/rooms across services.
- Aliases: Map user IDs to readable display names per channel.
- Secure: Uses
matrix-sdkfor E2EE support and runs locally. - Loop Prevention: Intelligent bridging logic prevents infinite message loops between bots.
- Matrix: Full generic client support (via
matrix-sdk). - WhatsApp: Web client emulation (via
whatsapp-rust). - Discord: Bot integration (via
serenity).
- Rust: Nightly toolchain is required (due to
whatsapp-rustdependencies). - Matrix Account: A dedicated bot account is recommended.
- WhatsApp Account: You will need to scan a QR code to link the session.
- Discord Bot: You need a Bot Token and Privileged Gateway Intents (Message Content, Server Members, Presence) enabled in the Discord Developer Portal.
Rosetta uses a config.yaml file for all settings.
-
Copy the example:
cp config_example.yaml config.yaml
-
Edit
config.yaml:The configuration has two main sections:
services: Define your bot accounts (Matrix login, Discord token, etc.).bridges: Define which channels talk to each other.
Example Snippet:
services: my_matrix_bot: protocol: matrix homeserver_url: "https://matrix.org" username: "startrek_bridge_bot" password: "secure_password" my_discord_bot: protocol: discord bot_token: "YOUR_DISCORD_TOKEN" bridges: general_chat: - service: my_matrix_bot channel: "!roomid:matrix.org" display_names: true bridge_own_messages: false # Don't bridge the bot's own responses - service: my_discord_bot channel: "1234567890" # Channel ID display_names: true bridge_own_messages: true # Bridge your own messages if using personal account
Tip: See
config_example.yamlfor full options including Aliases.
Rosetta supports built-in commands that can be sent in any bridged channel:
.status- Usage: Type
.statusin a chat. - Effect: The bot checks the connection health of all services in that specific bridge and posts a report (e.g., "Bridge Status: Connected").
- Note: The command itself is also forwarded to other bridged channels so everyone knows a status check was performed.
- Usage: Type
- Build and Run:
cargo run
- First Run:
- If using WhatsApp, a QR code will appear in the terminal. Scan it with your phone (Linked Devices).
- Dependencies: managed in
Cargo.toml. - Architecture:
src/main.rs: Entry point and service initialization.src/bridge.rs: Core bridging logic and message routing.src/services/: Protocol-specific implementations (Service trait).
Login: podman login docker.io
Build: podman build -t docker.io/gibbz/rosetta:latest .
Inspect: podman run --rm -it rosetta:latest sh
Push: podman push docker.io/gibbz/rosetta:latest