A complete system to bridge WhatsApp/Instagram into a secure Matrix server. This project allows you to control a WhatsApp account programmatically or via a custom interface.
Before running this, make sure you have:
- Docker Desktop (Running on your Mac)
- Node.js & NPM
- Expo Go App (On your physical phone)
The backend handles the server (Synapse) and the connection to WhatsApp (Mautrix Bridge).
-
Navigate to the backend folder:
cd unified-backend -
Get your Local IP: Run this in terminal:
ipconfig getifaddr en0(oren1). Note this down! We will call itYOUR_MAC_IP. -
Update Configuration: Open
docker-compose.ymland replaceYOUR_MAC_IPwith your actual IP. -
Generate & Fix Configs (One-Time Setup): Since we don't push passwords to GitHub, you must generate them locally:
-
Generate Synapse Config:
docker run -it --rm -v "$PWD/synapse-data:/data" -e SYNAPSE_SERVER_NAME=YOUR_MAC_IP -e SYNAPSE_REPORT_STATS=no matrixdotorg/synapse:latest generate -
Edit
synapse-data/homeserver.yaml:- Change
enable_registration: falseβtrue - Change
bind_addresses: ['::1', '127.0.0.1']β['0.0.0.0'] - Add this to the very bottom:
app_service_config_files: - /data/registration.yaml
- Change
-
Setup Bridge Config: Create a file
whatsapp-data/config.yamland paste this (UpdateYOUR_MAC_IP):homeserver: address: http://synapse:8008 domain: YOUR_MAC_IP appservice: address: http://mautrix-whatsapp:29318 hostname: 0.0.0.0 port: 29318 database: { type: sqlite3, uri: file:/data/whatsapp.db } id: whatsapp bot: { username: whatsappbot, displayname: WhatsApp Bridge } as_token: "temp_as" hs_token: "temp_hs" network: { mode: default } bridge: permissions: { "*": "relay", "YOUR_MAC_IP": "user", "@admin:YOUR_MAC_IP": "admin" } relay: { enabled: true, admin_only: true } logging: { print_level: debug }
-
Generate Registration File:
docker run --rm -v "$PWD/whatsapp-data:/data" dock.mau.dev/mautrix/whatsapp:latest cp whatsapp-data/registration.yaml synapse-data/registration.yaml
-
-
Start the Server:
docker-compose up -d
-
Create Admin User:
docker exec -it synapse register_new_matrix_user http://localhost:8008 -c /data/homeserver.yaml -u admin -p password123 --admin
The mobile app is used to scan the QR code and link your device.
-
Navigate to the frontend folder:
cd ../WhatsAppLogin -
Install Dependencies:
npm install
-
Configure IP: Open
App.js. Find theHOMESERVERandBOT_IDconstants at the top. Replace192.168.X.Xwith yourYOUR_MAC_IP. -
Run the App:
npx expo start --clear
Scan the QR code with your phone using the Expo Go app.
- On the App, wait for "Client Ready" logs.
- Tap Start Setup (This invites the bot).
- Tap Send Login.
- A QR Code will appear in the app logs.
- Open WhatsApp on your real phone β Linked Devices β Link a Device.
- Scan the QR code shown on the Expo app.
π Success! Your WhatsApp is now bridged to your Matrix server.
- App crashes on startup? Make sure
YOUR_MAC_IPis correct inApp.jsand your phone is on the same Wi-Fi. - Bot doesn't reply? Run
docker restart mautrix-whatsapp. - Connection Refused? Ensure Docker is running (
docker ps).