Build your own ManyChat alternative with Claude Code and Cloudflare
The comment-to-DM system I built with Claude Code on Cloudflare's free plan: what it does, what you need, the seven setup steps, and where Meta's rules can catch you out.

The video this post is adapted from. 5 minutes. Pressing play loads it from YouTube, which may store data in your browser.
Comment a keyword, get a link in your DMs. If you post reels to sell something or give it away, you've seen it, and the usual tool behind it is ManyChat. ManyChat bills by the number of contacts, so a reel that takes off makes your bill go up. This post covers the ManyChat alternative I built instead: a small program that Claude Code writes for you, running on a free Cloudflare account and talking to Instagram through its official API.
Mine has run since 13 October 2026. By 1 November it had answered over 1,300 comments and sent over 3,000 DMs, and my Cloudflare bill was still zero. Below is what it does, what you need, the seven setup steps in outline and the limits worth knowing before you rely on it.
What this Instagram comment to DM automation does
Someone comments your keyword under a post. The worker, which is the program running on Cloudflare, posts a public reply under their comment and sends them a DM with a button. The button matters, because Instagram only tells the worker whether that person follows you once they've tapped it. If they follow, the worker sends your link. If they don't, it asks them to follow and tap again, and it keeps asking until they do.
Everything goes through Meta's official Instagram API, the same one anyone has access to. No bot logs into your account with your password, which would break Instagram's terms of service. The follow check is based on OpenReply, an open-source repo under the MIT licence.
Some of it runs without you touching anything:
- Every 15 minutes it checks your recent posts, so a comment Instagram never delivered to the worker still gets its DM.
- Once a week it refreshes your access token, because Instagram's long-lived tokens expire after 60 days.
- It ignores comments from your own account on purpose.
- Adding a keyword is one sentence to Claude Code: the word, the message and the link. It updates the keyword file and deploys again, ready for your next reel.
Why build it rather than pay per contact
Contact-based pricing costs you most on the reels that work. My biggest day was 22 October, with 453 new contacts. When I recorded the video on 1 November, my reading of ManyChat's plans was that the free tier stops at about 25 active contacts a month, and a day like mine would put you on a paid plan of about $39 a month. I couldn't confirm those figures on ManyChat's own site, so check its pricing page for the current numbers before you compare.
The costs here sit somewhere else. Claude Code comes with a Claude subscription, so if you already pay for one, the build adds nothing to your bill. Cloudflare's free plan and a Meta developer account cost nothing. The trade is that nobody else runs it. You own the setup, and when something needs to change, you ask Claude Code instead of a support desk.
What you need
- A public Instagram account switched to a professional account.
- Claude Code, through a Claude plan. On 1 November 2026, claude.com/pricing listed Pro at $20 a month billed monthly, or $17 a month on the annual plan ($200 up front), with Claude Code included.
- A free Cloudflare account. Claude Code does the Cloudflare setup from the terminal, so you won't be clicking around the dashboard.
- A free Meta developer account at developers.facebook.com.
- A second Instagram account for testing, because the worker skips your own comments.
The seven steps in outline
The prompt and the click-by-click instructions are on the free resource page for this build. The outline below tells you what each step does, so you know what you're signing up for before you open a terminal.
- 1Create a free Cloudflare account. Claude Code handles the rest of Cloudflare from the terminal.
- 2Make an empty folder, open Claude Code in it and paste in the prompt. Fill in the short form at the top with your Instagram username, the keyword people comment, the DM text and your link. Claude writes the worker and tests it against a fake version of Instagram before it goes near your account. Then it has you log into Cloudflare once in your browser while it creates the database and puts the worker live. It finishes with a web address and a checklist.
- 3At developers.facebook.com, create an app and choose the "Manage messaging & content on Instagram" use case. Keep this app for DMs only, so a leaked key can't reach anything else.
- 4On that use case, press Customize, open API setup with Instagram login, add your account and generate a token. Store it the way the next section explains. Give Claude your Instagram account ID from the same page so it can finish the setup and deploy again. Then, on your phone, turn on Allow Access to Messages under Connected Tools in Instagram's message settings.
- 5In the webhook section of the same page, paste the worker's address with /webhook on the end, add the verify token Claude gave you and press Verify and save. Then subscribe to comments, messages and messaging postbacks. Postbacks are the button taps.
- 6Paste the addresses of the worker's privacy page and data deletion page into App settings, then publish the app. Meta only sends real comments to a published app.
- 7From your second account, comment the keyword on one of your posts. You should see a public reply, then a DM in message requests if that account doesn't follow you, then the link once you follow and tap.
Keep the token out of the chat
The token from step 4 lets the worker send messages as you, so treat it like a password. Don't paste it into Claude Code's chat. Run the terminal command Claude gives you and paste it there, where it's stored as a secret. Do the same with the Instagram app secret from that page. The worker uses it to check that a message really came from Instagram.
Limits to know before you rely on it
You may need Meta's App Review. Meta's documentation says Advanced Access is required for comment notifications. The app uses three permissions: instagram_business_basic, instagram_business_manage_comments and instagram_business_manage_messages. I published mine without a review, and since 13 October it has replied to accounts that have no role in the app. That's what happened on my account, and yours may behave differently. The 15-minute check of recent posts is in the prompt partly for that reason, but don't count on it as a way around the review.
Meta limits what you can send. A private reply to a comment has to go out within 7 days of the comment, and Meta allows one message to the commenter until they respond. After they respond, follow-ups have a 24-hour window. You add features the same way you add a keyword, by asking Claude Code. Mine asks for an email 22 hours after the first DM, so the message lands inside that window.
Cloudflare's free plan has daily caps. On 1 November 2026 they were 100,000 Worker requests a day with 10 ms of CPU per request, and for the D1 database 5 million rows read and 100,000 rows written a day. KV storage allows 1,000 writes a day. I built what I learned into the prompt so it stays inside those numbers, but the caps are real.
If Instagram is only one of the places your leads come in, the next problem is keeping them together. This is how a solar installer stopped losing leads to four inboxes.
If you run a service business and want comment-to-DM set up and joined to the rest of your lead handling, that's the kind of automation I build. Book a free call.
