A Telegram bot that monitors domain names and notifies users when a previously registered domain becomes available.
Built with Cloudflare Workers, Cloudflare D1, Telegram Bot API, IANA RDAP, and Cron Triggers.
- π Check domain availability through RDAP
- π Support domains across different TLDs
- π€ Telegram bot interface
- π Monitor registered domains
- π Notify users when a monitored domain becomes available
- π Change the domain being checked
- πΎ Persistent domain storage using Cloudflare D1
- β° Automatic domain checks every 12 hours
- βοΈ Serverless deployment with Cloudflare Workers
- π Telegram bot token stored as a Worker secret
- π₯ Per-user domain monitoring
- π« No server, VPS, or
setInterval()required
Telegram User
β
β Telegram Message
βΌ
βββββββββββββββββββββββ
β Telegram Bot API β
ββββββββββββ¬βββββββββββ
β Webhook
βΌ
βββββββββββββββββββββββ
β Cloudflare Worker β
β β
β ββ Telegram Logic β
β ββ Domain Checker β
β ββ Database Logic β
β ββ Cron Handler β
βββββββββ¬ββββββββ¬ββββββ
β β
D1 Database β RDAP
β βΌ
β ββββββββββββββββ
β β IANA RDAP β
β β Bootstrap β
β ββββββββ¬ββββββββ
β β
β βΌ
β Authoritative
β RDAP Server
β
βΌ
βββββββββββββββββββββββ
β Cloudflare D1 β
β β
β watched_domains β
β user_sessions β
βββββββββββββββββββββββ
β²
β
Cron Trigger
Every 12 hours
| Technology | Purpose |
|---|---|
| JavaScript | Application logic |
| Cloudflare Workers | Serverless runtime |
| Cloudflare D1 | SQLite-based persistent database |
| Telegram Bot API | Bot communication |
| IANA RDAP Bootstrap | Finding authoritative RDAP servers |
| RDAP | Domain registration/availability checks |
| Cloudflare Cron Triggers | Scheduled domain monitoring |
| Wrangler | Cloudflare CLI and deployment |
| Vitest | Testing |
domain-notifier-worker/
β
βββ src/
β βββ index.js
β βββ database.js
β βββ domainChecker.js
β βββ telegram.js
β βββ watcher.js
β
βββ test/
β βββ index.spec.js
β
βββ schema.sql
βββ wrangler.jsonc
βββ package.json
βββ package-lock.json
βββ vitest.config.mjs
βββ .prettierrc
βββ .editorconfig
βββ .gitignore
βββ README.md
Main Cloudflare Worker entry point.
Handles:
- Telegram webhook requests
/start- domain input
π Notify Meπ Change Domain- scheduled events
Contains all D1 database operations.
Handles:
- user sessions
- watched domains
- domain status updates
- retrieving monitored domains
Checks domain availability using RDAP.
The process is:
Domain
β
Extract TLD
β
IANA RDAP Bootstrap
β
Find authoritative RDAP server
β
Query /domain/{domain}
β
HTTP 404 β Available
HTTP 200 β Registered
Other β Unknown/Error
Contains the Telegram Bot API integration.
The Worker communicates directly with Telegram using fetch().
Handles scheduled monitoring.
It:
- Gets all monitored domains from D1.
- Checks each domain through RDAP.
- Determines its current status.
- Sends a Telegram message.
- Updates the stored status.
You need:
- Node.js
- npm
- A Cloudflare account
- A Telegram account
- A Telegram bot
- Wrangler CLI
Check Node.js:
node --versionCheck npm:
npm --versiongit clone https://github.com/igamanraj/Domain-Notifier-Bot.git
cd Domain-Notifier-Botnpm installOpen Telegram and search for:
@BotFather
Create a new bot using:
/newbot
BotFather will provide a bot token.
Never commit the Telegram bot token to GitHub.
Do not put it directly inside:
src/
wrangler.jsonc
README.md
The token should be stored as a Cloudflare Worker secret.
Create a D1 database:
npx wrangler d1 create domain-notifier-dbCloudflare will return a database ID.
Add the database configuration to wrangler.jsonc:
{
"name": "domain-notifier-worker",
"main": "src/index.js",
"compatibility_date": "2026-11-18",
"d1_databases": [
{
"binding": "DB",
"database_name": "domain-notifier-db",
"database_id": "YOUR_DATABASE_ID"
}
],
"triggers": {
"crons": [
"0 0,12 * * *"
]
}
}Replace:
YOUR_DATABASE_ID
with your actual Cloudflare D1 database ID.
The project includes:
schema.sql
Apply it to your remote D1 database:
npx wrangler d1 execute domain-notifier-db --remote --file=./schema.sqlVerify the tables:
npx wrangler d1 execute domain-notifier-db --remote --command="SELECT name FROM sqlite_master WHERE type='table';"You should see:
watched_domains
user_sessions
Store the Telegram token as a Cloudflare Worker secret:
npx wrangler secret put TELEGRAM_BOT_TOKENWrangler will prompt you to enter the token.
Do not put the token inside wrangler.jsonc.
Deploy the Worker:
npx wrangler deployAfter deployment, Cloudflare will provide a Worker URL similar to:
https://domain-notifier-worker.<your-subdomain>.workers.dev
Set the Telegram webhook to your deployed Worker URL.
Using PowerShell:
$token=$env:TELEGRAM_BOT_TOKEN
Invoke-RestMethod `
-Method Post `
-Uri ("https://api.telegram.org/bot" + $token + "/setWebhook") `
-ContentType "application/json" `
-Body (@{
url="https://YOUR_WORKER_URL"
} | ConvertTo-Json)Replace:
YOUR_WORKER_URL
with your deployed Cloudflare Worker URL.
Telegram should return:
ok result description
-- ------ -----------
True True Webhook was set
Open your Telegram bot and send:
/start
The bot will ask for a domain.
For example:
sanskargupta.dev
The bot checks the domain and returns its current status.
β Domain unavailable.
π example.com
This domain is currently registered.
What would you like to do?
The user can then select:
π Notify Me
The domain is stored in D1 and will be checked automatically.
If the domain is available:
π Good news!
π example.com
The domain appears to be AVAILABLE.
When a user selects:
π Notify Me
the domain is stored in the watched_domains table.
Example:
user_id: 1570694216
domain: example.com
status: registered
The Worker periodically checks all monitored domains.
The project uses a Cloudflare Cron Trigger:
0 0,12 * * *
Cron schedules use UTC.
For India Standard Time:
00:00 UTC β 05:30 AM IST
12:00 UTC β 05:30 PM IST
The scheduled Worker executes:
scheduled()
β
checkWatchedDomains()
β
getAllWatchedDomains()
β
checkDomain()
β
sendMessage()
β
updateDomainStatus()
The project uses two main D1 tables.
Stores domains that users want to monitor.
CREATE TABLE IF NOT EXISTS watched_domains (
id INTEGER PRIMARY KEY AUTOINCREMENT,
user_id TEXT NOT NULL,
username TEXT,
domain TEXT NOT NULL,
status TEXT NOT NULL DEFAULT 'registered',
notified INTEGER NOT NULL DEFAULT 0,
created_at TEXT NOT NULL,
updated_at TEXT NOT NULL,
UNIQUE(user_id, domain)
);Stores the current state of each user's bot interaction.
CREATE TABLE IF NOT EXISTS user_sessions (
user_id TEXT PRIMARY KEY,
username TEXT,
step TEXT NOT NULL,
domain TEXT,
status TEXT,
updated_at TEXT NOT NULL
);Persistent sessions are important because Cloudflare Workers are serverless and should not rely on an in-memory JavaScript Map for user state.
The bot uses the IANA RDAP bootstrap registry:
https://data.iana.org/rdap/dns.json
The TLD is extracted from the domain.
For example:
example.com
β
com
The IANA bootstrap registry is used to find the appropriate authoritative RDAP server.
The Worker then performs a request similar to:
https://rdap-server.example/domain/example.com
The result is interpreted as:
| RDAP Response | Bot Status |
|---|---|
| HTTP 404 | Available |
| HTTP 200 | Registered |
| Other response | Unknown |
| Request failure | Error |
Start the Worker locally:
npx wrangler devThe local Worker normally runs at:
http://127.0.0.1:8787
Cloudflare does not automatically trigger scheduled events during local development.
Trigger one manually:
curl "http://127.0.0.1:8787/cdn-cgi/local/scheduled"You should see logs similar to:
β° Cron triggered!
π Checking watched domains...
π No watched domains.
If your local D1 database contains watched domains, the Worker will check them.
To inspect the production D1 database:
npx wrangler d1 execute domain-notifier-db --remote --command="SELECT * FROM watched_domains;"Example:
id | user_id | username | domain | status
1 | 123456 | username | example.com | registered
Never commit secrets.
The following files should not be committed:
.env
.dev.vars
.wrangler/
node_modules/
The repository's .gitignore already excludes sensitive/local files.
Telegram bot tokens should be stored using Cloudflare Worker secrets:
npx wrangler secret put TELEGRAM_BOT_TOKENIf a bot token is accidentally exposed, immediately revoke/rotate it through BotFather.
The normal production deployment process is:
npm install
npx wrangler deployCloudflare will deploy:
- Worker code
- D1 binding
- Cron configuration
The production Worker is then available through its Cloudflare Workers URL.
After making code changes:
git statusReview the changes.
Then:
git add .
git commit -m "describe your change"
git pushDeploy the new version:
npx wrangler deploynpx wrangler devnpx wrangler deploynpx wrangler d1 execute domain-notifier-db --remote --command="SELECT name FROM sqlite_master WHERE type='table';"npx wrangler d1 execute domain-notifier-db --remote --command="SELECT * FROM watched_domains;"npx wrangler d1 execute domain-notifier-db --remote --command="SELECT * FROM user_sessions;"npx wrangler d1 execute domain-notifier-db --remote --file=./schema.sqlThe current version intentionally keeps the bot simple.
Currently implemented:
- Domain checking
- Domain monitoring
- Scheduled checks
- Telegram notifications
- D1 persistence
Possible future improvements include:
/help/list/add/remove- Multiple domain management through Telegram commands
- Inline keyboards
- Configurable monitoring intervals
- Retry handling for temporary RDAP failures
- Rate limiting
- Better monitoring statistics
- Domain expiration information
- More detailed RDAP information
- Telegram bot
- Domain availability checking
- RDAP integration
- Cloudflare Worker
- Cloudflare D1
- Telegram webhook
- Domain monitoring
- Cron-based checking
- Telegram notifications
-
/help -
/list -
/add -
/remove - Multiple domains per user management
- Inline keyboard interface
- Better error/retry handling
- Rate limiting
- Monitoring dashboard
Contributions are welcome.
- Fork the repository.
- Create a new branch:
git checkout -b feature/my-feature- Make your changes.
- Test the Worker locally.
- Commit your changes:
git commit -m "feat: add my feature"- Push the branch:
git push origin feature/my-feature- Open a Pull Request.
This project is licensed under the MIT License.
See the LICENSE file for details.
Aman Raidas
GitHub:
If this project was useful, consider giving the repository a β on GitHub.