Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| matrix:telegram [2025/03/12 07:23] – [Bridge Setup] willy | matrix:telegram [2026/04/12 16:16] (current) – willy | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== Matrix Telegram Bridge ===== | + | ====== |
| [[https:// | [[https:// | ||
| - | Telegram can be easily and fully bridged with Matrix using the Mautrix-Telegram bridge [[https:// | + | Telegram can be easily and fully bridged with Matrix using the Mautrix-Telegram bridge [[https:// |
| - | At the time of writing this page, a full rewrite in Go of the bridge is undergoing but not yet officially released, so i will show you how to install | + | At the time of writing this page, the full rewrite in Go of the bridge is the way to go and the older python-based bridge |
| Line 12: | Line 12: | ||
| I asusme you are installing the bridge directly together with the Matrix server, as user // | I asusme you are installing the bridge directly together with the Matrix server, as user // | ||
| - | Create a subfolder | + | Create a subfolder to install the bridge: |
| <code bash> | <code bash> | ||
| su - conduwuit | su - conduwuit | ||
| mkdir mautrix-telegram | mkdir mautrix-telegram | ||
| cd mautrix-telegram | cd mautrix-telegram | ||
| - | # Enable PIP like described in the link above: | + | wget -O mautrix-telegram.zip ' |
| - | # - create ~/.config/pip/pip.conf | + | unzip mautrix-telegram.zip |
| - | # - add ~/.local/bin to the .bashrc | + | chmod +x mautrix-telegram |
| - | python | + | |
| - | source ./bin/activate | + | |
| - | # Now set " | + | |
| - | # Install: | + | |
| - | pip install --upgrade | + | |
| </ | </ | ||
| - | Please follow the instructions to enable PIP venvs as described in the link above. | ||
| - | |||
| - | This will install the bridge itself. | ||
| Line 40: | Line 32: | ||
| - | ===== Bridge | + | ===== Bridge |
| - | Unfortunately, | + | Let the bridge generate the basic configuration file, and move it to the /data/conduwuit folder: |
| <code bash> | <code bash> | ||
| - | cd / | + | ./ |
| - | wget -O / | + | mv config.yaml /data/conduwuit/mautrix-telegram-config.yaml |
| </ | </ | ||
| - | For an organizational reason, i prefer to keep all the stuff that needs to be backupped into / | + | Now edit it. You should take a good look at it, the following are only hints and pointers |
| - | + | < | |
| - | This file is huge, here are the most relevant changes needed: | + | network: |
| - | <file - config.yaml> | + | # This is very important to have usernames instead of phone numbers! |
| - | appservice: | + | |
| - | | + | |
| + | database: | ||
| + | | ||
| + | uri: file:/data/conduwuit/ | ||
| + | |||
| + | homeserver: | ||
| address: https:// | address: https:// | ||
| domain: chat.mydomain.com | domain: chat.mydomain.com | ||
| - | verify_ssl: true | + | |
| - | | + | appservice: |
| - | telegram: | + | |
| - | | + | |
| - | api_id: << put your id here >> | + | |
| - | api_hash: << put your hash >> | + | |
| - | # (Optional) Create your own bot at https://t.me/ | + | |
| - | bot_token: disabled | + | |
| - | permissions: | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| | | ||
| - | | + | permissions: |
| + | " | ||
| + | " | ||
| + | " | ||
| + | |||
| + | backfill: | ||
| + | enabled: true # to populate chats with older messages | ||
| + | |||
| + | | ||
| # Whether to enable encryption at all. If false, the bridge will not function in encrypted rooms. | # Whether to enable encryption at all. If false, the bridge will not function in encrypted rooms. | ||
| allow: true | allow: true | ||
| - | double_puppet_server_map: | + | double_puppet: |
| - | example.com: https://chat.gardiol.org | + | # Servers to always allow double puppeting from. |
| - | | + | # This is only for other servers and should NOT contain the server the bridge is on. |
| - | | + | servers: |
| - | chat.gardiol.org: << here the double | + | |
| - | + | # Whether to allow client API URL discovery for other servers. When using this option, | |
| + | # users on other servers can use double puppeting even if their server URLs aren' | ||
| + | # explicitly added to the servers map above. | ||
| + | allow_discovery: false | ||
| + | # Shared secrets for automatic double puppeting. | ||
| + | # See https:// | ||
| + | | ||
| + | | ||
| + | |||
| logging: | logging: | ||
| - | handlers: | + | |
| - | file: | + | </code> |
| - | | + | |
| - | </file> | + | Note that backfill is disabled by default, you need to enable it to see older messages. Also note that messages **cannot** be backfilled for already created rooms, so don't forget to enable backfill before the first start! |
| - | More details on configuration can be found [[https:// | + | Since my server will have just a few users, i decided to use an SQLite database. |
| - | I choose to use SQLite as database because i only have a few users and don't want to spin a PostreSQL instance for that. | ||
| ===== Bridge Registration ===== | ===== Bridge Registration ===== | ||
| Line 96: | Line 98: | ||
| First of all, generate the // | First of all, generate the // | ||
| <code bash> | <code bash> | ||
| - | python | + | ./mautrix-telegram |
| </ | </ | ||
| Line 102: | Line 104: | ||
| - | ===== Usage ===== | + | ===== Usage ===== |
| - | You need to create the **telegrambot** user, again from the admin chat. this step could be skipped if the user has been already | + | The **whatsappbot** user should have been created |
| - | + | ||
| - | In case the user is missing, from the Matrix server admin chat type: | + | |
| - | < | + | |
| - | !admin users create-user telegrambot | + | |
| - | </ | + | |
| Good! Now you can run the bridge: | Good! Now you can run the bridge: | ||
| <code bash> | <code bash> | ||
| - | python | + | / |
| </ | </ | ||
| Line 120: | Line 117: | ||
| ===== Login ===== | ===== Login ===== | ||
| - | |||
| To login into telegram you need to: | To login into telegram you need to: | ||
| * Start a chat with // | * Start a chat with // | ||
| Line 144: | Line 140: | ||
| name=" | name=" | ||
| - | description=" | + | description=" |
| pidfile="/ | pidfile="/ | ||
| command_background=true | command_background=true | ||
| - | command="/ | + | command="/ |
| - | command_args=" | + | command_args="/ |
| command_user=" | command_user=" | ||
| output_log="/ | output_log="/ | ||
| Line 167: | Line 163: | ||
| rc-update add conduwuit-telegram default | rc-update add conduwuit-telegram default | ||
| </ | </ | ||
| + | |||
| + | |||
| + | |||
| + | |||