User Tools

Matrix Whatsapp Bridge

Whatsapp needs no presentation. It's the de-facto standard for support forums and chats, gaming communities and much more. What i find annoying about Discord is the constand push to monetization and general slugginess of it's clients.

While you don't strictly need to have the mobile client installed to use the bridge, it is by far the most practical way to achieve initial registration. After that, you can remove it from your phone. Additionally, if you don't want to use your real Discord account you can use a discord bot to login.

Discord can be easily and fully bridged with Matrix using the Mautrix-discord 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-discord
cd mautrix-discord
wget -O mautrix-discord.zip 'https://mau.dev/mautrix/discord/-/jobs/artifacts/main/download?job=build%20amd64' 
unzip mautrix-discord.zip
chmod +x mautrix-discord

Bridge setup

The discord bridge comes with an example-config.yaml file that you need to move, as i prefer, to the /data/conduwuit folder:

cp example-config.yaml /data/conduwuit/mautrix-discord-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:

database:
    type: sqlite3-fk-wal
    uri: file:/data/conduwuit/mautrix-whatsapp.db?_txlock=immediate

appservice:
    hostname: 127.0.0.1
    
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

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 >>
        
logging:
      filename: /var/log/conduwuit/mautrix-discord.log

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-discord -c  /data/conduwuit/mautrix-discord-config.yaml -g

Then perform the actual appservice registration, see here.

Usage

The discordbot user should have been created automatically.

Good! Now you can run the bridge:

/data/daemons/conduwuit/mautrix-discord/mautrix-discord -c /data/conduwuit/mautrix-discord-config.yaml

If all is well, your bridge should be up and running now.

By default the bridge will initially bridge only a few DM chats. If you want to bridge guilds (also called servers), you need to go to the bot chat and issue the command guilds status to list guilds and their IDs, then guild bridge « id » –entire (–entire will cause a bit of chaos for large guilds, use at your risk):

guilds status
Discord bridge bot
List of guilds:

 Polytopia (283436219780825088) - never bridge messages
 Jellyfin (772232779534172171) - never bridge messages

giulds bridge 283436219780825088 --entire

To join individual channels, you need to grab the channel ID from the discord web app and issue the command:

!discord bridge << channel id >>
</code

in a specific matrix room after adding the discordbot to it.


===== Login =====
To login into whatsapp you need to:
  * Start a chat with discordbot:chat.mydomain.com
  * type "login-qr"
  * Scan the QR code with your discord on your phone.

There might cases where Discord ask for a CAPTCHA, in this case you will have to abort the login and go with the more complicated //token// login described [[https://docs.mau.fi/bridges/go/discord/authentication.html|here]].


===== Autostart =====

Since i use OpenRC, simply drop the following script to /etc/init.d:
<file - /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 discord bridge"
description="Conduwuit discord Matrix Bridge"
pidfile="/run/conduwuit-discord.pid"
command_background=true
command="/data/daemons/conduwuit/mautrix-discord/mautrix-discord"
command_args="-c /data/conduwuit/mautrix-discord-config.yaml"
command_user="conduwuit:conduwuit"
output_log="/var/log/conduwuit/conduwuit-discord.log"
output_err="/var/log/conduwuit/conduwuit-discord.log"

start_pre() {
        cd /data/daemons/conduwuit/mautrix-discord
}

depend() {
        need net
}
</file>

Make it executable and add to the proper runlevel:
<code bash>
chmod +x /etc/init.d/conduwuit-discord
rc-update add conduwuit-discord default

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also, you acknowledge that you have read and understand our Privacy Policy. If you do not agree, please leave the website.

More information