One-way firehose from Mattermost to a single Telegram chat.
Logs into Mattermost as a regular user (or personal access token) and forwards every event that account can see — public channels, private channels, direct messages, group DMs — to one Telegram chat. Read-only: there is no reply path.
go build -o mm2tg ./cmd/mm2tgcp .env.example .env
# edit .env
set -a; . ./.env; set +a
./mm2tgdocker build -t mm2tg .
docker run --rm --env-file .env mm2tgOr via compose:
docker compose up -d| Variable | Required | Notes |
|---|---|---|
MM_SERVER |
yes | host only, e.g. chat.example.com |
MM_TEAM |
yes | team URL slug |
MM_LOGIN |
yes | username or email |
MM_PASS |
yes | password or personal access token |
MM_MFA |
no | MFA token if enabled |
MM_LOGLEVEL |
no | debug / info / warn (default info) |
TG_TOKEN |
yes | Telegram bot token from @BotFather |
TG_CHAT_ID |
yes | target chat id; negative for groups/channels |
- The Mattermost account must be a member of the channels/DMs you want to see. Use a dedicated user account added to everything relevant.
- A true bot account cannot receive DMs from humans unless DMs-to-bots are enabled in System Console → Bot Accounts.
- Getting
TG_CHAT_ID:- Private DM (bot sends only to you): open
@userinfobotin Telegram and press Start — it replies with your numeric user id (a positive number, e.g.165089403). Use that asTG_CHAT_ID. You must also send/start(or any message) to your own bot once, otherwise it cannot initiate the DM. - Group chat (bot posts into a shared group): add your bot to
the group, then also add
@RawDataBot(or@myidbot). It posts the group's chat id, which starts with-(e.g.-1001234567890for supergroups). Remove the helper bot afterwards. Your own bot must stay in the group to post. - Channel (bot broadcasts into a Telegram channel): add your
bot to the channel as an admin with post permissions. Forward
any message from the channel to
@RawDataBotto get its id (also starts with-100…).
- Private DM (bot sends only to you): open
- Messages are split at 3900 chars (Telegram's limit is 4096).
- Notifications are muted (
disable_notification=true).