Sun 20 Jun 2021 10:31AM

A blog post on Matrix-XMPP bridge

RD Ravi Dwivedi Public Seen by 68

(Credits: Text improved by Sahilister)

Last date to comment: 28-June-2021.

Tutorial: How to join Matrix rooms via XMPP and vice-versa?

Bridging from Matrix means that it's possible to read and write to channels hosted outside Matrix network. For example, it's possible to speak in IRC, Slack and XMPP channels/rooms using your Matrix account and vice-versa. Matrix-XMPP bridge allows us to link Matrix rooms and XMPP rooms (called public channels) which means XMPP users can post messages in Matrix rooms (using XMPP itself) and Matrix users can post messages in XMPP rooms (using Matrix itself). 

Note - Matrix-XMPP bridging support is available for unencrypted rooms only as of now.

To create an XMPP-Matrix bridged room, we will use Conversations app for XMPP for demonstration. You can choose XMPP client of choice, . We'll use Bifröst bot for bridging. 

Steps to create a bridged room:

  1. Create an XMPP room. For this, press the '+' button in the Conversations app (or XMPP app of choice) and select the option 'create public channel'. [Insert Screenshot 1 here].

  2. Name the channel. As an example, we are naming the public channel as 'Test Channel'. [Screenshot 2 here].

  3. Go to 'channel details' and note the XMPP address of the room. [Screenshot 3 here]. 

  4. The XMPP address will be of the formMUCNAME@MUCDOMAIN. In our example, MUCNAME is test-channel and MUCDOMAIN is [Screenshot 4 here]

  5. From the link , use the MUCs syntax from Matrix → XMPP section.

  6. Insert MUCNAME and MUCDOMAIN in the syntax in step 5 obtained in step 4. In our example, the matrix room address becomes .

  7. In Matrix, go to Add room → Explore Public Rooms → Type the Matrix address of the room obtained in step 6 → Join.

    (Insert Screenshot 5 here)

The Matrix room will be automatically bridged to XMPP, so XMPP users can now receive messages posted by Matrix users in the room and vice-versa.

Note - In this tutorial, we first created an XMPP room (a public channel on XMPP) and then joined this room via Matrix. The drawback of this approach is that there is no admin access on the Matrix side as of now.

Not Recommended: The process can also be done the other way round as well, creating a Matrix room first and then joining it via XMPP. The drawback of the approach is that XMPP users miss the messages sent by Matrix users in the room when they're offline. Due to this, we do not recommend creating the Matrix room first and then bridging it to XMPP. Additionally this keeps xmpp id of participants in public channels private, because by default matrix id in public groups are visible to all participants of matrix rooms but it is only visible to admins on XMPP public channels. However, if you would like to create a Matrix room first and then bridge it to XMPP, use the above steps and replace XMPP by Matrix and vice-versa. To convert the room's Matrix address to XMPP address, use this documentation .



Ravi Dwivedi Mon 28 Jun 2021 1:46PM

I tried this a few times--creating an XMPP room and then joining it via matrix. The Android Element(F-Droid as well as the Google Play version) and Fluffychat apps say 'The room does not exist'. If I try to join the room via matrix in desktop, then the joining works. Therefore, for the video tutorial, I joined the room using desktop Element but then after the merging of clips , one taken in Android and one in Mac, the final video was not clear. The video tutorial is here which I intend to re-record and re-upload.