Overview
A support bot where users write in a private chat and managers reply from a separate work chat. The bot stores history, supports photos and documents, and sends the reply to the user anonymously on behalf of support.
Architecture
- Python + python-telegram-bot (async mode).
- PostgreSQL with a connection pool (psycopg2.pool).
- Tables: users, messages, active_replies.
- File and console logging for audit and diagnostics.
Key Functionality
- Message routing: text, photos and documents are forwarded to the manager chat automatically.
- Inline buttons for managers: "Reply to user" and "Message history".
- Active reply state: a manager answers a specific dialog, then the state is cleared.
- Anonymous replies: the user gets a message from support without the manager identity.
- History and reports: conversation storage and delivery reports.
- Manager commands: cancel current reply and usage instructions.
- Error handling: blocked bot, unreachable chat, fallback behaviour.
Result
Support gained a single managed communication channel, transparent request history and a faster response cycle for clients.
Note: configuration secrets (tokens, passwords, private identifiers) are hidden and not published.