I had Claude rebuild ManyChat for me. People comment a keyword on my reel and get my link in a DM, 24/7, through Meta's official Instagram API. Here's how to build yours, free to run.
Step 1: Copy the prompt
This is the prompt for the part most people use ManyChat for: comment-to-DM on Instagram.
Comment-to-DM bot
Public reply, a DM with a button, follow check, one reminder, click tracking and βnext postβ automations.
Show the whole promptHide the prompt
# Build my own ManyChat (comment-to-DM for Instagram)
Build me my own comment-to-DM bot for Instagram to replace ManyChat. Someone comments a keyword on one of my reels, gets a public reply under their comment and a DM with my link, without me doing anything. It runs 24/7 on Cloudflare's free plan, so it keeps working when my laptop is off and costs me nothing to run.
Use Meta's official Instagram API ("Instagram API with Instagram Login", graph.instagram.com) so my account is never at risk. Build it as a Cloudflare Worker (Hono is fine) on the Workers free plan, with records stored in Cloudflare D1. Walk me through every setup step I have to do myself in Meta's developer site, Cloudflare and the Instagram app.
## Keep it free
- Use only free plans. Nothing that needs a paid plan or a card on file.
- Stay inside Cloudflare's free limits: 100,000 requests a day, 10 ms of CPU per request, 100,000 database writes a day. Answer Meta's webhook fast and send the DMs with `ctx.waitUntil`.
- Show me on the dashboard how close I am to those limits.
- If anything you'd add could ever cost money, stop and tell me the price first.
## The flow
1. **Trigger.** A comment on a watched post that contains one of the automation's keywords. Match case-insensitively, as a whole word anywhere in the comment ("send me the GUIDE please" counts). Multi-word keywords match as a phrase. No keywords means any comment triggers it. Someone sending the keyword to me as a DM triggers the same flow.
2. **Public reply.** Reply under their comment with one line picked at random from a list I set (for example "Sent you a DM π©", "In your DMs π"), so the replies don't all look identical. This can be switched off.
3. **Opening DM (optional, on by default).** A private reply to the comment with a short message and one button ("Send me the link"). Tapping it opens Instagram's 24-hour messaging window, which the next two steps need.
4. **Follow check (optional).** When they tap, check whether they follow me. If not, ask them to follow first with an "I'm following" button. Ask at most twice; on the second tap send the link anyway, because Instagram can lag behind a new follow.
5. **Link DM.** A message with one to three link buttons (button text 20 characters max, Instagram's limit). With the opening DM switched off, this is the private reply itself and steps 4 and 6 are skipped.
6. **One nudge.** If none of the links has been opened after X minutes (default 60, 0 = off), send one follow-up with the link again, only while the 24-hour window is still open.
7. **Keyword sent as a DM.** The window is already open, so skip the button and send the link straight away.
## Tracked links
Every link button goes through my own redirect (`/go/<signed token>`) that records the click, then forwards to the real URL. Sign the token so nobody can forge clicks.
## "Next post" automations
Besides watching a post that's already up, an automation can wait for my **next post**. It connects itself to the first post published after it was set up whose caption mentions the keyword (any post if it has no keyword). Several can wait at once, oldest first. Trial reels may not show up in the media list, so a waiting automation also connects when the first keyword comment arrives on a post nothing is watching yet.
## Instagram's rules it must work within
- One private reply per comment, sent within 7 days of the comment.
- After the person taps a button or messages me, I can message them for 24 hours. Keep a 10-minute margin before the cut-off.
- About 750 private replies an hour. Anything over the limit is queued and retried, never dropped.
- Handle each comment exactly once: Meta retries webhooks, and the catch-up job may see the same comment.
- Ignore my own comments and replies.
- Leave alone comments made before an automation was switched on (ManyChat or I may already have answered them).
- If an account can't receive buttons in a private reply, fall back to plain text with the link in it.
## Pieces to build
- **Webhook** `POST /api/dms/webhook` for comments, messages and button taps (`messaging_postbacks`). Verify Meta's signature with the app secret, and answer the verification challenge. Ignore "seen" receipts, reactions and edits.
- **Cron** `/api/cron/dms` every 5 minutes (a Cloudflare Cron Trigger, `*/5 * * * *`): send due nudges, retry failures, connect waiting "next post" automations, and catch up on keyword comments whose webhook never arrived.
- **Dashboard** page:
- my automations, with an editor for every setting above;
- a funnel per automation: Comments β DMs β Taps β Links β Clicks;
- recent activity, showing each comment and whether it was sent, skipped or failed, with the reason in plain words;
- a Setup panel showing the webhook URL and verify token to paste into Meta.
- **Command line** so Claude can set one up for me without opening the page:
`npm run dms:next -- --keyword guide --link "Get the guide=https://β¦" --message "Here you go π"`.
Options: `--direct` (no opening DM), `--follow`, `--no-reply`, `--nudge <minutes>`, `--list`, `--delete <id>`.
- **Dry-run mode** (`DMS_DRY_RUN=1`) that writes would-be messages to a local outbox instead of sending them, plus a simulator script that fires signed fake webhooks through every step. Test the whole flow this way before anything goes live.
- **Privacy policy and data-deletion page** (Meta requires both before the app can go Live).
- Password-protect the dashboard and the automation API. Only the webhook and the `/go/` redirect are public.
- Keep the Instagram token and the app secret as Worker secrets (`wrangler secret put`). Never print them or commit them.
## Setup steps to walk me through
1. Create a Meta developer app with the use case "Manage messaging & content on Instagram". Add the permissions `instagram_business_manage_comments` and `instagram_business_manage_messages`.
2. Instagram β API setup with Instagram login: connect my account and generate the token. Configure webhooks with the callback URL and verify token from the dashboard, and subscribe to `comments`, `messages` and `messaging_postbacks`.
3. App settings β Basic: add the privacy policy and data-deletion URLs, then switch the app to Live.
4. On my phone: Instagram β Settings β Messages and story replies β Message controls β Connected tools β turn on **Allow access to messages**.
5. Make a free Cloudflare account, deploy with Wrangler and set the secrets.
6. Test with a second account on a reel nothing else is watching. Never run ManyChat and this bot on the same post, or people get two DMs.
When it's done, show me a dry run of the full flow, then set up my first automation with the command line.Step 2: Paste it into Claude Code
Open the Claude desktop app, go to the Code tab and paste the prompt. Claude Code needs a paid Claude plan.
Claude writes all the code and tests the whole flow in a dry run first, where nothing is really sent. It walks you through steps 3 to 9 as it goes. They're the clicks only you can make, because they're in your own Meta and Instagram accounts.
Done when Claude shows you the dry run working.
Step 3: Make your Instagram professional and public
The bot needs a professional Instagram account (Business or Creator) that's public. Meta only sends comment alerts for public accounts.
You can switch both in the Instagram app's settings.
Step 4: Create a Meta developer app
The app is free. It's the key that lets your bot talk to Instagram.
- Go to Meta for Developers and create an app.
- Pick the use case Manage messaging & content on Instagram.
- Add
instagram_business_manage_comments(read and reply to comments). - Add
instagram_business_manage_messages(send DMs).
Step 5: Put the bot online
Your bot needs a home online so it keeps running when your laptop is shut.
Cloudflare (free). The prompt puts your bot on Cloudflare's free plan. It handles 100,000 requests a day, plenty for most accounts. If you ever hit that, it pauses until the next day. It never charges you.
Vercel. This is what I use. You can run the bot on Vercel's free Hobby plan, which is for personal accounts and only sends reminders once a day. I'm on Vercel Pro ($20 a month) because I host all my projects there, so the bot costs me nothing extra. To use Vercel, tell Claude "host it on Vercel instead of Cloudflare".
Done when your bot's dashboard shows a webhook address and a verify token.
Step 6: Connect Instagram
This tells Instagram to ping your bot every time someone comments.
Go to
Your Meta appInstagramAPI setup with Instagram login
- Add your Instagram account and generate its access token. Claude saves it with your app secret where your bot is hosted (from App settings β Basic). Don't paste them anywhere else.
- Under Configure webhooks, paste the webhook address and verify token from your bot's dashboard.
- Subscribe to
comments,messagesandmessaging_postbacks(a tap on a button in a DM).
Done when Meta saves your webhook and all three are subscribed.
Step 7: Add a privacy page, then go Live
Meta won't switch your app on without a privacy policy and a page on how people can ask for their data to be deleted. The prompt has Claude build both into the bot.
Go to
Your Meta appApp settingsBasic
- Paste the privacy policy and data-deletion addresses.
- Switch the app to Live. Until then, Instagram sends your bot nothing.
Comments still not coming through? Check the access level on the comments permission. Meta can ask for Advanced Access, which means sending the app for review. Claude can write the request with you.
Step 8: Allow access to your messages
On your phone, turn on Allow access to messages. Without it, the bot can't send DMs from your account.
Go to
Instagram appSettingsMessages and story repliesMessage controlsConnected tools
Step 9: Test it with a second account
Post a test reel (or pick one nothing else is watching). Comment your keyword from a second Instagram account.
- The public reply shows under the comment.
- The DM arrives with its button.
- Tapping the button gets you the link.
Moving from ManyChat? Switch it off for a post before you switch yours on. If both run on the same post, people get two DMs.
Done when all three arrive on your second account.
What it costs
Running your own bot can cost nothing. The Instagram API, the Meta app and Cloudflare's free plan are all free, with no contact limits. Vercel Pro is $20 a month if you'd rather host it there. The one cost is building it: Claude Code comes with a paid Claude plan.
ManyChat charges by contacts, meaning the people you message:
| Plan | Monthly | Yearly | Contacts |
|---|---|---|---|
| Free | $0 | $0 | 25 |
| Essential | $17 | $14 | 250 |
| Pro | $39 | $29 | 2,500 |
| Business | $99 | $69 | 7,500 |
| Advanced | $199 | $139 | 25,000 |
Prices per month from ManyChat's pricing page on 27 November 2026. Yearly is the monthly price when you pay for a year.
So your own bot beats every ManyChat plan, including Free, which stops at 25 contacts.
Want every ManyChat feature?
This is the big prompt from the video. It asks for everything on ManyChat's top plan: an inbox, AI replies, WhatsApp, Messenger, broadcasts and more. Claude builds it in 10 phases and shows you each one before starting the next. Phase 1 alone gives you a working Instagram bot.
A few features, like messaging new followers and TikTok DMs, are only open to Meta's or TikTok's approved partners. Claude tells you which ones it can't switch on.
It's set up to stay free too. A few features cost money wherever you run them: AI replies, text messages and WhatsApp promo messages. Claude builds those switched off and tells you the price before you turn one on.
Every ManyChat feature
10 phases, from Instagram automations to analytics. A much bigger build.
Show the whole promptHide the prompt
# Build my own ManyChat, with every feature of its top plan
Build me my own DM automation platform with every feature ManyChat sells on its most expensive plan (Advanced, $199 a month). The full checklist is at the bottom of this prompt. It's for my own accounts. I want:
- no contact limits and no per-contact overage fees;
- unlimited automations, users and channels;
- no branding.
Give it its own name and design: don't copy ManyChat's name, logo or look.
**How to build it:**
- Keep it free to run. Build it on Cloudflare's free plan: Workers for the app, D1 for the data, R2 for files, and Cron Triggers for anything scheduled, so it runs 24/7 when my laptop is off. Stay inside the free limits and show me how close I am on the status page.
- Nothing that needs a paid plan or a card on file. A few features cost money wherever they run (Claude API calls, SMS, WhatsApp template messages). Build those switched off, label them "costs money", and tell me the price before I switch one on.
- Use each platform's official API only (Meta's Instagram, Messenger and WhatsApp Cloud APIs, TikTok's, Telegram's Bot API), so my accounts are never at risk. No scraping, no unofficial APIs.
- If a platform doesn't let my app do something (some features are only open to approved Meta or TikTok partners), tell me plainly and mark it in the app instead of faking it. Where Meta's app review would unlock it, help me apply.
Build it in the phases below. Finish each phase with a dry run (messages go to a local outbox, and a simulator fires signed fake webhooks through every step) and show me before starting the next one. Walk me through every setup step I have to do myself in each platform's developer site and app.
## Phase 1: Instagram automations
**Triggers.** Each one can start any automation:
- **Comment to DM:** a keyword comment on a post or reel. Reply publicly with a random line from a list, and send the DM as a private reply. It can watch one post, all posts, or my **next post**: it connects itself to the next post whose caption has the keyword, and to trial reels on their first comment.
- **Keywords in DMs:** exact word, phrase, or "contains", with a priority order.
- **Story replies:** reactions and replies to my stories, with or without a keyword.
- **Story mentions:** someone mentions me in their story.
- **Live to DM:** comments during an Instagram Live.
- **Follow to DM:** welcome new followers.
- **Conversation starters:** up to four tappable topics when someone opens a chat with me.
- **Default reply:** when nothing else matches, at most once a day per person.
- **Referral links:** `ig.me/m/<handle>?ref=<code>` links, each with a QR code and a website button snippet.
- **Meta ads:** conversations started from click-to-Instagram-DM ads and boosted posts, recording which ad they came from.
**What a message can send:** text, images, PDFs and other files, video, link buttons, quick replies, and cards or carousels.
**Instagram's rules:**
- one private reply per comment, within 7 days;
- a 24-hour window after the person messages or taps, with a 10-minute safety margin;
- the hourly send limit: queue and retry, never drop;
- each comment handled once;
- my own comments ignored;
- comments from before an automation was switched on left alone.
## Phase 2: The automation builder
- **A visual canvas.** Steps are boxes joined by arrows. Every automation can be paused, copied and versioned.
- **Templates.** At least 20 ready-made ones to start from: lead magnet, giveaway, link in DMs, follow gate, email capture, booking, product drop, FAQ. I can save my own.
- **Data collection.** Ask for an email, phone number, number, date, choice or free text. Check the format and ask again if it's wrong. Save the answer to a custom field.
- **Follower status check.** Check whether they follow me and prompt them to follow before continuing. Ask at most twice, then continue anyway.
- **Tags and custom fields.** Unlimited, created from anywhere.
- **Conditions.** Route people by:
- their answers, tags and fields;
- whether they follow me;
- whether they clicked a link;
- where they came from;
- time of day;
- data from an outside request.
- **Actions:**
- add or remove a tag, set a field;
- notify a teammate;
- assign the conversation;
- pause automation for that person;
- start another automation;
- call an outside API (an "external request" step whose response can be saved to fields);
- send to a webhook.
- **Smart delays.** Wait minutes, hours or until a time, but only send inside each platform's messaging window.
- **Randomizer.** Split people between versions by percentage, and show which one wins on clicks or conversions.
- **Tracked links.** Every link goes through my own signed redirect that counts the click.
- **Test mode.** Run any automation against my own test account only.
## Phase 3: Contacts
- **Profiles.** One per person across every channel. It holds name, username, picture, channels, source, tags, fields, every automation they went through, every link clicked, and the full conversation history.
- **Merging.** The same person on two channels can be merged into one contact.
- **Segments.** Saved filters, like "tagged GUIDE, clicked nothing, last 7 days".
- **Import and export.** CSV in both directions.
- **Opt-out.** STOP or "unsubscribe" ends all automated messages to that person.
- **Data deletion.** Delete a person's data on request, plus the public privacy and data-deletion pages each platform requires.
## Phase 4: AI
Use the Claude API, with my key as a Cloudflare secret. It's pay as you go, so build this phase switched off until I add a key.
- **Knowledge.** I upload business details, FAQs and links (my guide pages). The AI answers only from these.
- **AI Replies.** It answers FAQs in my voice, short, with the right link. When it isn't sure, it hands the chat to a human instead of guessing.
- **AI Comments.** It replies to positive comments on my posts and moves the conversation into DMs. It skips negative, spam or sensitive comments and flags them for me.
- **AI Step.** A builder step where I give instructions ("qualify this lead: budget, timeline, what they need"). The AI holds that part of the conversation and saves what it learns to fields and tags.
- **AI Goals.** I set a goal for a conversation (a click, a follow, an email). The AI steers toward it and the result is tracked.
- **Intent recognition.** Start automations from what people mean, not exact keywords, with a confidence threshold and a fallback.
- **Guardrails.** It never promises prices or results, never gives financial, medical or legal advice, and never claims to be me when asked if it's a bot. Every AI message is logged for review.
## Phase 5: Inbox and team
- **One inbox** for every connected channel: search, filters and the full history. Each message is marked as sent by the bot, the AI or a person.
- **Manual replies.** Replying by hand pauses automation for that person for a set time.
- **Favorites** label for important conversations.
- **Reminders and scheduled messages.** Snooze a conversation until a time; schedule a reply inside the messaging window.
- **Auto-assignment.** Assign conversations to me or a teammate by rules (round robin, by channel, by tag).
- **Custom labels.** Labels with my own rules that sort incoming messages into them automatically.
- **The messaging-window clock** on every chat. Where a platform allows it (Meta's human agent tag, once approved), allow manual replies for longer.
- **Users and roles:** unlimited users, with owner, admin, editor, inbox-only and read-only roles, each signing in with a password or a magic link.
- **Mobile.** An installable mobile web app (PWA) with push notifications for new chats, so I can manage the inbox on my phone.
## Phase 6: More channels
Each channel connects with the same builder, contacts, AI and inbox:
- **Facebook Messenger:** page messages, comment to DM on Facebook posts, ref links (`m.me`), and click-to-Messenger ads.
- **WhatsApp:** through the WhatsApp Cloud API, with click-to-WhatsApp ads. Pre-approved template messages for promotions, order updates and reminders: write them, submit them to Meta, and track whether they're approved. Meta charges for template messages, so show the price and leave them off until I switch them on.
- **TikTok:** DMs and TikTok Messaging Ads, if TikTok's business messaging API gives my app access. If it's partner-only, tell me and leave it ready to switch on.
- **Telegram:** a bot through the Telegram Bot API.
- **SMS:** through Twilio, only to people who gave their number and agreed. Twilio charges per text, so leave it off until I switch it on.
- **Email:** through Resend from my own domain, with double opt-in and an unsubscribe link in every email.
## Phase 7: Broadcasts
- **Send to a segment** on Messenger, WhatsApp (templates), Telegram, SMS and email. Instagram and TikTok don't allow broadcasts, the same as on ManyChat.
- **Check before sending.** Show who will receive it and who is excluded (outside the window, opted out) before I press send.
- **Schedule** broadcasts for later.
- **Track results:** sent, delivered, read where the platform reports it, clicked and converted.
## Phase 8: Integrations
- **Multitool:** outgoing webhooks on every event (new contact, tag added, field set, link clicked, conversation assigned), incoming webhooks that start an automation for a contact, and an API with keys, so Zapier and Make can connect.
- **AI:** the Claude API built in; an "AI request" step for custom prompts.
- **CRM:** sync contacts to HubSpot, or to a Google Sheet or Notion database as a simple CRM.
- **SMS and email platforms:** push leads to Kit, Mailchimp, Beehiiv or Klaviyo (whichever I pick).
- **Commerce:** Shopify products in carousels, plus order status messages.
- **Payments:** Stripe payment links and checkout in DMs. A successful payment tags the contact as a buyer and starts a follow-up.
## Phase 9: Analytics
- **Automation and engagement insights:**
- per automation: triggered β messaged β tapped β clicked β converted, with rates between each step;
- per message: button click-through;
- randomizer results.
- **Per post:** which reels and posts bring the most DMs, clicks, leads and sales.
- **Top fans and followers:** my most engaged people (comments, replies, clicks, purchases) as a ranked list I can tag or message.
- **Inbox team analytics:** first-response time, conversations handled, open versus closed, per teammate.
- **Recommendations:** weekly suggestions from my own numbers (for example "this automation's button gets half the clicks of your others: test a new label"), emailed to me with the week's report.
## Phase 10: Running it safely
- **Access.** Every page and the API sit behind a login. Only the webhooks, the link redirect and the privacy pages are public.
- **Webhooks.** Each platform's signature is checked on every request.
- **Secrets.** Tokens and keys live in Cloudflare secrets. Never print or commit them.
- **Status page:**
- webhook health per channel and the last event received;
- queued and failed messages;
- token expiry dates (with automatic refresh where the platform allows it);
- rate limits used.
- **Command line,** so Claude can manage it for me: create, list, pause and delete automations; set up a "next post" automation; add tags; export contacts; send a broadcast.
- **Moving from ManyChat.** Move my ManyChat automations over one at a time from exports or screenshots I give you. Never run both on the same post, or people get two DMs.
## Checklist: ManyChat's comparison table, every row
Before you call it done, tick each of these and show me where it is in the app:
- **Channels:** Instagram, Facebook Messenger, TikTok, Telegram, WhatsApp, SMS, Email.
- **Automations:**
- builder with templates;
- comment to DM;
- follow to DM;
- story reply;
- conversation starters;
- story mention reply;
- default reply;
- Live to DM;
- auto-send links, PDFs and images;
- referral links (link, QR code, website button);
- keywords;
- data collection;
- follower status check;
- tags;
- actions and conditions;
- no branding;
- randomizer;
- Instagram DMs from Meta ads and boosted posts;
- Messenger from Meta ads;
- TikTok Messaging Ads;
- WhatsApp from Meta ads.
- **AI:** AI Goals, AI Comments, AI Replies, Knowledge, AI Step, intention recognition.
- **Inbox:**
- one inbox for all channels;
- mobile;
- favorites;
- reminders and scheduled messages;
- auto-assignment;
- custom labels;
- unlimited seats and users.
- **Broadcast:** broadcasts (not Instagram or TikTok), and WhatsApp pre-approved messages.
- **Integrations:** multitool, AI, CRM, SMS and email platforms, commerce, payments.
- **Analytics:** automation and engagement insights, top fans and followers, inbox team analytics, recommendations.Questions
Do I need to know how to code?
No. Claude Code writes and tests all the code. You do the setup clicks in Meta, your host and Instagram, and Claude walks you through each one.
Will Instagram ban my account?
Your bot uses Meta's official Instagram API, the approved way to automate comments and DMs, and the same route ManyChat uses. Tools that log in with your password or click around the app pretending to be you are the ones that get accounts flagged. No tool can promise your account is safe, though. Only message people who commented or messaged you first, and keep your DMs useful.
Is there a free ManyChat alternative?
Yes, build your own with the prompts above. The Instagram API, the Meta app and Cloudflare's free plan cost nothing, so it's free to run with no contact limits. You need a paid Claude plan to build it.
Does it work while my computer is off?
Yes. It runs online on Cloudflare or Vercel, so it answers comments 24/7 whether your laptop is open or not.
Can I keep ManyChat while I test it?
Yes, on different posts. Never run both on the same post, or people get two DMs.
What if a video gets thousands of comments?
Instagram allows about 750 private replies an hour per account. Your bot queues anything over that and sends it later, so a busy post just takes a little longer.
Can I set up the DM before a video goes live?
Yes. A "next post" automation waits for your next post with the keyword in the caption and connects itself when it goes live. I set mine up from Claude with one command before each video, trial reels included. For the editing side, see how I edit videos with Claude Code.

