Mautrix-Telegram Bridge

1290 Members
Discussion about mautrix-telegram | Latest release: v0.10.0 | https://github.com/tulir/mautrix-telegram | Bridged to https://t.me/mautrix_telegram365 Servers

Load older messages

25 Jul 2021
@magier-georg:asra.grmagier-georg joined the room.21:22:38
26 Jul 2021
@github:maunium.netGitHub [tulir/mautrix-telegram] hwittenborn starred the repo 00:06:50
@github:maunium.netGitHub [tulir/mautrix-telegram] rojserbest starred the repo 07:27:50
@github:maunium.netGitHub [tulir/mautrix-telegram] undercoverturbo opened issue #646: Voice message files are named "unnamed file" which breaks other bridges.

When sending a voice message, the telegram brige sends a file named "unnamed file" to matrix. This brakes other bridges etc., since there is a space in this file name and no file ending like .mp3 for example.

@specsx-codebot:matrix.org@specsx-codebot:matrix.org joined the room.18:03:58
@specsx-codebot:matrix.org@specsx-codebot:matrix.org left the room.18:26:38
27 Jul 2021
@l.drago:matrix.orgl.drago joined the room.08:14:54
@liberin:matrix.orgEvgeny joined the room.09:14:24
@s-metzger:matrix.orgs-metzger joined the room.09:38:45
@jokerneo:matrix.org@jokerneo:matrix.org joined the room.14:05:14
@jokerneo:matrix.org@jokerneo:matrix.org left the room.14:05:27
@dataejaculation:matrix.orgNo-Value HarshMell0w [] Shadowy Super Coder Cumrun [] changed their display name from HarshMell0w []time maximizer[]times pussy stretcher[] to No-Value HarshMell0w [] All the Value [].14:51:40
@github:maunium.netGitHub [tulir/mautrix-telegram] trippup starred the repo 20:18:13
@raggamuffin:raggamuffin.orgXabi joined the room.22:49:28
28 Jul 2021
@dataejaculation:matrix.orgNo-Value HarshMell0w [] Shadowy Super Coder Cumrun [] changed their display name from No-Value HarshMell0w [] All the Value [] to No-Value HarshMell0w [] Shadowy Super Coder [].00:14:51
@greenshark3:matrix.org. changed their display name from Mr.Nobody to ..00:21:41
@dataejaculation:matrix.orgNo-Value HarshMell0w [] Shadowy Super Coder Cumrun [] changed their display name from No-Value HarshMell0w [] Shadowy Super Coder [] to No-Value HarshMell0w [] Shadowy Super Coder Cumrun [].00:28:30
@telegram_1935916287:maunium.netagmalghani joined the room.02:00:25
@grovetato:matrix.orgArnaud joined the room.05:22:31
@grovetato:matrix.orgArnaudRedacted or Malformed Event05:23:30
In reply to @diego:3icn.net
Please let me know if you end up making it work! I'm really eager to use Dendrite, but at the same time I need the mautrix bridges, so it'd be great to figure out what's going on
Hello, any news on this ? Apparently some dendrite users made it work. Anyone in this room ?
The telegrambot won't accept the invitation and nothing helpful shows in the logs
@greenshark3:matrix.org. changed their profile picture.08:29:06
@telegram_1935916287:maunium.netagmalghaniRedacted or Malformed Event08:46:53
@telegram_1935916287:maunium.netagmalghaniRedacted or Malformed Event08:46:53
@github:maunium.netGitHub [tulir/mautrix-telegram] min-kru starred the repo 11:30:23
@github:maunium.netGitHub [tulir/mautrix-telegram] Abestanis opened issue #647: Messages by the bot are unencrypted


Is there support for encrypting the messages of the Telegram bridge bot?


First of all, thank you for this very awesome bridge! I'm currently setting it up for my own matrix server (Synapse 1.38.1). I'm using the currently latest version of the docker container of the bridge (dock.mau.dev/tulir/mautrix-telegram:latest).

The bridging of messages from Telegram to Matrix and the other way works beautifully, I enabled end-to-bridge encryption and the messages I send from Telegram all show up as encrypted in the matrix chat, just as I want them to.

