Running project · Telegram → MAX
re-publisher
I collect new messages from the MAX folder in Telegram. On the server, each post goes through classification, filters and source attribution. Matching posts go to MAX channels with their original text and attachments. The working interface shows model scores, OCR, labels, errors and delivery history.
Overview: stages, service heartbeats, model queues and media errors. Production capture, 3 October 2026.
01 / The task
Telegram posts to topic channels in MAX
I wanted to sort a stream from multiple channels without copying every post by hand. I built a pipeline that shows why a post matched, what OCR read and where it was sent.
Use case: My workspace for topic feeds. MAX channels are public; the administrative interface requires a password.
Work done
- New-message collection with Telethon; storage of originals, attachments and processing states.
- Corpus annotation with Codex, local TF-IDF and MiniLM training, model versions and run history.
- Filter builder, label dictionary and separate text/OCR scores.
- MAX sender, delivery verification, queue, retries, migrations and deployment.
02 / Implementation
What sets the implementation apart
The original is not rewritten. Post text and text on media are classified separately. A filter checks model scores and assigns a plain label from my dictionary. A post can go to several channels. Saved message IDs and attempt history help investigate delivery errors.
Screenshots
Screens, forms, errorsScreenshots, diagrams and source evidence retain their original language; captions and descriptions are translated.
03 / Technology
Stack
Shares use Git application-file bytes at pinned revisions. Each file belongs to one subsystem under scripts/generate-stack-share.mjs rules; tests, assets, dependencies and generated files are excluded. Rounded to 0.1%. This describes code composition, not proficiency.
Python / Telethon
Collection from the user’s MAX folder in Telegram
FastAPI / Jinja / JavaScript
Working interface, protected APIs and board refresh
PostgreSQL / SQLAlchemy / Alembic
Originals, jobs, filter versions, labels, OCR and deliveries
TF-IDF / scikit-learn
Default automatic classification
MiniLM / PyTorch
Local training and manual comparison on the server
RapidOCR / ONNX Runtime
Reading text on media in a separate worker
MAX Bot API / httpx
Attachment upload, sending and message verification
04 / Decisions
How the project works
- A new_only collector receives new messages. The old unprocessed buffer is not processed automatically.
- Separate processes: web, collector, coordinator, TF-IDF, MiniLM, OCR and the MAX sender. Queues and results are stored in PostgreSQL.
- RapidOCR reads images and static video previews. OCR text is not appended to a publication.
- A missing score stays unknown. Filters support categories, subcategories, model features, length and nested AND / OR / NOT.
- The original post is sent with media and a Source link. There is no additional extracted-links block.
05 / Verification
Demo workflows
- Open the public MAX channels and an example repost.
- With owner access, open the board: Received → Sorted → Filtered → Source attribution → Ready.
- Open a card and select post text or OCR as the result input. Compare saved runs.
- Open a filter and inspect its model, conditions, label and matching preview evidence.
- In MAX history, inspect the destination, delivery state, saved link and errors.
Check results
- Nine MAX channels are connected. The initial batch contains 180 publications, 20 per channel. Sending of new matching posts is enabled.
- The captured history includes later deliveries. The publication count changes as new messages arrive.
Limitations
- Corpus labels were assigned by Codex. Model measurements describe agreement with those labels, not independent human accuracy.
- The beginner and humor routes are experimental. Beginners: 57/65 test matches; OCR humor: 92/104 validation matches. The agreed quality gates were not passed.
- OCR does not understand an image without text, listen to audio or inspect the whole video. Reading errors need review.
- Media over 100 MB and unavailable album parts block automatic readiness. The interface contains stopped cards.
- Screenshot counters and timings are a state snapshot, not a performance guarantee.
Technical notes
Modules, API, data model, setup and check results.
Documentation →Materials ↓