Skip to content

ruchkadev/telegram-support-chat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Telegram Support Chat Bot

A simple Telegram bot for user support with a web interface to view and send messages.

πŸš€ Description

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.

🧩 Requirements

  • Python 3.8+
  • FastAPI
  • Uvicorn
  • httpx
  • tinydb

πŸ“¦ Running

  1. Start the local server:
uvicorn main:app --reload --host 0.0.0.0 --port 8000
  1. Start ngrok to expose your local server:
ngrok http 8000
  1. Set the Telegram webhook, replacing <TOKEN> and <NGROK_URL>:
curl -X GET "https://api.telegram.org/bot<TOKEN>/setWebhook?url=https://<NGROK_URL>/webhook"
  1. Open the web interface:
http://localhost:8000/

πŸ› οΈ Usage

  • 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.

πŸ”‘ Environment Variables

  • TELEGRAM_BOT_TOKEN β€” your Telegram bot token.

πŸ—‚ Project Structure

β”œβ”€β”€ 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

πŸ“„ License

MIT License

About

Telegram bot for user support with a FastAPI web interface to manage chats and send replies.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published