Introduction
You post a Reel. At the end you say the line every creator and small business owner now says: "Comment GUIDE and I will send you the link."
It works. Dozens of people comment GUIDE. And then the work starts: opening every comment, copying the link, sending it by DM, replying under the comment so people know it arrived — while new comments keep coming in. Miss a few and you look careless. Answer them all by hand and you lose the afternoon.
That is exactly the job ManyChat sells. It watches your comments, and when someone writes your keyword it sends them the link by DM automatically. It is a good product. The problem is the price of the free plan.
In March 2026 ManyChat cut its free plan from 1,000 active contacts a month to just 25. One Reel that performs well can burn through 25 contacts in an hour. After that you pay: Essential is $17 a month ($14 billed yearly) for 250 contacts, and Pro is $39 a month ($29 billed yearly) for 2,500 contacts, with a per-contact charge above that. An "active contact" is any person who exchanges messages with you in that billing month — so your bill grows with your audience, whether or not any of them buy anything.
This is the first episode of our Build It Yourself series, where you build your own free version of a paid tool instead of renting it. In this one you build your own Instagram auto-DM system for $0 a month. It does the same core job: someone comments your keyword, they get your link by DM, and a short public reply appears under their comment. It runs 24/7, even while your phone is off, and you control it from a Google Sheet on your phone.
No coding experience is needed. You will copy a ready-made open-source script, fill in five settings, and test it before it sends anything real. Allow about 30 minutes the first time.
One honest note: we checked the pricing, the code repository and the setup steps against live sources on December 3, 2026, but we have not deployed this exact system on a live business account ourselves. That is why Step 5 exists — a dry run that sends nothing — and you should never skip it.
What you are building
A small system with four parts that work together:
- Meta's official Instagram API. Your own app on Meta for Developers, in Development Mode, for your account only. It reads comments and sends replies through the official channel — no password sharing, no browser automation, no third-party service logging in as you.
- Cloudflare Workers. A free cloud service that runs your code on a schedule — every 5 minutes, day and night, even when your computer is off. The free plan allows 100,000 requests a day; this system uses a few hundred.
- A Google Sheet as your control panel. One row per rule: the keyword, the DM text, on or off. Add a rule from your phone and the system picks it up within minutes. No code changes, no digging up post IDs.
- Built-in safety rules. The system sends DMs as a proper button card instead of a bare link (bare links trip spam filters), caps itself at 60 DMs an hour and 5 sends per run, never messages the same person twice about the same Reel, skips comments you already answered yourself, and pauses itself for 15 minutes if Meta reports a rate limit.
The code for this build is open source under the MIT licence, and you can download the full package — the worker script, a ready-made sheet template and the licence file — here:
⬇ Download the code files (ZIP)You are not buying anything, and you are not pasting code into the dark: the package is small, and you can read every line of it before you deploy.
Before you start: the checklist
You need four things, all free:
- An Instagram Professional account — Creator or Business, not Personal. (Settings → Account type → Switch to professional account.)
- A Facebook Page linked to that Instagram account, inside a Meta Business Portfolio. The API works through the Page connection, so this step is not optional.
- A free Cloudflare account. Sign up at cloudflare.com — no card required for the free plan.
- A Google account, for the Sheet.
If your Instagram is still a Personal account, switch it first and link the Page. Everything below assumes that is done.
Step 1: Create your Meta app and a permanent token (about 10 minutes)
- Open developers.facebook.com and sign in, then click Create App.
- When it asks for a use case, choose Manage messaging & content on Instagram, then connect the app to your Business Portfolio.
- In the left menu, open Instagram → API setup with Unified login. Confirm your Professional Instagram account is connected, and grant the three permissions:
instagram_business_basic,instagram_business_manage_comments,instagram_business_manage_messages. - Now the token. Open business.facebook.com/settings, go to Users → System Users, create a new Admin system user, click Assign Assets and connect it to your app and your Facebook Page / Instagram account. Then click Generate New Token, set the expiry to Never, and tick the same three Instagram permissions.
- Save two values somewhere safe on your own device — never in a shared doc or a public repo:
- IG_ACCESS_TOKEN — the permanent token you just generated.
- IG_USER_ID — your Instagram account's numeric ID.
- Also note your OWN_USERNAME — your Instagram handle without the @ — so the system never replies to your own comments.
Meta changes its menus often. If a button has moved or looks different, take a screenshot and ask ChatGPT, Claude or Gemini where to click — that is the fastest way through a changed interface, and it is covered properly in the "not technical" section below.
Step 2: Build your control panel in Google Sheets (about 5 minutes)
- Open Google Sheets and create a sheet called IG Auto-DM Rules.
- In the first row, write these four column headings exactly:
keywords|dm_message|active|media_id. - Add your first rule in row 2. For example:
- keywords:
GUIDE, guide - dm_message: first line is the card title, second line the short description, then the link on its own line — for example:
Your free guide is ready/Tap the button below to open it/https://yourwebsite.com/guide - active:
YES - media_id: leave empty. Empty means "apply this to my latest Reels automatically" — you never have to look up a post ID.
- keywords:
- Go to File → Share → Publish to web, pick the sheet, change the format from Web page to Comma-separated values (.csv), click Publish, and copy the link. That is your SHEET_CSV_URL.
From now on, running the system means editing this sheet. New Reel, new freebie? Add a row from your phone. Offer finished? Change active to NO. The system re-reads the sheet every run.
Step 3: Put the worker on Cloudflare (about 10 minutes)
- Sign in to the Cloudflare dashboard. From the left menu go to Storage & databases → KV, click Create a namespace and name it
ig_auto_dm_state. This is the system's memory: which comments it already handled, who it already messaged. - Go to Compute → Workers & Pages → Create → Create Worker, name it
ig-auto-dm, and click Deploy. - Click Edit code, delete the default code, and paste in the contents of
worker.jsfrom the code package you downloaded above. Click Deploy again.
Two details worth knowing about the code, so you understand what you just deployed: the first line of your DM becomes the button card's title and the second line its subtitle (both capped at 80 characters, the button at 20), and the worker normalises Arabic letters — hamzas, teh marbuta, alef forms — so a keyword matches regardless of how someone typed it. English keywords match as written.
Step 4: Add the five settings and switch on the schedule (about 5 minutes)
Inside your Worker, open the Settings tab:
- Bindings: click Add → KV namespace, set the variable name to
STATE_KV(exactly, in capitals) and selectig_auto_dm_state. Save. - Variables and Secrets: add these five:
IG_ACCESS_TOKEN— type Secret — your permanent token from Step 1.IG_USER_ID— type Text — your numeric Instagram ID.OWN_USERNAME— type Text — your handle without @.SHEET_CSV_URL— type Text — the published CSV link from Step 2.ADMIN_SECRET— type Secret — a strong password you invent, used to protect the test links below.
- Trigger Events → Cron Triggers: click Add Cron Trigger and enter
*/5 * * * *— that means every 5 minutes, around the clock.
Never put the access token or the admin secret in the code itself, in a GitHub repo, or in a chat message. Secrets belong in Cloudflare's Secrets store only.
Step 5: Test it safely before it sends anything real
Your Worker has a web address like https://ig-auto-dm.<your-subdomain>.workers.dev. Open these three links in order, replacing YOUR_SECRET with the admin password you chose:
- Status check — sends nothing:
…/status?secret=YOUR_SECRET— you should see"ok": trueand the number of active rules from your sheet. - Dry run — sends nothing:
…/run?dry=1&secret=YOUR_SECRET— this shows you which comments match and what it would send, without sending anything. - One real message:
…/run?max=1&secret=YOUR_SECRET— sends a single button-card DM, so you can confirm it arrives in your inbox and the public reply appears under the comment.
Only when all three look right should you leave the cron trigger running. If the status check fails, the usual causes are a wrong token, a sheet that is not published as CSV, or the KV binding name mistyped — check those three first.
How it behaves day to day
Every 5 minutes the worker wakes up and looks at your latest 3 Reels posted in the last 7 days. For each comment it checks: does it contain one of your keywords? Have I already handled this comment? Did the owner already reply? Have I already messaged this person about this Reel? Is it within Meta's 7-day window for private replies?
If the answer is a clean yes, it sends the DM as a button card and posts a short public reply under the comment — something like "Sent, check your inbox" — picked at random from a small list so your replies do not all read identically. Then it records the comment ID so it never sends twice.
The caps are deliberately conservative: at most 5 DMs per run and 60 per hour. A normal small-business account will never come close. If a Reel goes viral and the queue grows, the system works through it steadily instead of blasting Meta's limits and getting your account flagged. If Meta does return a rate-limit error, the worker pauses itself for 15 minutes and tries again — it never hammers the API.
The honest limits
- Seven days only. Meta allows private replies to a comment for 7 days after the comment was posted. After that the window closes; the system simply skips older comments. This is a platform rule, not a bug.
- Your account only. The app runs in Development Mode for your own account, which is why no App Review is needed. That also means it cannot run auto-DMs for clients or other people's accounts. If you manage accounts for others, each one needs its own setup.
- Instagram only, comments only. This build does not answer story replies, post captions, or WhatsApp, and it does not write AI replies — it sends the exact message you wrote in the sheet. That is a feature for a small business: every word that goes out is yours.
- Setup is real work. The guide says 15 minutes; give yourself 30 the first time, mostly in Meta's settings pages. The running cost after that is zero and the maintenance is editing a sheet.
- Know when to pay. If you outgrow this — you need AI-written replies, WhatsApp and SMS in the same inbox, broadcasts to thousands, or a team sharing one inbox — ManyChat Pro at $39 a month ($29 billed yearly) is the honest upgrade. This build is for owners who need the one core job done well, not the whole platform.
Not technical? Let an AI assistant walk you through it
This is the trick that makes the whole series possible. You do not need to memorise anything above:
- Open ChatGPT, Gemini or Claude and paste it the link to this article — or to the GitHub repository.
- Ask it to be your personal setup guide: one short step per message, in plain language, and not to move on until you confirm each step is done.
- Whenever a Meta or Cloudflare screen looks different from the description, or you hit an error message, take a screenshot and send it to the assistant in the same chat. It will read the screen and tell you exactly where to click.
Do not ever share your password with the assistant. The only secrets in this build are the access token and the admin password, and those go into Cloudflare's Secrets store, nowhere else.
The verdict on Build #1
Build it if: you post Reels, you offer a freebie or a link in exchange for a comment, and you are tired of paying a monthly subscription — or watching the 25-contact free plan run out mid-launch — for a job this simple.
Skip it if: you need AI replies, WhatsApp, or a shared team inbox today. In that case, pay for the tool and spend the saved half-hour on your next Reel.
Cost: $0 a month. Time: about 30 minutes once. What you save: $17–$39 a month on Essential or Pro, every month, for as long as you use it.
Next in this series: Build #2 — the lead follow-up machine. A form on your site feeds a Google Sheet, and every new lead automatically gets a welcome email plus a short follow-up sequence from your Gmail — the core of Mailchimp's paid plans, built for $0.
Sources
- ManyChat pricing, checked live on December 3, 2026 — Free $0 for 25 active contacts a month; Essential $17 a month ($14 billed yearly) for 250 contacts; Pro $39 a month ($29 billed yearly) for 2,500 contacts, including AI replies and WhatsApp. Prices scale with active contacts; older accounts may still be on previous pricing. manychat.com/pricing
- Instagram Auto-DM code files (worker.js + Google Sheets template, MIT licence):
⬇ Download the code files (ZIP) - Cloudflare Workers free plan — 100,000 requests a day, as stated in the repository's documentation. cloudflare.com
Prices and facts checked: December 3, 2026. ManyChat's pricing changed sharply in March 2026; check the live pricing page before deciding.

Comments
Post a Comment