4.1 KiB
Matrix <--> Zulip bridge
This acts as a bridge between Matrix and Zulip.
Enhanced Features
- Supporting multiple (Zulip topic, Matrix channel)-pairs.
- Handling files according to their mimetype.
Installation
Run pip install -r requirements.txt
in order to install the requirements.
In case you'd like encryption to work, you need pip to install the matrix-nio
package with e2e support:
- First, you need to make sure that the development files of the
libolm
C-library are installed on your system! See the corresponding documentation of matrix-nio for further information on this point. pip install matrix-nio[e2e]
Steps to configure the Matrix bridge
To obtain a configuration file template, run the script with the
--write-sample-config
option to obtain a configuration file to fill in the
details mentioned below. For example:
-
If you installed the
zulip
package:zulip-matrix-bridge --write-sample-config matrix_bridge.conf
-
If you are running from the Zulip GitHub repo:
python matrix_bridge.py --write-sample-config matrix_bridge.conf
1. Zulip endpoint
- Create a generic Zulip bot, with a full name such as
Matrix Bot
. - The bot is able to subscribe to the necessary streams itself if they are public. (Note that the bridge will not try to create streams in case they do not already exist. In that case, the bridge will fail at startup.) Otherwise, you need to add the bot manually.
- In the
zulip
section of the configuration file, enter the bot'szuliprc
details (email
,api_key
, andsite
). - In the same section, also enter the Zulip
stream
andtopic
.
2. Matrix endpoint
- Create a user on the matrix server of your choice, e.g. matrix.org,
preferably with a descriptive name such as
zulip-bot
. - In the
matrix
section of the configuration file, enter the user's Matrix user IDmxid
and password. Please use the Matrix user ID (MXID) as format for the username! - Create the Matrix room(s) to be bridged in case they do not exits yet.
Remember to invite the bot to private rooms! Otherwise, this error will be
thrown:
Matrix bridge error: JoinError: M_UNKNOWN No known servers
. - Enter the
host
androom_id
into the same section. In case the room is private you need to use theInternal room ID
which has the format!aBcDeFgHiJkLmNoPqR:example.org
. In the official Matrix client Element, you can find thisInternal room ID
in theRoom Settings
underAdvanced
.
Adding more (Zulip topic, Matrix channel)-pairs
- Create a new section with a name starting with
additional_bridge
. - Add a
room_id
for the Matrix side and astream
and atopic
for the Zulip side.
Example:
[additional_bridge1]
room_id = #zulip:matrix.org
stream = matrix test
topic = matrix test topic
Running the bridge
After the steps above have been completed, assuming you have the configuration
in a file called matrix_bridge.conf
:
-
If you installed the
zulip
package: runzulip-matrix-bridge -c matrix_bridge.conf
-
If you are running from the Zulip GitHub repo: run
python matrix_bridge.py -c matrix_bridge.conf
Notes regarding IRC
Usage for IRC bridges
This can also be used to indirectly bridge between IRC and Zulip.
Matrix has been bridged to the listed
IRC networks,
where the 'Room alias format' refers to the room_id
for the corresponding IRC channel.
For example, for the Libera Chat channel #zulip-test
, the room_id
would be
#zulip-test:libera.chat
.
Caveats for IRC mirroring
There are certain IRC channels where the Matrix.org IRC bridge has been banned for technical reasons. You can't mirror those IRC channels using this integration.
TODO
- Adding support for editing and deleting messages?
- Handling encryption on the Matrix side (may need further discussion).