walid@portfolio:~/lab/build-your-own-manychat$
cd../lab
01ideaOct 2026

Your own ManyChat: an Instagram comment-to-DM bot from one Claude Code prompt

Someone comments a keyword on your reel; the bot replies, DMs them, checks they follow you and sends the link, running on Cloudflare’s free plan. The prompt, the six Meta setup screens, the add-ons and Instagram’s rules, with every picture, checked against Meta’s, ManyChat’s, Cloudflare’s and Anthropic’s own pages

One Claude Code prompt builds the comment-to-DM bot ManyChat sells: someone comments a keyword on your reel, it replies, DMs them a button, checks they follow you and sends the link, on Cloudflare’s free plan. The guide’s author got 42 commenters, 42 DMs and 14 clicks in three days. The checks kept the build and fixed the setup. Meta says new apps can no longer pick the Instagram Login setup the prompt names; the button taps need a third webhook the steps leave out; the follow-up nudge only works for people who already tapped; and $0 is the running cost, because building it needs a paid Claude plan or API credits.

Claude CodeInstagramCloudflare WorkersAutomationManyChatInstagram private replies (Meta) ↗Instagram webhooks setup (Meta) ↗Moving to Instagram API with Unified Login (Meta) ↗ManyChat pricing ↗ManyChat’s Active Contacts rules ↗Cloudflare Workers limits ↗Durable Objects pricing and free limits ↗Claude Code setup and plans ↗Writing the DMs in your voice, in the Lab ↗
i
What this is

A guide to building your own Instagram comment-to-DM bot, the thing ManyChat charges for, with one prompt in Claude Code. It’s all here: the flow, the author’s first results, the price comparison, the prompt, the six Meta setup screens, the add-on prompts and the rules, with every picture. Account names, profile photos, reel thumbnails and the business name in the screenshots are pixelated. Where the guide got something wrong or left it out, the note at that spot says so, and a fixes prompt to paste after the original is added. Not in the guide: the fixes prompt.

Checked, not copied

What held up, on 30 October 2026

Checked against Meta’s developer docs, ManyChat’s pricing page and help center, Cloudflare’s docs, Anthropic’s Claude Code docs and the guide’s own screenshots.

ClaimWhat the sources say
“Use the Instagram API with Instagram Login (graph.instagram.com)”Meta’s migration guide says newly created apps can’t set it up any more; they get “API setup with Unified login”, which uses graph.facebook.com, a different token, the Meta app secret and an app owned by a business portfolio. The author’s app, whose tester invite was accepted on 27 October, still had Instagram Login, and another Meta page still says it’s added automatically, so you may see either. Existing setups keep working; Meta hasn’t set an end date yet.
“Switch on comments and messages”Not enough. The “Send me the link” and “I’m following” taps arrive as messaging_postbacks, so switch that on too, or the buttons do nothing. Meta also lists turning on webhooks for the account itself as its own step.
“Instagram sends nothing to an unpublished app”Confirmed. But Meta’s pages disagree on whether publishing needs a verified business, and on whether comment notifications need more than publishing. One says an app for your own account needs only Standard Access and no review; its webhook page says comment notifications need Advanced Access, which means App Review and Business Verification. The author’s business showed as unverified when the app was created, and their bot still got comments.
“One nudge an hour later if they did not tap it”Only for people who tapped “Send me the link”: Instagram allows one private reply per comment and nothing more until the person responds. The prompt’s wording could make Claude nudge people who never tapped, which Meta rejects. Instagram doesn’t report taps on a link either, so the bot needs its own redirect to know.
“It checks they follow you … a follow button”The check exists (is_user_follow_business). Meta documents it working after a message, an icebreaker or a menu tap; ManyChat runs it after the first button tap, so it works in practice. There’s no follow button: it’s a link to your profile, and people follow you themselves.
“Rotating short lines … so it never looks like a bot”Rotate to stay clear of Instagram’s spam filters (ManyChat warns against very short replies), not to pass as human. Meta requires automated chats to say so where the law does, naming California and Germany, and recommends it everywhere.
“Liking their comment needs a Facebook login”Wrong. No Instagram API can like a comment, whichever login you use.
“Use the Instagram app secret, not the Meta app secret”Unconfirmed. The two secrets do sit on different pages, but Meta’s webhook page says only “your app’s App Secret”, and its sample app copies the one from App settings, Basic, which is the Meta one. Check against both.
ManyChat’s pricesRight for monthly billing on ManyChat’s current plans, introduced on 2 March 2026. The guide leaves out the Free plan (25 people a month, comment-to-DM included, no follow check) and annual billing: $14, $29, $69 and $139 a month, paid up front.
“$414 that month on Pro, not $39”The math is right, but only if you stay on Pro. Business would cost $161.50 that month, and ManyChat waives overage if you upgrade within the same billing month.
“Your own bot: $0, no cap”No per-person fee, but there are limits. Instagram allows 750 first DMs an hour per account, and Cloudflare’s free plan caps each UTC day at 100,000 requests and 100,000 database rows written. Workers Paid, from $5 a month, lifts the Cloudflare caps.
“One prompt, one afternoon, $0 a month”$0 is the running cost. Building it needs Claude Code, which the free Claude plan doesn’t include: Pro is $20 a month, or $17 a month billed yearly, or pay as you go with API credits.
What you needThree things are missing from the list: a public Instagram account (private accounts get no comment events), a Facebook account to register as a Meta developer, and Node.js on your computer for Cloudflare’s deploy tool.
The 42, 42 and 14They match the author’s dashboard screenshot, which also shows what the text skips: only 17 of the 42 tapped the first button.
Build your own ManyChat for $0

