Lightweight binary Matrix appservice that reposts messages from a Matrix room to a Telegram channel using Telegram Bot API. Perfect for announcements read-only Matrix rooms.
  • TypeScript 96.3%
  • JavaScript 3.7%
Find a file
2026-05-04 01:23:29 +02:00
.vscode Initial commit 2026-04-29 21:56:18 +02:00
src Add media buffering for groups and auto join rooms 2026-05-04 01:21:58 +02:00
.env.example Add media buffering for groups and auto join rooms 2026-05-04 01:21:58 +02:00
.gitignore Add media buffering for groups and auto join rooms 2026-05-04 01:21:58 +02:00
.prettierrc Initial commit 2026-04-29 21:56:18 +02:00
bun.lock Initial commit 2026-04-29 21:56:18 +02:00
eslint.config.js Initial commit 2026-04-29 21:56:18 +02:00
LICENSE Initial commit 2026-04-29 21:56:18 +02:00
package.json Bump version 2026-05-04 01:23:29 +02:00
README.md Add media buffering for groups and auto join rooms 2026-05-04 01:21:58 +02:00
tsconfig.json Initial commit 2026-04-29 21:56:18 +02:00

M2TG

Lightweight binary Matrix appservice that reposts messages from a Matrix room to a Telegram channel using Telegram Bot API. Perfect for announcements read-only Matrix rooms.

Registration file:

id: m2tg
url: http://localhost:PORT
as_token: APP_SERVICE_TOKEN
hs_token: HOMESERVER_TOKEN
sender_localpart: m2tg
namespaces:
  users:
    - exclusive: false
      regex: "@.*:.*"
  aliases: []
  rooms: []
rate_limited: false

Environment variables:

# Full url
HOMESERVER_URL=""
# Not alias, internal room id
ROOM_ID=""
# Port for M2tg to work on
PORT=""

# Any random 64+ character strings
APP_SERVICE_TOKEN=""
HOMESERVER_TOKEN=""

# @botfather
TELEGRAM_CHAT_ID=""
TELEGRAM_BOT_TOKEN=""

Usage

Download a binary or build yourself.

Build

Bun is required.

  1. Clone repository
  2. Install dependencies: bun ci
  • To run a dev server: bun src/index.ts
  • To build a binary for your platform: bun run build
  • To build all binaries for all platforms: bun run crossbuild

Medias sent together in a short time window (less than 5 seconds apart) are grouped and sent in a single gallery message to Telegram.

License

MIT

Donate

hloth.dev/donate