1 unstable release
Uses new Rust 2024
| 0.1.0 | Mar 2, 2026 |
|---|
#12 in #sms
87KB
2K
SLoC
matrix-bridge-message
A Matrix <-> SMS/Message bridge written in Rust.
Maintainer: Palpo Team
Contact: chris@acroidea.com
Overview
- Rust-only implementation for Matrix <-> SMS/Message bridging
- Matrix appservice + SMS gateway bridge core
- HTTP endpoints for health/status/metrics and provisioning
- Database backends: PostgreSQL, SQLite, and MySQL (feature-gated)
- Dockerfile for local build and container runtime
Status
🚧 Under Active Development - This project is in early development stages.
Features (Planned)
- Project structure and configuration
- Matrix AppService integration
- SMS gateway support (Twilio, AWS SNS)
- Bidirectional message bridging
- Media message support
- Read receipts and typing notifications
- Contact synchronization
- Multi-database support
Repository Layout
src/: bridge implementationconfig/config.sample.yaml: sample configurationmigrations/: database migrationsDockerfile: multi-stage container build (planned)
Prerequisites
- Rust toolchain (compatible with the project; Docker build uses Rust 1.93)
- A Matrix homeserver configured for appservices
- SMS gateway credentials (Twilio or AWS SNS)
- Database: PostgreSQL, SQLite, or MySQL
Quick Start (Local)
- Create your config file:
cp config/config.sample.yaml config.yaml
-
Set the required values in
config.yaml:bridge.domainbridge.homeserver_urldatabase.urlmessage.gateway_typeand corresponding gateway credentials- registration values (
as_token,hs_token)
-
Run:
cargo check
cargo run
Configure SMS Gateway
Twilio
- Sign up at https://www.twilio.com
- Get your Account SID and Auth Token from the console
- Purchase or use a Twilio phone number
- Configure in
config.yaml:
message:
gateway_type: "twilio"
twilio:
account_sid: "YOUR_ACCOUNT_SID"
auth_token: "YOUR_AUTH_TOKEN"
phone_number: "+1234567890"
AWS SNS
- Set up AWS credentials with SNS permissions
- Configure in
config.yaml:
message:
gateway_type: "aws_sns"
aws_sns:
region: "us-east-1"
access_key_id: "YOUR_ACCESS_KEY"
secret_access_key: "YOUR_SECRET_KEY"
Configure Matrix / Palpo
- In Palpo config (
palpo.toml), set your server name and appservice registration directory:
server_name = "example.com"
appservice_registration_dir = "appservices"
-
Place your bridge registration file under that directory:
appservices/message-registration.yaml
-
Ensure tokens are consistent between Palpo registration and bridge config.
Database Configuration
The bridge auto-detects DB type from connection string prefix:
postgres://orpostgresql://-> PostgreSQLsqlite://-> SQLitemysql://ormariadb://-> MySQL / MariaDB
Examples:
database:
url: "postgresql://user:password@localhost:5432/matrix_bridge"
max_connections: 10
min_connections: 1
database:
url: "sqlite://./data/matrix-bridge.db"
Environment Overrides
The following environment variables are supported:
CONFIG_PATH- Path to config fileMATRIX_BRIDGE_MESSAGE__BRIDGE__DOMAIN- Bridge domainMATRIX_BRIDGE_MESSAGE__REGISTRATION__AS_TOKEN- AppService tokenMATRIX_BRIDGE_MESSAGE__REGISTRATION__HS_TOKEN- Homeserver token- And more (see configuration documentation)
Development
Build
cargo build
Test
cargo test
Run with logging
RUST_LOG=debug cargo run
License
Apache-2.0
Contributing
Contributions are welcome! Please read our contributing guidelines before submitting PRs.
Related Projects
- matrix-bridge-discord - Discord bridge
- mautrix-meta - Facebook/Instagram bridge (Go)
Dependencies
~150MB
~3.5M SLoC