One prompt, the same bot ManyChat sells

One prompt, pasted into Claude Code, builds you the same comment-to-DM bot ManyChat sells: someone comments a word on your reel, it replies, DMs them, checks they follow you and sends the link. Mine runs on Cloudflare’s free plan, so it costs $0 and keeps working with my laptop closed. (The guide’s author speaking. The guide opens “You commented BUILD, so here is everything you need”: it’s what the author’s own bot sends.)

Reading this on your phone? Send yourself the link and open it on your computer. That is where the setup happens.

What it does

The whole flow, from one comment

Comment → DM, automatically. (The account name is pixelated.)
1

Someone comments your keyword

on a reel, say BUILD. Any case, extra words are fine. (That’s the bot’s own matching, not an Instagram rule, and the prompt doesn’t say it, so the fixes prompt below does, as whole words: stricter than the author’s editor, which also catches “Prompts” for “prompt”. Not in the guide: ManyChat says a second comment from the same person under the same post doesn’t trigger again.)

2

It replies under their comment

rotating short lines like “Sent you a DM” so it never looks like a bot. (Not in the guide: rotating keeps you clear of Instagram’s spam filters; it shouldn’t be about passing as human: where the law requires it, Meta wants automated chats to say so. Post the reply after the DM goes through, or “Sent you a DM” can be false.)

3

It DMs them

a message with a “Send me the link” button. (Not in the guide: people who don’t follow you find it in Message Requests, and the button has to be one that reports the tap back to the bot.)

4

It checks they follow you.

Not following? They get a follow button first, then “I’m following”. (The guide says follow button, but Instagram has none: it’s a link to your profile, as the editor below calls it, “Visit profile”. People follow you themselves, come back and tap “I’m following”, and the bot checks again.)

5

It sends the link

and one nudge an hour later if they did not tap it. (Allowed, because their tap opened a 24-hour window. Not in the guide: someone who never tapped or answered the first DM can’t be sent anything more.)

The numbers from my first 3 days

6 reels, all live

The author’s own figures; the first three match the dashboard below, and nothing on it shows the fourth. Not in the guide: only 17 of the 42 tapped “Send me the link”, and unless they wrote back, Instagram lets the bot send nothing more to the other 25, so that first tap is the step to work on. The fourth line needs the “Earlier comments” add-on further down. The DEMO badge most likely means the dashboard was masking names for recording.

✓42 people commented a keyword, 42 got the DM. Nobody waited on me.✓14 clicked the link, a third of everyone who commented.✓28 people on one reel, 10 clicks.✓4 people who commented before the bot existed got their DM the minute it went live.
The dashboard: every automation, one funnel from comment to click. (The connected account and the reel thumbnails are pixelated.)
Why not just pay ManyChat

It bills per person, every month

ManyChat charges per active contact: one person who comments, DMs or replies to your story that month. Five comments from the same person count once. Each plan includes some people, and every person past that is billed extra, automatically. (Checked against ManyChat’s own pricing page and help center: right for monthly billing. Not in the guide: people you reach by broadcast or from the inbox count too, “month” means your billing month, and you can cap the overage in billing settings. Prices exclude tax and depend on your billing country.)

