Telegram Lead Agent: From Noisy Channels to Qualified Leads
System Architecture //
1. Project Overview
MelonRing Lead Agent is a production Telegram lead-discovery product for businesses, freelancers, and agencies that want to find buying intent without manually watching dozens of channels and groups
The product turns a noisy Telegram surface into a structured lead pipeline: users describe their business and audience, connect a Telegram account, select sources, and receive qualified opportunities with context, analysis, and a suggested response
2. The Problem
Useful commercial intent is scattered across Telegram conversations, easy to miss, and expensive to monitor manually. Keyword search alone creates noise, misses context, and cannot reliably separate a real opportunity from a casual question or spam
The system also had to support multiple tenants with different industries, keywords, stop words, source channels, subscription plans, and Telegram sessions without mixing their data or processing the same message repeatedly
3. What I Built
Guided onboarding inside Telegram
The bot collects the business profile, industry, offer, target audience, phone verification, and source channels. A target audience can be provided as text or a file, and incomplete onboarding can be resumed from the right step
Multi-tenant monitoring architecture
Each tenant has an isolated configuration and Telegram session routed through a dedicated proxy. The monitor listens to configured sources and sends messages into a Redis-backed queue, while PostgreSQL stores tenants, channels, subscriptions, leads, feedback, and action history
Two-level qualification pipeline
The first pass uses fast regex and stemming rules to filter obvious matches and stop words. Promising messages move to an AI qualification layer that scores quality, explains the reasoning, and produces structured context for the operator. Junk filtering, buffering, deduplication, and tenant-specific rejection history keep the pipeline usable
Lead delivery and operator control
Qualified leads arrive as structured cards with source context and a recommended next action. Operators can send, reject, or apply a custom action, and those decisions are recorded in an audit trail. Negative examples feed the filtering logic instead of disappearing into an inbox
Admin and subscription layer
The product includes an admin panel for lead review, channel statistics, tenant management, subscriptions, and operational visibility. Bot onboarding, plan limits, payment handling, expiry reminders, and support flows are connected to the same tenant model
4. Result
The result is a working lead-discovery system rather than another notification bot. Continuous Telegram monitoring became a repeatable process with explicit qualification stages, explainable decisions, tenant isolation, and a feedback loop for improving relevance
The architecture leaves room for additional AI providers, source types, subscription plans, and industry-specific qualification logic without rewriting the core monitoring and delivery flow
5. System Architecture
Telegram Bot API, Telethon, Python, PostgreSQL, Redis, Next.js, Docker, OpenAI/Gemini-compatible AI providers, multi-tenant access control, and proxy-isolated sessions