This is an old revision of the document!
Matrix Whatsapp Bridge
Whatsapp need to presentation. It's the de-facto standard for private and group chats. Nobody can live without it, and it seems to be permanently installed on every device we purchase. Also, lots of malware and spyware is known to be installed trough whatsapp itself.
Unfortunately, you cannot get rid of whatsapp fully, since the official client for mobile (Android and IOS) is the only way to keep a working whatsapp profile.
Using the Matrix bridge, you can remove all your whatsapp client permissions, including disable notifications. You still need to keep it installed somewhere on the phone with your main phone number, and open it once every week or so to prevent all your secondary profiles to be disabled.
You could install Whatsapp on an Android Virtual Emulator and fake your phone numnber on it, but it's strongly discouraged because it can get your whatsapp acocunt permanently banned. You have been warned.
Whatsapp can be easily and fully bridged with Matrix using the Mautrix-Whatsapp bridge here.
Installation
I asusme you are installing the bridge directly together with the Matrix server, as user conduwuit.
Create a subfolder to install the bridge:
su - conduwuit mkdir mautrix-whatsapp cd mautrix-whatsapp wget -O mautrix-whatsapp.zip 'https://mau.dev/mautrix/whatsapp/-/jobs/artifacts/main/download?job=build%20amd64' unzip mautrix-whatsapp.zip chmod +x mautrix-whatsapp
Bridge setup
Let the bridge generate the basic configuration file, and move it to the /data/caonduwuit folder:
./mautrix-whatsapp -e mv config.yaml /data/conduwuit/mautrix-whatsapp-config.yaml
Now edit it. You should take a good look at it, the following are only hints and pointers to what you aboslutely need to change:
network: # This is very important to have usernames instead of phone numbers! displayname_template: "{{or .FullName .BusinessName .PushName .Phone}} (WA)" database: type: sqlite3-fk-wal uri: file:/data/conduwuit/mautrix-whatsapp.db?_txlock=immediate homeserver: address: https://chat.mydomain.com domain: chat.mydomain.com permissions: # this is probably not needed, but anyway... "*": "relaybot" # non-local users can only see messages "chat.mydomain.com": "full" # full access to all local users "@myself:chat.mydomain.com": "admin" # who can admin the bot backfill: enabled: true # to populate chats with older messages encryption: # Whether to enable encryption at all. If false, the bridge will not function in encrypted rooms. allow: true double_puppet: # Servers to always allow double puppeting from. # This is only for other servers and should NOT contain the server the bridge is on. servers: anotherserver.example.org: https://matrix.anotherserver.example.org # Whether to allow client API URL discovery for other servers. When using this option, # users on other servers can use double puppeting even if their server URLs aren't # explicitly added to the servers map above. allow_discovery: false # Shared secrets for automatic double puppeting. # See https://docs.mau.fi/bridges/general/double-puppeting.html for instructions. secrets: chat.mydomain.com: as_token:<< here the double-puppet token >>
Note that backfill is disabled by default, you need to enable it to see older messages. Also note that messages cannot be backfilled for already created rooms, so don't forget to enable backfill before the first start!
Since my server will have just a few users, i decided to use an SQLite database.
Bridge Registration
At this point you need to register the bridge with the Matrix server.
First of all, generate the registration.yaml file:
./mautrix-whatsapp -c /data/conduwuit/mautrix-whatsapp-config.yaml -g
Then perform the actual appservice registration, see here.
Usage
The whatsappbot user should have been created automatically.
Good! Now you can run the bridge:
/data/daemon/mautrix-whatsapp/mautrix-whatsapp -c /data/conduwuit/mautrix-whatsapp-config.yaml
If all is well, your bridge should be up and running now.
Login
To login into whatsapp you need to:
- Start a chat with whatsappbot:chat.mydomain.com
- type “login qr”
- Scan the QR code with your whatsapp on your phone.
You could install whatsapp on a Android Virtual Emulator, but it's discouraged and could lead to a ban of your account.
Note: if your usernames do not get popupated, you should do a search username in the whatsappbot chat.
Autostart
Since i use OpenRC, simply drop the following script to /etc/init.d:
- /etc/init.d/conduwuit-whatsapp
#!/sbin/openrc-run # Copyright 2025 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 name="conduwuit whatsapp bridge" description="Conduwuit whatsapp Matrix Bridge" pidfile="/run/conduwuit-whatsapp.pid" command_background=true command="/data/daemons/conduwuit/mautrix-whatsapp/mautrix-whatsapp" command_args="/data/conduwuit/mautrix-whatsapp-config.yaml" command_user="conduwuit:conduwuit" output_log="/var/log/conduwuit/conduwuit-whatsapp.log" output_err="/var/log/conduwuit/conduwuit-whatsapp.log" start_pre() { cd /data/daemons/conduwuit/mautrix-whatsapp } depend() { need net }
Make it executable and add to the proper runlevel:
chmod +x /etc/init.d/conduwuit-whatsapp rc-update add conduwuit-whatsapp default