<details> <summary>The encryption settings of the bridge</summary>
# Bridge config
 # Allow encryption, work in group chat rooms with e2ee enabled
 allow: true
 # Default to encryption, force-enable encryption in all portals the bridge creates
 # This will cause the bridge bot to be in private chats for the encryption to work properly.
 default: true
 # Database for the encryption data. Currently only supports Postgres and an in-memory
 # store that's persisted as a pickle.
 # If set to `default`, will use the appservice postgres database
 # or a pickle file if the appservice database is sqlite.
 # Format examples:
 # Pickle: pickle:///filename.pickle
 # Postgres: postgres://username:password@hostname/dbname
 database: default
 # Options for automatic key sharing.
 # Enable key sharing? If enabled, key requests for rooms where users are in will be fulfilled.
 # You must use a client that supports requesting keys from other users to use this feature.
 allow: true
 # Require the requesting device to have a valid cross-signing signature?
 # This doesn't require that the bridge has verified the device, only that the user has verified it.
 # Not yet implemented.
 require_cross_signing: true
 # Require devices to be verified by the bridge?
 # Verification by the bridge is not yet implemented.
 require_verification: true

Unfortunately, the messages send by the Telegram bridge bot are not encrypted. This includes responses from the bot in normal chats, as shown in the image, as well as responses in the direct chat with the bot. They show up with a warning in Element.

Debugging the problem

I did some debugging and tried to work trough the code. I noticed that messages from Telegram go through BasePortal._send_message where they are encrypted. Responses to commands seem to use CommandEvent.reply, EventMethods.send_notice, EventMethods.send_text, EventMethods.send_message and finally EventMethods.send_message_event. I don't see a code path that would encrypt the message. I noticed that there is an overload for send_message_event, EncryptingAPI.send_message_event, but that doesn't seem to be used.


Thank you in advance for your help and again for this awesome bridge. Let me know if you need more info or if this is something that is not supported yet.

@hpd:hpdeifel.dehpd left the room.12:22:48
@dlombard:matrix.org@dlombard:matrix.org joined the room.20:39:37
@dlombard:matrix.org@dlombard:matrix.org left the room.20:40:01

Hello guys, I would like to ask for your help because I've been trying to configure the telegram bridge for several days on my oDroid C2, but without luck.

First of all, I must say that I have set up everything using docker-compose, including the synapse server, which in fact, it's what I'm using right now. Ports are forwarded as I have done with other containers, both containers are also on the same networks, but when I invite telegrambot to a room created in my homeserver, some errors appear in my synapse logs:

synapse.http.client - 449 - INFO - as-recoverer-telegram-4 - Error sending request to  PUT<redacted>: RequestTimedOutError 504: Timeout connecting to remote server

If I configure my telegram bridge config and it's registration file to use the container service name, this is what I get:

synapse.http.client - 449 - INFO - notify_interested_services-7 - Error sending request to  GET http://matrix-telegram-bridge:29317/users/%40telegrambot%3Araggamuffin.org?access_token=<redacted>: ConnectionRefusedError Connection refused,
synapse.appservice.api - 108 - WARNING - notify_interested_services-7 - query_user to http://matrix-telegram-bridge:29317/users/%40telegrambot%3Araggamuffin.org threw exception Connection was refused by other side: 111: Connection refused.,
synapse.http.client - 449 - INFO - as-recoverer-telegram-3 - Error sending request to  PUT http://matrix-telegram-bridge:29317/transactions/1?access_token=<redacted>: ConnectionRefusedError Connection refused

At least using the container service name, I can reach the bridge, but something must be wrong because it's refusing the connection and the container it's up and running. Just in case, I'm going to show you what I get in the logs when I start the bridge container after the setup of config files:

