codema.in
Sun 20 Jun 2021 10:31AM

A blog post on Matrix-XMPP bridge

RD Ravi Dwivedi Public Seen by 69

(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 https://matrix.org/ 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 https://conversations.im/ for XMPP for demonstration. You can choose XMPP client of choice, https://xmpp.org/software/clients.html . We'll use Bifröst bot https://github.com/matrix-org/matrix-bifrost 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 muc.pwned.life. [Screenshot 4 here]

  5. From the link https://github.com/matrix-org/matrix-bifrost/wiki/Address-syntax , 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 https://github.com/matrix-org/matrix-bifrost/wiki/Address-syntax .

[1] https://matrix.org/

PP

Pirate Praveen Sun 20 Jun 2021 10:41AM

Thanks for writing this. Mention the reason for recommending creation of an xmpp room and not matrix room first, that current implementation of the bridge does not support offline messages for xmpp users (message archive management or mam extention of xmpp), so users accessing matrix rooms from xmpp will not receive offline messages. Also mention the drawback of this approach - there is no admin access on the matrix side.

RD

Ravi Dwivedi Sun 20 Jun 2021 11:26AM

Thanks. I have added the reason for creating XMPP room first in the Note section.

S

sahilister Mon 21 Jun 2021 10:58AM

@Ravi Dwivedi, I want to suggest some cosmetic as well as language changes in the text. Can you share the etherpad link? Will add comments and suggestions there.

RD

Ravi Dwivedi Tue 22 Jun 2021 6:05AM

I didn't create a pad. Can you create one and write your comments there?

S

sahilister Fri 25 Jun 2021 2:58AM

@Ravi Dwivedi I have created this etherpad - https://etherpad.wikimedia.org/p/matrx-xmpp-bridge .

There's no particular change, just that I have removed a few typos, added italics for addresses, added spaces where required and made the text a bit crisp.

RD

Ravi Dwivedi Fri 25 Jun 2021 7:09AM

Thanks a lot @sahilister . I have changed the text above. Should we add on how to send D.M. from XMPP to a matrix user and vice-versa?

S

sahilister Fri 25 Jun 2021 7:17AM

@Ravi Dwivedi As the tutorial title states "How to join Matrix rooms via XMPP and vice-versa?", adding DM instructions would be a bit off-topic.

Maybe, if it's a bit difficult you can add another tutorial in this series titled something like "Conversing with a Matrix contact via XMPP" which can reference some/redundant section in this tutorial also, if required.

RD

Ravi Dwivedi Fri 25 Jun 2021 7:23AM

Okay. Maybe separate blog posts are better. Otherwise this will be a long post.

PP

Pirate Praveen Fri 25 Jun 2021 8:31AM

I think one blog post is better, just update the title if required

RD

Ravi Dwivedi Sat 26 Jun 2021 12:09PM

Proposed title change in the pad https://etherpad.wikimedia.org/p/matrx-xmpp-bridge .

Load More