A simple Telegram bot for user support with a web interface to view and send messages.
This project implements a Telegram bot that receives messages from users and allows support agents to reply via a web interface.
- Messages are stored in a TinyDB database.
- FastAPI is used for both the API and the web interface.
- The web interface displays the list of users, message history, and allows sending replies.
- Asynchronous operations are used for Telegram API communication and database access.
Related Project:
For a standalone executable (.exe) version of a Telegram support client with a desktop interface built with Tauri and Node.js, see telegram-support-client.
- Python 3.8+
- FastAPI
- Uvicorn
- httpx
- tinydb
- Start the local server:
uvicorn main:app --reload --host 0.0.0.0 --port 8000
- Start ngrok to expose your local server:
ngrok http 8000
- Set the Telegram webhook, replacing
<TOKEN>
and<NGROK_URL>
:
curl -X GET "https://api.telegram.org/bot<TOKEN>/setWebhook?url=https://<NGROK_URL>/webhook"
- Open the web interface:
http://localhost:8000/
- The web interface lets you select a user from the list and view the message history.
- Support agents can send replies, which will be delivered to users via Telegram.
- All messages are saved in the TinyDB database
chat_db.json
.
TELEGRAM_BOT_TOKEN
β your Telegram bot token.
βββ main.py # Main FastAPI application file
βββ chat_db.json # TinyDB database (created automatically)
βββ static/ # Static files for the web interface (HTML, CSS, JS)
βββ README.md # This description
MIT License