How it works Features Commands Setup GitHub ↗ Deploy now
Open source · MIT python-telegram-bot 20.8

A helpdesk inbox,
inside Telegram.

Every user who messages your bot gets a dedicated Forum Topic in your admin group. Two-way relay, full media support, admin commands — deployed in minutes.

Open source · MIT
Zero-config webhook setup
Deploys on Render free tier
No polling, production-ready
Step 1
Tooltip text...
Support Inbox — Forum Topics live
📬 John_doe
💬 alice_123
💬 bob_xyz
3 open tickets
Thinking
1# New session — John_doe (Chat ID: 8831294) 2 3user → "Hello, my payment isn't going through." 4 5admin → "Hi John! Could you share the error screenshot?" 6 7user → [📎 payment-error.png forwarded ✓] 8 9/close — ticket resolved, user notified ✓
Forwarding Reading Replying Done
↺ restarting…
Live relay
Hello, my payment isn't going through.
Hi John! Could you share the error screenshot?
📎 payment-error.png
✅ Ticket resolved. Thank you!
ThinkingProcessing…
ForwardRelayed to topic
Done👍 delivered

Three roles, one clean loop.

01
💬

User sends a message

Any Telegram user messages the bot privately. All media types are supported — text, photos, videos, files, voice, audio, stickers, GIFs, video circles, location, and contacts.

02
📂

Bot creates a Forum Topic

On first contact, the bot creates a dedicated Forum Topic in your private admin group named after the user. Every subsequent message threads into that topic automatically.

03
↩️

Admin replies, user receives

Any admin replies inside the forum topic are forwarded back to the user's private DM in real time. Use /close to resolve and archive the ticket.


Everything your support team needs.

📁

Full media support

Text, photos, videos, documents, voice messages, audio, stickers, GIFs, video circles, location pins, and contacts — all relayed bidirectionally.

🎫

Ticket lifecycle

Sessions open on /start, can be closed with /close, and reopen automatically when a user contacts the bot again after resolution.

🚫

Ban & unban users

Block spamming or abusive users directly from within their support topic using /ban. Lift restrictions instantly with /unban.

📢

Broadcast announcements

Send a message to all active, non-banned users at once using /broadcast — perfect for outage notifications or product updates.

📊

Stats dashboard

Check total sessions, active tickets, banned users, and today's message activity at any time with /stats via private DM.

⚡

Rate limiting

Per-user message throttling prevents flooding. Configure the message limit and time window via environment variables.

👍

Delivery receipts

The bot reacts to each user message with a thumbs-up emoji the moment it's forwarded — a subtle, non-intrusive confirmation.

🗃️

SQLite persistence

All sessions, ban states, and timestamps are stored in a lightweight SQLite database. No external DB required.

🚀

Webhook-based, Gunicorn-ready

No polling. PTB runs on a dedicated asyncio thread inside Gunicorn, with a /health endpoint for uptime monitors.


Every command, where it works.

👤  User — private DM with bot

/start Start a new support session, or resume an existing one
/help Show available commands and usage instructions

🛡️  Admin — inside a group forum topic

/close Resolve the ticket, notify the user, and archive the topic
/ban Ban the user and close their support session
/unban Lift the ban — user is notified and can open a new session

🔑  Admin — private DM with bot

/stats Show session counts, active tickets, and daily activity
/broadcast <msg> Send an announcement to all non-banned users at once

Deployed in five steps.

1

Create your bot

Message @BotFather on Telegram, send /newbot, and copy the API token it gives you.

2

Set up a Forum group

Create a private Telegram group, enable Topics in settings, and add your bot as an admin with the Manage Topics permission.

3

Get your IDs

Forward a message from your group to @userinfobot to get the Group ID. DM it directly to get your personal User ID.

4

Deploy to Render

Fork the repo, create a new Web Service on Render, set gunicorn main:flask_app as the start command, and add the environment variables.

5

Send /start

Message your bot on Telegram. A Forum Topic is created instantly in your group. You're live.

Environment variables

Variable Req Default
TELEGRAM_BOT_TOKEN —
TELEGRAM_GROUP_ID —
TELEGRAM_ADMINS —
WEBSITE_URL —
PORT 8443
DB_PATH bot_data.db
RATE_LIMIT_MAX 5
RATE_LIMIT_WINDOW 10
 Required  Optional
# Clone & run locally
git clone github.com/Artemis43/telegram-support-bot
cd telegram-support-bot

cp .env.example .env
# edit .env with your values

pip install -r requirements.txt
python main.py

Start supporting your users
the right way.

Open source, MIT licensed. Deploy to Render in under five minutes.