PlanPrice / monthPeople included / monthEach extra person
EssentialPrice / month$17People included / month250Each extra person10¢
ProPrice / month$39People included / month2,500Each extra person5¢
BusinessPrice / month$99People included / month7,500Each extra person2.5¢
AdvancedPrice / month$199People included / month25,000Each extra personabout 0.4¢
Your own botPrice / month$0People included / monthno capEach extra person$0

So one reel that 10,000 people comment on costs $414 that month on Pro, not $39. (Right if you stay on Pro. Not in the guide: Business would cost $161.50 that month, and ManyChat waives the overage if you upgrade within the same billing month.)

Not in the guide: ManyChat also has a Free plan, $0 for 25 people a month with comment-to-DM included, but no follow check and a “Powered by Manychat” message; the follow check starts at Essential. Every paid plan is cheaper billed yearly: $14, $29, $69 and $139 a month, paid up front, with lower overage. Advanced’s 0.4¢ falls as you grow. And your own bot’s “no cap” means no per-person fee: Instagram still allows only 750 first DMs an hour, so a reel with 10,000 commenters takes about 14 hours to answer.

Your ManyChat bill for one month, by how many people interact that month. (The math checks out for monthly billing; the “50k” label sits a little left of where the lines end.)

Monthly prices as listed on hyperleap.ai (October 2026). Check manychat.com/pricing for your country. (Not in the guide: Hyperleap sells a competing product; its prices match ManyChat’s own pages, linked at the top.)

Before you start

What you need

1

Claude Code.

It is the AI that writes and sets it all up. (Not in the guide: it needs a paid Claude plan, Pro at $20 a month or $17 a month billed yearly, or API credits; the free plan doesn’t include Claude Code. The guide links its author’s beginner page here; Anthropic’s setup page is linked at the top.)

2

An Instagram professional account

(Business or Creator). Switching is free in the Instagram settings. (It must be public, or no comment events reach the bot. Switching a private account to professional makes it public. Not in the guide.)

3

A free Cloudflare account

so the bot runs when your computer is off.

4

About an hour

most of it clicking through Meta’s developer site with Claude telling you where. (The guide ends by calling it an afternoon. Not in the guide: if Meta asks for business verification or App Review, it takes days.)

5

A Facebook account

to register as a Meta developer at developers.facebook.com. It’s free and asks you to confirm a phone number and an email. Not in the guide.

6

Node.js and npm

on your computer: Cloudflare’s deploy tool, Wrangler, needs them, and you sign in to Cloudflare from the computer once. Not in the guide.

The prompt

Copy it into Claude Code

The guide’s prompt, word for word. Paste the fixes below before Claude starts building, or right after.

claude-code-prompt18 lines
Build me my own ManyChat-style comment-to-DM bot for my Instagram account.

When someone comments a keyword on one of my reels:
1. reply to their comment publicly (rotate a few short replies)
2. send them a private reply DM with a "Send me the link" button
3. when they tap it, check they follow me; if not, ask them to follow first with an "I'm following" button
4. send the link as a button
5. if they don't tap within an hour, send one follow-up

Use the Instagram API with Instagram Login (graph.instagram.com) and webhooks for comments, messages and messaging_postbacks. Check the X-Hub-Signature-256 on every webhook.

Run it on Cloudflare Workers with a Durable Object for storage, so it works when my laptop is closed. Add a cron every minute for follow-ups and a weekly token refresh.

Give me a small admin page behind a password: one automation per reel (pick the reel, keywords, messages, link), a phone preview of the DM, a contacts list and a funnel: commented, DM sent, tapped, clicked.

Add a dry-run mode that sends nothing until I add my token, plus /privacy and /data-deletion pages (Meta needs both to publish the app).

Walk me through the Meta app setup step by step and store my keys as secrets, never in the code.

Then paste the fixes

Not in the guide. Each line fixes something the checks found: which Meta setup your app has, the buttons and the webhook they need, the nudge Instagram allows, the follow check, telling people it’s automated, the signing secret, keeping the token alive past 60 days, and staying inside Cloudflare’s free limits and Instagram’s rate limit.

