Telegram store bot (own products only)
Arabic and English buttons. Products: freelancer and shop/clinic Excel kits, resume kit, paid audit, Topmate sessions. Nothing here sells accounts or anyone else's catalog.
Flow
start -> language -> menu (Products, My orders, Support, Refund, Language)
Products -> category -> product page -> Order -> payment method -> pay instructions -> "I paid" + proof
Proof goes to the admin with Approve / Reject. Approve sends the file or link to the buyer. Admin replies to a forwarded support message and the bot relays it to the user. Refund: policy text plus "request refund" on a paid order, sent to the admin.
Before it can sell (owner decisions, nothing is invented)
- products.json: set
priceandcurrency, anddelivery.urlordelivery.file_idper product. Price null = the bot shows "price not set" and sends the buyer to support. - config.json: turn on payment methods and write the real instructions; write the refund policy (ar and en). Empty policy = bot says it is not set.
- Topmate / audit: set
booking_urlor leave to support.
Run
python -m venv .venv && . .venv/bin/activate && pip install -r requirements.txt
export BOT_TOKEN=... # from @BotFather, set on the server only
export ADMIN_IDS=123456 # your Telegram numeric id (ask @userinfobot)
python bot.py
Test without a token: python test_flow.py (fake Telegram API, 127 calls, checks every page in both languages, payment, approval, delivery, refund).
Deploy
- Docker:
docker build -t store-bot . && docker run -d --restart=always --env-file .env -v storebot:/data store-bot(polling, no open port needed). Works on any small VPS, Railway or Fly.io worker. - systemd alternative: ExecStart=/path/.venv/bin/python /path/bot.py with EnvironmentFile=/path/.env, Restart=always.
- Keep BOT_TOKEN only in the host's env or secret store. Rotate it at @Botfather if it ever appears in a chat.
- Back up store.db (orders).
Notes
- File delivery: send the file to the bot once from the admin account, read the file_id from the update, put it in
delivery.file_id. Links work withdelivery.url. - Payments are manual (proof then approve). No payment API is wired, so no money moves through code.