Skip to content

bit-shift-io/rosetta

Repository files navigation

Rosetta

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.

Features

  • 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-sdk for E2EE support and runs locally.
  • Loop Prevention: Intelligent bridging logic prevents infinite message loops between bots.

Supported Services

  • Matrix: Full generic client support (via matrix-sdk).
  • WhatsApp: Web client emulation (via whatsapp-rust).
  • Discord: Bot integration (via serenity).

Prerequisites

  • Rust: Nightly toolchain is required (due to whatsapp-rust dependencies).
  • 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.

Configuration

Rosetta uses a config.yaml file for all settings.

  1. Copy the example:

    cp config_example.yaml config.yaml
  2. 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.yaml for full options including Aliases.

Commands

Rosetta supports built-in commands that can be sent in any bridged channel:

  • .status
    • Usage: Type .status in 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.

Running

  1. Build and Run:
    cargo run
  2. First Run:
    • If using WhatsApp, a QR code will appear in the terminal. Scan it with your phone (Linked Devices).

Development

  • 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).

Docker / Podman

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

About

A bridge that connects multiple chat services Matrix, WhatsApp, discord etc

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published