fixes-prompt16 lines
Before you build, apply these fixes:
- Ask me which screen my Meta app shows: "API setup with Instagram login" or "API setup with Unified login". If it's Unified login, build for that instead: graph.facebook.com, the token that screen gives me, the Meta app ID and secret, the instagram_basic, instagram_manage_comments and instagram_manage_messages permissions, my Instagram account ID instead of /me, and webhook payloads in the Facebook Login for Business format. Unified login has no Instagram app secret and no graph.instagram.com token refresh, so then check webhooks with the Meta app secret only, skip the weekly refresh, and show on the admin page when the token expires, if it does.
- Make "Send me the link" and "I'm following" postback buttons. Meta says button messages don't show on Instagram's web version, so end each public reply with "On a computer? Send me a DM". Treat a message typed by someone who commented the keyword like a tap, and answer typed messages in plain text without buttons, with the link and my profile link written out.
- Once my token is saved, subscribe my Instagram account to comments, messages and messaging_postbacks through its /subscribed_apps edge, and show on the admin page whether it's subscribed.
- Send the private reply first, and post the public reply only if the DM went through. Rotate several full-sentence public replies, and never put the keyword in one.
- Match keywords case-insensitively, as whole words, with extra words allowed.
- Follow-ups: nudge only people who tapped "Send me the link" but didn't open the link, within 24 hours of their tap. Never message anyone who didn't respond to the first DM.
- Send the link through a redirect on this Worker, so clicks are counted. Don't count HEAD requests or link-preview crawlers such as facebookexternalhit.
- After "I'm following", check is_user_follow_business again instead of trusting the tap. If Instagram says user consent is required, send the link anyway.
- Add a short line to the first DM saying it's an automated reply.
- Ignore my own comments, the bot's own replies and echoed messages (is_echo), and skip duplicate webhook deliveries.
- Check X-Hub-Signature-256 on the raw request body against both the Meta app secret and the Instagram app secret, in constant time, and accept the webhook if either matches.
- Save each refreshed token in the Durable Object, starting from the secret, and show an alert on the admin page if a refresh fails.
- Use a SQLite-backed Durable Object, keep funnel counters instead of counting rows, index the follow-up due time, and make no more than 45 Instagram API calls per run.
- Queue private replies: Instagram allows 750 an hour.
- Add a /terms page, and protect the admin page with a long random password stored as a secret.
The 6 Meta steps

Claude walks you through these. Here is what each screen looks like

1. Create the app.

Go to developers.facebook.com, Create app, pick the use case Manage messaging & content on Instagram. (Not in the guide: connect the app to a business portfolio when Meta asks: the newer Instagram setup needs one. The business name in the picture is pixelated.)

2. Add your Instagram as a tester.

App roles, Add people, pick Instagram Tester (the last option), type your username. Then accept it on instagram.com: Settings, Apps and websites, Tester invites, Accept. (Not in the guide: on Instagram on the web the path now has one more level: Settings, Website permissions, Apps and websites, Tester Invites. The second picture shows the invite already accepted. On the newer Unified login screen, Add account in step 3 sends this invite for you.)

App roles, Add people, Instagram Tester. (The username is pixelated.)
Instagram, Apps and websites, Tester invites. (Another app’s name is pixelated.)

3. Connect your account and generate a token.

In API setup with Instagram login, Add account, then Generate token. Claude stores it as a secret. (Not in the guide: if your dashboard shows API setup with Unified login instead, Meta has moved new apps there: the token is a different kind and is shown only once, so copy it, and tell Claude which screen you see. On Instagram login the token lasts 60 days, and the weekly refresh in the prompt keeps it going only if the bot saves each new token in its storage, since a Worker can’t change its own secret. On Instagram login, also check that instagram_business_manage_comments is among the permissions: the dashboard adds only the basic and messages ones by default. On Unified login the default setup already includes instagram_manage_comments.)

4. Point the webhook at your bot.

Paste the address and verify token Claude gives you, then switch on comments and messages. (The guide’s prompt names messaging_postbacks, but this step leaves it out: switch it on too, since that’s where the button taps arrive, and without it the buttons do nothing. Not in the guide: then turn on webhooks for your account itself: the fixes prompt has Claude subscribe it through the account’s subscribed_apps call. Meta subscribes new apps to all eight Instagram fields by default, and every event counts against Cloudflare’s free limit, so turn off the ones the bot doesn’t use, such as live_comments and messaging_seen. Your real address looks like bot-name.your-subdomain.workers.dev/webhook.)

5. Publish the app.

