2018-06-12 03:28:21 +02:00
|
|
|
### Configure the bridge
|
|
|
|
|
2018-10-23 00:19:23 +02:00
|
|
|
1. In Zulip, [create a bot](/help/add-a-bot-or-integration), using **Generic bot**
|
|
|
|
for the bot type. Download the bot's `zuliprc` configuration file to your
|
|
|
|
computer.
|
2018-06-12 03:28:21 +02:00
|
|
|
|
2018-10-23 00:19:23 +02:00
|
|
|
1. [Subscribe the bot](/help/add-or-remove-users-from-a-stream) to the Zulip
|
|
|
|
stream that will contain the mirror.
|
2018-06-12 03:28:21 +02:00
|
|
|
|
2018-10-23 00:19:23 +02:00
|
|
|
1. Inside the virtualenv you created above, run
|
2018-06-12 03:28:21 +02:00
|
|
|
|
|
|
|
```
|
2020-03-19 14:54:16 +01:00
|
|
|
python zulip/integrations/bridge_with_matrix/matrix_bridge.py \
|
|
|
|
--write-sample-config matrix_bridge.conf --from-zuliprc <path/to/zuliprc>
|
2018-06-12 03:28:21 +02:00
|
|
|
```
|
|
|
|
|
2018-10-23 00:19:23 +02:00
|
|
|
where `<path/to/zuliprc>` is the path to the `zuliprc` file you downloaded.
|
2018-06-12 03:28:21 +02:00
|
|
|
|
2018-10-23 00:19:23 +02:00
|
|
|
1. Create a user on [matrix.org](https://matrix.org/) or another matrix
|
|
|
|
server, preferably with a descriptive name like `zulip-bot`.
|
2018-06-12 03:28:21 +02:00
|
|
|
|
2018-10-23 00:19:23 +02:00
|
|
|
1. Edit `matrix_bridge.conf` to look like this:
|
2018-06-12 03:28:21 +02:00
|
|
|
|
|
|
|
```
|
2018-10-23 00:19:23 +02:00
|
|
|
[zulip]
|
|
|
|
email = bridge-bot@chat.zulip.org
|
|
|
|
api_key = aPiKeY
|
|
|
|
site = https://chat.zulip.org
|
|
|
|
stream = "stream name"
|
|
|
|
topic = "{{ integration_display_name }} mirror"
|
|
|
|
[matrix]
|
|
|
|
host = https://matrix.org
|
|
|
|
username = <your matrix username>
|
|
|
|
password = <your matrix password>
|
|
|
|
room_id = #room:matrix.org
|
2018-06-12 03:28:21 +02:00
|
|
|
```
|
|
|
|
|
2018-10-23 00:19:23 +02:00
|
|
|
The first three values should already be there; the rest you'll have to fill in.
|
|
|
|
Make sure **stream** is set to the stream the bot is
|
|
|
|
subscribed to.
|
|
|
|
|
2018-06-12 03:28:21 +02:00
|
|
|
{% if 'IRC' in integration_display_name %}
|
|
|
|
|
2018-10-23 00:19:23 +02:00
|
|
|
NOTE: For matrix.org, the `room_id` generally takes the form
|
|
|
|
`#<irc_network>_#<channel>:matrix.org`. You can see the format for
|
|
|
|
several popular IRC networks
|
|
|
|
[here](https://github.com/matrix-org/matrix-appservice-irc/wiki/Bridged-IRC-networks), under
|
|
|
|
the "Room alias format" column.
|
|
|
|
|
|
|
|
For example, the `room_id` for the `#zulip-test` channel on freenode is
|
2018-06-12 03:28:21 +02:00
|
|
|
`#freenode_#zulip-test:matrix.org`.
|
|
|
|
|
|
|
|
{% endif %}
|
|
|
|
|
2018-10-23 00:19:23 +02:00
|
|
|
1. Run the following command to start the matrix bridge:
|
|
|
|
|
|
|
|
```
|
2020-03-19 14:54:16 +01:00
|
|
|
python zulip/integrations/bridge_with_matrix/matrix_bridge.py -c matrix_bridge.conf
|
2018-10-23 00:19:23 +02:00
|
|
|
```
|
2018-06-12 03:28:21 +02:00
|
|
|
|
|
|
|
!!! tip ""
|
|
|
|
|
2018-10-23 00:19:23 +02:00
|
|
|
You can customize the message formatting by
|
2018-06-12 03:28:21 +02:00
|
|
|
editing the variables `MATRIX_MESSAGE_TEMPLATE` and `ZULIP_MESSAGE_TEMPLATE`
|
2020-03-19 14:54:16 +01:00
|
|
|
in `zulip/integrations/bridge_with_matrix/matrix_bridge.py`.
|