This tool monitors specified Telegram channels for messages that contain certain keywords and forwards them to a private channel. It's built using Python and Telethon, a Telegram client library.
## Features
- Monitors multiple channels.
- Searches for messages with specified keywords.
- Forwards matching messages to a private channel.
## Prerequisites
Before you can use this tool, you need to set up a few things:
The project now ships with a FastAPI backend (`backend/`) and a Vue 3 dashboard (`frontend/`) so you can update credentials, manage keywords/channels, and watch matches in real time.
### Authentication
- All API routes (except `/api/auth/token`) are protected with JWT. The default credentials are `admin / admin123` and are stored in `users.json`.
- After the first login, use the UI “change password” endpoint (or call `POST /api/auth/change-password`) to update the password. The JWT expires after 60 minutes.
- Include the bearer token in the `Authorization` header for REST calls; the frontend handles this automatically after you log in from the new login page.
### Backend
```
cd backend
python -m venv .venv
.venv\Scripts\activate
pip install -r ../requirements.txt
uvicorn app.main:app --reload
```
The API is exposed on `http://localhost:8000/api`. Important endpoints:
Set `VITE_API_BASE` in a `.env` file if your backend is not running on `http://localhost:8000/api`. Once the dev server starts, visit `http://localhost:5173/login`, log in with the admin user, and the dashboard will become available.
### Production Notes
- FastAPI already enables permissive CORS for local development; tighten it for production.
- Ensure `credentials.json`, `keywords.txt`, `channels.txt`, and `users.json` are stored securely; the API reads/writes the same files as the CLI script.
- The Telethon scanner still forwards matching messages to the configured Telegram channel while also streaming match metadata to the dashboard.