Add the privacy and data deletion links first. Instagram sends nothing to an unpublished app. (Not in the guide: Meta may also want an app icon, a category, a contact email and a terms of service link before it publishes, so the fixes prompt asks for a /terms page. Meta’s pages disagree on whether your business must be verified first; the author’s showed as unverified when the app was created. If real comments still don’t arrive once it’s live, Meta’s webhook page says comment notifications need Advanced Access: App Review and Business Verification, which take days.)

6. On your phone:

Instagram, Settings, Messages and story replies, Message controls, Connected tools, Allow access to messages. (Meta gives the same path. Not in the guide: with it off, every message the bot sends fails.)

What you end up with

One page to run every reel

Pick the reel, type the keyword, write the messages, paste the link, press Go Live. The phone preview shows exactly what people will get. (Not in the guide: that’s on a phone. Meta says button messages aren’t available on Instagram’s web version, so people on a computer may not see the DM at all; the fixes prompt’s public replies tell them to DM you instead, and the bot answers them in plain text with the link written out.)

The automation editor. (The reel thumbnails and the account name are pixelated.)
Make it yours

Paste any of these after the first prompt

Reach people who commented before the bot existed. (As the prompt says, it reaches comments up to 7 days old. Not in the guide: Instagram returns comments 50 at a time, without their replies unless asked, and can’t filter by date, so the bot has to page through all of them and skip the old ones itself.)

earlier-comments1 lines
add an "Earlier comments" button: DM everyone who commented the keyword in the last 7 days and has not had the link yet

Lock onto the reel you post next. (Not in the guide: add “published after the automation went live” so it can’t pick an older post that gets a late comment.)

next-post1 lines
add a "next post" option: the automation attaches itself to the first new reel that gets the keyword

Collect emails. (People type the email as a message, which also keeps the conversation open. Before you collect any, add emails and the CSV to your /privacy page, delete them when asked, and get consent before you email anyone. Not in the guide.)

collect-emails1 lines
add an optional step that asks for their email before the link, and a CSV export of everyone who gave one

Record a clean demo. (Not in the guide: most likely what the DEMO badge on the dashboard picture means.)

demo-mode1 lines
add a demo mode switch that masks usernames and emails on every screen
Good to know

The rules Instagram enforces

The guide’s five rules, as it gives them, with the checks beside them and two rules it leaves out. The Checked column is not in the guide.

The guide saysChecked
One private reply per comment, within 7 days of it. After that, you can only message people within 24 hours of their tap or reply.Confirmed. A tap here means a reply or a button that reports back to the bot; opening a link doesn’t count. If someone never answers the first DM, nothing more can be sent to them.
Your own comments are ignored. Test from a second account.Not by Instagram: Meta’s Self Messaging page says commenting on your own post sends the bot a comments webhook, so they’re ignored only if the bot filters them out. Test from a second account, and have the bot skip your own comments and its own messages, as the fixes prompt does.
“Add account” does nothing until the Tester invite is accepted. Accept it on instagram.com first.The right order: your account appears in the token table only after you accept. On the newer Unified login screen, Add account is what sends the invite.
Use the Instagram app secret, not the Meta app secret. They sit on different pages and only one verifies the webhooks.Unconfirmed. The two secrets do sit on different pages, but Meta’s webhook page says only “your app’s App Secret”, and its sample app copies the one from App settings, Basic: the Meta one. The fixes prompt checks both.
Liking their comment needs a Facebook login, not the Instagram login this bot uses. Skip it to start.Wrong: no Instagram API can like a comment, whichever login you use. Skip it for good.
Not in the guide: Instagram’s rate limit.Instagram allows 750 private replies an hour per account, so a viral reel’s DMs queue for hours. Each still has to go out within 7 days of its comment.
Not in the guide: Meta’s messaging rules.Say it’s automated where the law requires it, answer people who write back, and stop at once when someone asks. Meta’s spam rules ban making people like or share before they get what was promised; a follow gate isn’t named, but it sits close to that line.
i
Why I built it

“Every person who comments is someone asking to hear from you. You should own that list, and it should not cost more the better your reel does.” One prompt, one afternoon, $0 a month. (The guide’s author. Not in the guide: what you own is a record of who commented, not a list you can message again: Instagram lets the bot write only within 24 hours of the person writing or tapping. And $0 is the running cost; the build needs a paid Claude plan or API credits.)