A self-hosted Flask-based proxy for caching Telegram messages. This application collects and processes messages from Telegram channels, providing cached access and basic analytics.
- Real-time message collection from Telegram channels
- Local caching of messages for fast access
- Message categorization by dialog types (private chats, groups, channels, etc.)
- Message tagging and filtering
- Live updates via automatic page refresh
- Dialog type detection and statistics
-
Clone this repository
-
Set up the following secrets in your Replit environment:
TELEGRAM_API_ID=your_api_id
TELEGRAM_API_HASH=your_api_hash
SESSION_SECRET=your_session_secret
-
Get your Telegram API credentials:
- Visit https://my.telegram.org/auth
- Go to 'API development tools'
- Create a new application
- Copy the
api_idandapi_hash
-
Hit the "Run" button on Replit!
- Python 3.11+
- SQLite or PostgreSQL database
- Telegram API credentials
- Clone the repository:
git clone https://github.com/yourusername/telegram-cache-proxy.git
cd telegram-cache-proxy- Install dependencies:
pip install -r requirements.txt- Set up environment variables:
export TELEGRAM_API_ID=your_api_id
export TELEGRAM_API_HASH=your_api_hash
export SESSION_SECRET=your_session_secret
export DATABASE_URL=postgresql://user:password@localhost/dbname- Run in production mode:
gunicorn -w 4 -b 0.0.0.0:5000 main:app --timeout 120 --keep-alive 5 --log-level info├── api/ # API routes and authentication
├── templates/ # HTML templates
├── main.py # Main application file
├── models.py # Database models
├── collector.py # Message collection logic
└── requirements.txt # Project dependencies