A long-polling Telegram bot that lets you create Cloudflare CNAME records from Telegram — no more opening the heavy Cloudflare dashboard on prepaid mobile data.
- 🎯 Interactive flow — inline buttons list every domain in your Cloudflare account
- 🔒 Locked to you — only whitelisted Telegram chat IDs can use it
- 💸 Data-cheap — a full DNS change uses < 1 KB vs 2–5 MB on the web UI
- 🩺 Self keep-alive — ships a
/healthendpoint for Render + UptimeRobot - 🧩 Zero cost — Render free tier + UptimeRobot free tier
You: /cname
Bot: 📝 Step 1/3 — Send the subdomain name. Example: ximanta
You: ximanta
Bot: 🌐 Step 2/3 — Pick the full domain for ximanta:
[ ximanta.ximanta.xyz ]
[ ximanta.ximanta.space ]
[ ximanta.dev-ximanta.site ]
[ ximanta.kaziranga.site ]
[ ❌ Cancel ]
You: (taps ximanta.ximanta.xyz)
Bot: 🎯 Step 3/3 — Selected: ximanta.ximanta.xyz
Now send the target hostname. Example: realximanta.github.io
You: realximanta.github.io
Bot: ✅ DNS record created successfully!
• Domain: ximanta.ximanta.xyz
• Type: CNAME
• Target: realximanta.github.io
• Proxied: Yes
• TTL: Auto
- Click the Fork button at the top-right of github.com/realximanta/cf-telegram-bot.
- On your fork, click Code → HTTPS and copy the URL.
- Continue to Clone & run.
# HTTPS
git clone https://github.com/realximanta/cf-telegram-bot.git
# SSH (if you have SSH keys configured)
git clone git@github.com:realximanta/cf-telegram-bot.git
# GitHub CLI
gh repo clone realximanta/cf-telegram-bot
# Clone into a specific folder
git clone https://github.com/realximanta/cf-telegram-bot.git my-dns-bot
cd my-dns-botThen:
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -r requirements.txt
cp .env.example .env # fill in your secrets
python bot.py- Message @BotFather →
/newbot→ copy the token. - Message @userinfobot → copy your numeric ID.
- Go to Cloudflare API Tokens.
- Click Create Token → Edit zone DNS template.
- Permissions:
Zone → DNS → EditandZone → Zone → Read. - Zone Resources: restrict to the specific zones you want the bot to touch.
- Copy the token.
- Push the repo to your GitHub (fork already does this).
- Go to Render Dashboard → New → Blueprint.
- Select your repo — Render reads
render.yamlautomatically. - Fill the three secret env vars:
TELEGRAM_TOKENCF_API_TOKENALLOWED_CHAT_IDS(your numeric Telegram ID)
- Deploy. You'll get a URL like
https://cf-dns-telegram-bot.onrender.com.
Render's free tier sleeps after ~15 minutes of inactivity.
- Sign up at UptimeRobot.
- Add Monitor → HTTP(s).
- URL:
https://<your-render-service>.onrender.com/health - Interval: 5 minutes.
- Save. Your bot now stays awake 24/7.
| Command | Description |
|---|---|
/start |
Show the help message |
/help |
Same as /start |
/cname |
Start the CNAME creation flow |
/cancel |
Abort the current flow |
cf-telegram-bot/
├── bot.py # Main bot + health server
├── requirements.txt # Python dependencies
├── render.yaml # Render Blueprint
├── .env.example # Env template
├── .gitignore
└── README.md
- The bot only responds to chat IDs listed in
ALLOWED_CHAT_IDS. - Scope your Cloudflare token to specific zones — never use a Global API Key.
.envis ignored by git; secrets live only in Render's environment.
git clone https://github.com/realximanta/cf-telegram-bot.git
cd cf-telegram-bot
python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
cp .env.example .env
# edit .env with your TELEGRAM_TOKEN, CF_API_TOKEN, ALLOWED_CHAT_IDS
python bot.py-
/cnamecreation -
/a,/aaaa,/txt,/mxrecords -
/listrecords per zone -
/deletewith confirmation - Proxy toggle (orange cloud on/off)
PRs welcome — see CONTRIBUTING.
- Fork the repo.
- Create a feature branch:
git checkout -b feat/awesome-thing. - Commit:
git commit -m "feat: add awesome thing". - Push:
git push origin feat/awesome-thing. - Open a Pull Request.
Released under the MIT License — see LICENSE for details.
