A simple to configure, pre-built Cloudflare Worker that monitors DNS records for any list of user-specified domains and sends notifications via Telegram when changes are detected.
The project is designed to stay comfortably within Cloudflare's free tier for it's Worker and KV storage services.
- Node.js (v20 or later)
- npm (comes with Node.js)
- Wrangler CLI (v4 or later)
-
Clone the repository:
git clone https://github.com/wavey0x/dns-bot.git cd dns-bot -
Install dependencies:
npm install
-
Configure your bot:
All configuration lives in your repository's Settings > Secrets and variables > Actions.1
- Get your Cloudflare API token2
-
Deploy the bot:
Deploys only run via GitHub Actions — push to the
main/masterbranch (or trigger the workflow manually) and the GitHub Action will deploy the bot.
To view the logs for your deployed worker:
- Go to the Cloudflare Dashboard.
- Navigate to Workers & Pages.
- Select your worker (
dns-bot). - Click on Logs to view the worker's logs.
- Wrangler not found: Ensure Wrangler is installed globally or use
npx wrangler. - Deployment fails: Check your API token and ensure all environment variables are set correctly.
- No logs: Ensure logging is enabled in your
wrangler.tomlfile. - GitHub Actions fails: Verify that all required secrets are set in your repository's Settings > Secrets and variables > Actions.
Footnotes
-
Go to your repository's Settings > Secrets and variables > Actions. Add the sensitive values as secrets:
CLOUDFLARE_API_TOKEN,CLOUDFLARE_ACCOUNT_ID, andTELEGRAM_BOT_TOKEN. Add the rest as variables:MONITOR_DOMAINS(comma-separated domains) andTELEGRAM_CHAT_ID, plus optionallyTELEGRAM_THREAD_IDto post alerts to a specific topic thread in a Telegram group chat andHEARTBEAT_URLfor Uptime Kuma push monitoring. Optionally addALLOWED_IP_RANGES(e.g.flexmeow.com=216.150.0.0/16;other.com=76.76.21.0/24,76.76.22.0/24) so IP changes that stay inside a domain's expected CIDR ranges update state silently instead of alerting - useful for hosts like Vercel that rotate IPs within known pools. ↩ -
To get your Cloudflare API token:
- Go to the Cloudflare Dashboard
- Navigate to My Profile > API Tokens
- Click Create Token
- Choose Create Custom Token
- Set the following permissions:
- Account > Workers > Edit
- Zone > DNS > Read
- Set the Account Resources to All accounts
- Set the Zone Resources to All zones
- Click Continue to summary and then Create Token
