Obviously Matrix is more of a protocol than an app, but I thought I’d aggregate my notes on Matrix-related stuff here.

Mautrix Telegram

PIP Packages

Install with the following command:

pip install --upgrade mautrix-telegram[all]

Otherwise you end up with missing dependencies and the error messages don’t exactly spell it out.

Naming

The name of the pip package is mautrix-telegram. Note the dash.

When running it, use:

python3 -m mautrix_telegram

Note the understore.

Rootless Podman Synapse

If you are running Synapse with podman, but the bridges are running natively, the config.yaml appservice address won’t work. It’s probably set to something like

appservice:
  # The address that the homeserver can use to connect to this appservice.
  address: http://localhost:29317 #example from Telegram

localhost in the Synapse container is itself, so it can’t contact the bridges.

Instead do this:

appservice:
  # The address that the homeserver can use to connect to this appservice.
  address: http://host.containers.internal:29317

Podman knows host.containers.internal is the host.

Installing Maubots and RSS

Here are some instructions for setting up the RSS bot using Maubots.

Assuming you are using Docker/Podman to run Synapse, create a Synapse user account for the bot:

podman exec -it synapse_synapse_1 bash
 
register_new_matrix_user -u rssbot -p <Some random password> --no-admin -c /data/homeserver.yaml

Then, for the most part, you can follow the instructions on the wiki to download and set up the environment.

A couple things of note for the config.yaml:

  • You can put in absolute paths for file and directory locations. For example: upload: /opt/synapse/data/maubot/plugins.
  • Remember, to add your homeserver under the homeservers section.
  • Add a user under admins like maubotuser: <some password>. Don’t edit root. This is for logging into the Maubot web interface.

Go ahead and start Maubot.

In an activated Maubot virtual environment, run mbc login and mbc auth -h <your homeserver url without https://>.

You’ll be asked for the username and password of the Synapse account initally created:

? Username rssbot
? Password ******************************

The output will be similar to:

Successfully logged in as @rssbot:<homeserver URL>.
Access token: syt_....
Device ID: maubot_R...

Log into http://localhost:29316/_matrix/maubot/ with the admin username and password defined in the config.yaml.

Create the client, by setting the user id to the Synapse account created initially.

Set the homeserver to your homeserver.

Use the Access token and Device Id provided by the output of mbc auth above.

Find plugins at https://plugins.mau.bot/ and download the .mbp files. Upload them to the plugins section of the Maubot Manager.

Then create an instance, with the Primary User being the Client created earlier and Type being the plugin uploaded.

In Element or whatever front-end you are using, create an unencrypted room, invite @rssbot:<your homeserver> and start subscribing.

The Maubot config.yaml defaults to no encryption. If you changed that, create an encrypted room instead.

Clearing Synapse local media files

curl --header "Authorization: Bearer <ACCESS_TOKEN>" \
    -X POST http://127.0.0.1:8008/_synapse/admin/v1/media/<YOUR_MATRIX_DOMAIN>/delete?before_ts=<UNIX_TIMESTAMP_IN_MS>

Get an unix timestamp. Remember, milliseconds.

Easiest way to get the access token is to open up Element, go to Settings -> More Options -> Help & About -> Advanced -> Access Token