INFO  [alembic.runtime.migration] Context impl PostgresqlImpl.,
INFO  [alembic.runtime.migration] Will assume transactional DDL.,
INFO  [alembic.runtime.migration] Running upgrade  -> 97d2a942bcf8, initial revision,
INFO  [alembic.runtime.migration] Running upgrade 97d2a942bcf8 -> 1b241f7e8530, Add TelegramFile table,
INFO  [alembic.runtime.migration] Running upgrade 1b241f7e8530 -> 7d47d84380b6, Add timestamp to TelegramFile,
INFO  [alembic.runtime.migration] Running upgrade 7d47d84380b6 -> 501dad2868bc, Move sessions to main database,
INFO  [alembic.runtime.migration] Running upgrade 501dad2868bc -> cfc972368e50, Add metadata to TelegramFile,
INFO  [alembic.runtime.migration] Running upgrade cfc972368e50 -> 30eca60587f1, Add megagroup field to portals,
INFO  [alembic.runtime.migration] Running upgrade 30eca60587f1 -> 1fa46383a9d3, Add is_bot field to puppets,
INFO  [alembic.runtime.migration] Running upgrade 1fa46383a9d3 -> eeaf0dae87ce, Add telethon update state table,
INFO  [alembic.runtime.migration] Running upgrade eeaf0dae87ce -> bdadd173ee02, Update telethon update state table,
INFO  [alembic.runtime.migration] Running upgrade bdadd173ee02 -> bcfefa1f1299, Add displayname source fields for puppets,
INFO  [alembic.runtime.migration] Running upgrade bcfefa1f1299 -> 2228d49c383f, Add cascade rules to UserPortal,
INFO  [alembic.runtime.migration] Running upgrade 2228d49c383f -> 6ca3d74d51e4, Move state store to main database,
INFO  [alembic.runtime.migration] Running upgrade 6ca3d74d51e4 -> d5f7b8b4b456, Add access_token and custom_mxid fields for puppets,
INFO  [alembic.runtime.migration] Running upgrade d5f7b8b4b456 -> b54929c22c86, Add portal-specific config,
INFO  [alembic.runtime.migration] Running upgrade b54929c22c86 -> a9119be92164, Add phone number field to users,
INFO  [alembic.runtime.migration] Running upgrade a9119be92164 -> 17574c57f3f8, Add disable_updates field for puppets,
INFO  [alembic.runtime.migration] Running upgrade 17574c57f3f8 -> 9e9c89b0b877, Add edit index to messages,
INFO  [alembic.runtime.migration] Running upgrade 9e9c89b0b877 -> 4f7d7ed5792a, Switch mx_user_profile to native enum,
INFO  [alembic.runtime.migration] Running upgrade 4f7d7ed5792a -> a7c04a56041b, Store custom puppet next_batch in database,
INFO  [alembic.runtime.migration] Running upgrade a7c04a56041b -> 24f31fc8a72b, Add encrypted field for portals,
INFO  [alembic.runtime.migration] Running upgrade 24f31fc8a72b -> d3c922a6acd2, Add decryption info field for reuploaded telegram files,
INFO  [alembic.runtime.migration] Running upgrade d3c922a6acd2 -> dff56c93da8d, Add matrix-nio state store to main db,
INFO  [alembic.runtime.migration] Running upgrade dff56c93da8d -> 3e3745baa458, Store Matrix avatar URL in database,
INFO  [alembic.runtime.migration] Running upgrade 3e3745baa458 -> ccbaff858240, Switch to mautrix-python crypto,
INFO  [alembic.runtime.migration] Running upgrade ccbaff858240 -> a328bf4f0932, Store encryption state event in db,
INFO  [alembic.runtime.migration] Running upgrade a328bf4f0932 -> 888275d58e57, Add double puppet base URL to puppet table,
INFO  [alembic.runtime.migration] Running upgrade 888275d58e57 -> 7de69cf5809e, Add Matrix redaction state to message table,
INFO  [alembic.runtime.migration] Running upgrade 7de69cf5809e -> 990f4395afc6, Store displayname contact status in puppet table,
INFO  [alembic.runtime.migration] Running upgrade 990f4395afc6 -> ec1d3dcc77e9, Switch Telegram IDs to bigints,
INFO  [alembic.runtime.migration] Running upgrade ec1d3dcc77e9 -> bfc0a39bfe02, Store displayname quality in puppet table,
INFO  [alembic.runtime.migration] Context impl PostgresqlImpl.,
INFO  [alembic.runtime.migration] Will assume transactional DDL.,
INFO  [alembic.runtime.migration] Context impl PostgresqlImpl.,
INFO  [alembic.runtime.migration] Will assume transactional DDL.

The last repeated messages, are being output to the logs every fifteen seconds more or less, but nothing else appears, I think it enters a loop.

Then, if I make a telnet request to my machine, this is what I get:

telnet: Unable to connect to remote host: Connection refused

When I repeat the telnet request, but this time to, this is the output:

Connected to
Escape character is '^]'.
Connection closed by foreign host.

Well, just for making things easier (I hope), I will provide my registration file:

id: telegram
as_token: <redacted>
hs_token: <redacted>
sender_localpart: <redacted>
rate_limited: false
  - exclusive: true
    regex: '@telegram_.+:raggamuffin.org'
  - exclusive: true
    regex: '@telegrambot:raggamuffin\.org'
  - exclusive: true
    regex: '#telegram_.+:raggamuffin.org'

At this point, I'm completely lost and any help would be very welcomed because I'm really looking fordward to start using matrix as my main and only IM, thank you in advance 🙂


There are no newer messages yet.

Back to Room List