Telegram Contact Relay
A self-hosted contact relay that brings Telegram conversations, website inquiries, and incoming email into a unified Telegram forum inbox.
What it does
Contact Relay brings Telegram conversations, website inquiries and incoming email into a private administrative forum. It provides feedback infrastructure for independent developers, small projects and websites: one installation can serve isolated instances with their own bots, settings and SQLite state.
- Telegram private chat↔
- Website form→
- IMAP mailbox→
- ↔Dialog topic
- →Website topic
- →Email topic
Telegram conversations are two-way. Website inquiries and email arrive in the administrative forum; reply through the supplied contact or a mail client. The service does not send SMTP replies.
Channels and capabilities
- Telegram: a topic per dialog, operator replies to the private chat, persistent Reply routes and native albums.
- Website: HTTP API, a free-text reply contact, rate limits, Turnstile and configurable consent validation.
- Email: verified-TLS IMAP and bounded image, PDF, Office and text attachments. Reply manually from a mail client; SMTP is not implemented.
- Ten interface languages, custom YAML, explicit profile synchronization and contextual /help, /ping and /health commands.
- User and operator acknowledgements with optional deletion, persistent error notices and distinct uncertain/partial outcomes.
- Worker progress checks, readiness/liveness, systemd watchdog and failure notices. Auxiliary acknowledgements cannot mask stalled polling.
Installation
Use Python 3.12 or 3.13 and your own bot with an administrative forum. After cloning the selected version, create an environment, copy the examples and fill .env and configuration. Test extras are not required at runtime. Linux/systemd is the documented watchdog deployment.
python3.12 -m venv .venv
. .venv/bin/activate
python -m pip install .
cp examples/config.example.yaml config.yaml
cp examples/.env.example .env
chmod 600 .env
cp -r examples/locales locales
tg-contact-relay --config config.yaml --check-configDelivery and storage limits
Exactly-once cannot be promised across arbitrary network failures. Uncertain sends and incomplete albums need manual reconciliation; the relay does not replay them automatically or guess routes. SQLite stores service state, while conversation contents remain with Telegram and the mail provider. File-format checks do not replace antivirus.
Deployment checks
Before putting an instance into service, check the bot’s forum permissions and test delivery in both directions. The web form also needs checks of its HTTP API and Turnstile configuration.
Recommended version
The v0.1.1 release is qualified on Python 3.12/3.13, including clean wheel/sdist installs. Catalog maturity remains beta; check provider permissions and instance settings before use.
git clone --branch 'v0.1.1' --single-branch https://github.com/LimiNode/tg-contact-relay.gitCollaboration
Get in touch to discuss using or extending this project, or working on related research.
Discuss a project