They comment “guide”. Two seconds later, they have your link.
Instagram comment-to-DM that runs on your own Cloudflare account, on the free plan. No monthly fee, and no SaaS holding your Instagram login.
Open source under MIT, at version 0.5.0 (changelog). Setup is one command, plus about 15 minutes in Meta’s developer dashboard.
Hosted tools vs. your own Worker
| What | Hosted tools | Comment to DM |
|---|---|---|
| Cost | $15–99 a month, every month | $0. Cloudflare’s free plan covers 100,000 requests a day. |
| Your Instagram token | On their servers, next to everyone else’s | In your Cloudflare account, encrypted with a key only you hold |
| Your audience’s DMs | Pass through a third party | Go straight from your Worker to Meta |
| If they shut down | The automation stops | Nothing changes. It’s your Worker. |
| The code | Closed | One Worker, one runtime dependency, no build step |
When a reel takes off
Instagram lets an account send about 750 private replies an hour and refuses the rest. So the Worker sends at most 12 DMs a minute per account, which keeps every hour under the limit, and queues the others. A job every minute works through the queue, oldest comment first: 5,000 comments on one reel clear in about 7 hours.
- Queued
- Waiting its turn under the hourly limit.
- Retrying
- Instagram said “not now”: the account was sending too fast, or Instagram had a temporary error. Tried again after 1, 5 and 20 minutes.
- May have been delivered
- Instagram’s answer never came back. The Worker won’t send it again by itself, because a second try could reach the same person twice. Send again is there once you’ve checked.
- Expired
- Still waiting an hour before Instagram’s 7-day cutoff for private replies, so it was skipped.
Those are the labels on Home, next to every send. Each comment is claimed in the database before its DM goes out, so a webhook Meta delivers twice, or a comment that both the webhook and the poll find, still gets one DM.
Security
The admin panel lives at a URL with a 128-bit secret in it, behind a password. After five wrong passwords, each wait doubles from a minute up to an hour, and guesses sent in parallel are counted one at a time. Logging out ends every session, on every device.
Every webhook is checked against Meta’s signature before it’s parsed, and forged ones can’t fill your database. Instagram tokens are encrypted with AES-256-GCM under a key that exists only in your Cloudflare account. No JavaScript runs in the panel: its Content-Security-Policy is default-src 'none'.
Security covers what isn’t defended against, and how to report a problem privately.
Setup
# Node.js 22.13+ and a free Cloudflare account
git clone https://github.com/CharanMN7/ig-comment-dm.git
cd ig-comment-dm
npm install
npx wrangler login
npm run setupnpm run setup deploys the Worker, creates the database, generates every secret at the right size, and prints the exact values to paste into Meta’s dashboard. The Meta side (creating an app, adding yourself as a tester, publishing it) is the slow part, and the guide shows every screen. Updating later is one command too:npm run update.
- Self-setup guide: Cloudflare and the Meta developer app, step by step.
- Agent setup guide: Claude Code and Claude in Chrome do the clicking. You keep the logins and the secrets.
Limits
Meta’s rules and Cloudflare’s free plan, not ours. Each one has cost someone an evening, so here they are up front.
- Professional accounts only. Instagram’s API doesn’t work with personal accounts. Switching to Creator or Business takes a minute in the app, under Settings → Account type and tools.
- You need your own Meta developer app, and it has to be Live. An app in Development mode only receives the dashboard’s Test button, never real comments. Publishing needs no App Review while only your own accounts connect as Instagram Testers; App Review is for letting other people connect theirs.
- One DM per comment, ever. Instagram allows one private reply per comment, and no follow-up unless the person replies first. Put everything in that message.
- Comments older than seven days can’t get a private reply. They’re logged as skipped.
- Hidden Words wins. Comments Instagram’s filter hides never reach the API, so nothing can answer them.
- Not following you? Message requests. A DM to someone who doesn’t follow you lands in their Message requests folder, not their inbox.
- About 750 private replies an hour per account. Meta’s cap. The Worker stays under it at 12 a minute and queues the rest, so on a reel that takes off some DMs arrive minutes or hours late.
- About 6,000 to 7,500 DMs a day on the free database. Cloudflare’s free D1 plan allows 100,000 rows written a day, and each DM writes 13 to 16. Past that, D1 refuses everything until midnight UTC.
Questions
Does it need my Instagram password?
No. You connect each account through Instagram’s own login page, the same official flow (Instagram Login) that hosted tools use. The Worker only ever holds the access token Instagram issues, encrypted with AES-256-GCM under a key that lives in your Cloudflare account.
What does it cost?
Nothing. Meta doesn’t charge for the API, and Cloudflare’s free plan covers up to about 6,000 to 7,500 DMs a day.
Is this allowed?
It uses Meta’s official Graph API through Instagram Login: webhooks for comments and the Private Replies endpoint for the DM. No scraping, no browser automation, no unofficial endpoints.
Do I need to write code?
No. You run five commands and click through Meta’s developer dashboard. If you’d rather not, the agent setup guide has Claude Code and Claude in Chrome do the typing and clicking while you handle the logins and secrets.
What if Meta never sends the webhook?
Every five minutes the Worker also reads the last 72 hours of comments itself, on the posts your rules cover (your three newest, for a rule on all posts), three posts per account at a time. A comment the webhook missed gets its DM late instead of never. Each comment is claimed in the database before anything is sent, so nobody gets two.
Can I run it for several accounts?
Yes, for accounts that are yours: one deployment handles several Instagram accounts, each added as an Instagram Tester on your Meta app. For a client, set up a separate copy on their own Cloudflare account and Meta app.
How do I update it?
Run npm run update. It pulls the latest code, shows what changed, applies any database migrations and deploys. Your secrets live in Cloudflare and your data in D1, so an update doesn’t touch either. Updating your copy has the details, and the changelog lists each version with anything to do before upgrading.
Can I contribute?
Yes, starting from an issue. Comment to claim one and wait for a maintainer to assign you: a pull request that doesn’t close an issue assigned to its author is closed automatically. AI tools are fine if you say how you used them and understand every line. Contributing has local setup and the house style.
maya.draws guide please 🙏