PromptFree

A free comment-to-DM bot

Build Your Own ManyChat With Claude

The prompt that builds a free comment-to-DM bot on Instagram's official API, plus every click to switch it on.

How it works

Someone comments your keyword on a reel and gets your link in their DMs, 24/7, with your laptop closed. Claude writes all of it. You only do the clicks inside your own accounts.

  • Replies to the comment A short public reply, picked at random from lines you write.
  • Sends a DM A quick message with a button, then your link once they tap it.
  • Checks they follow you If they don’t, it asks them to follow first.
  • Sends one reminder If they never open the link, it nudges them once.
  • Works before you post Set a rule for your next reel, trial reels included, and it attaches itself when the reel goes up.
  • Shows you what happened A dashboard with every comment, DM, tap and click.

What you need

  • Claude Code The Code tab in the Claude desktop app, on any paid Claude plan.
  • An Instagram account Set to Business or Creator, and public.
  • Two free accounts A Meta developer account and a Cloudflare account.
  • A second Instagram account To test with, since you can’t trigger your own bot.
  • About an hour Most of it is clicking through Meta’s settings.

1. Build the bot

Paste this once. Claude writes the code, tests it without sending anything, then walks you through the setup.

  1. Open Claude Code Open the Claude desktop app and switch to the Code tab.
  2. Make a folder Create a folder called Comment DM in your home folder and start a new session in it.
  3. Paste and wait Paste the prompt below. You are done with this step when Claude shows you a dry run of the full flow.

Paste this into Claude Code

Build me my own comment-to-DM bot for Instagram, a free replacement for ManyChat. I'm not technical, so write all the code yourself, explain each step in one plain sentence, and tell me exactly what to click whenever something has to be done in my own accounts.

HOW IT RUNS
Use the official Instagram API with Instagram Login (graph.instagram.com). No scraping and no logging in with my password.
Host it on Cloudflare Workers on the free plan, with Cloudflare D1 for storage. Never put a card on file. If anything would cost money, stop and tell me the price first.
Stay inside the free limits (100,000 requests and 100,000 database writes a day, 10 ms of CPU per request): answer Meta's webhooks fast and send DMs in the background with ctx.waitUntil. Show me on the dashboard how close I am to those limits.

THE FLOW
1. Someone comments a keyword on a reel I've picked. Match it anywhere in the comment, ignore capitals, and treat a keyword with several words as a phrase. If a rule has no keyword, any comment counts. The same keyword sent to me as a DM counts too.
2. Reply under their comment with one line picked at random from a list I write. Let me turn this off.
3. Send a private reply with a short message and one button that says Send me the link. On by default.
4. When they tap it, check whether they follow me. If not, ask them to follow with an I'm following button. Ask twice at most, then send the link anyway, because Instagram's follow status can lag.
5. Send the link as one to three buttons, each with 20 characters of text at most.
6. If they haven't opened the link after 60 minutes, send one reminder, only while Instagram's 24-hour messaging window is still open. Let me change the time or turn it off.
7. If someone DMs me the keyword, send the link straight away.
Send every link through the bot's own redirect at /go/<signed token>, so I can see who clicked.

REELS I HAVEN'T POSTED YET
Let me set up a rule for my next post. It attaches to the first post published after I make the rule that has the keyword in its caption. Trial reels don't always show up in the post list, so if a keyword comment lands on a post nothing is watching, attach the waiting rule there.

INSTAGRAM'S RULES
One private reply per comment, and only within 7 days of the comment. Only message inside the 24-hour window, with a 10-minute safety margin. Queue and retry anything Instagram rate-limits, never drop it. Handle every comment exactly once, even when Meta sends the same webhook twice. Ignore my own comments and any comment from before a rule was turned on. If buttons get rejected, send the link as plain text.

WHAT TO BUILD
A webhook at POST /api/dms/webhook for comments, messages and messaging_postbacks. Check Meta's signature with my app secret, answer the verify challenge, and ignore read receipts, reactions and edits.
A Cloudflare cron every 5 minutes that sends due reminders, retries failures, attaches next-post rules and catches keyword comments whose webhook never arrived.
A password-protected dashboard with my rules and an editor for every setting, a funnel for each rule (comments, DMs, taps, links sent, clicks), an activity feed that says in plain words why anything was skipped or failed, and a setup panel showing the webhook URL and verify token to paste into Meta.
A command to add a rule without the dashboard, for example: npm run dms:next -- --keyword guide --link "Get the guide=https://..."
A dry-run mode (DMS_DRY_RUN=1) that writes messages to a local outbox instead of sending them, plus a simulator that fires signed fake webhooks through every step.
Public privacy policy and data deletion pages, which Meta needs before the app can go Live.
Store my Instagram token and app secret as Worker secrets with wrangler secret put. Never print them or commit them.

SETUP
Walk me through these one at a time: making my Instagram professional and public, creating the Meta developer app, deploying to Cloudflare, connecting my account and the webhooks, going Live, allowing message access in the Instagram app, and testing from a second account.

FINISH
When the code is done, run the dry run and show me the whole flow working, then help me set up my first rule.

If a step fails

That didn't work. Read the error, tell me in one sentence what went wrong, fix it, then run the dry run again.

2. Switch it on

These are the clicks only you can do. Claude will ask for each one in order, but here they are so nothing surprises you.

  1. Make Instagram professional In the Instagram app, switch to a Business or Creator account and make sure it is public. Meta only sends comment alerts for public accounts.
  2. Create the Meta app Go to developers.facebook.com/apps, create an app and pick the use case Manage messaging & content on Instagram. Add the permissions instagram_business_manage_comments and instagram_business_manage_messages.
  3. Put it online Claude deploys it to your free Cloudflare account. The dashboard then shows a webhook address and a verify token.
  4. Connect Instagram In the Meta app, open Instagram, then API setup with Instagram login. Add your account and generate a token. Under Configure webhooks, paste the address and verify token, then subscribe to comments, messages and messaging_postbacks.
  5. Go Live In App settings, then Basic, paste the privacy policy and data deletion links from your bot, then switch the app to Live. Until it is Live, Instagram sends nothing.
  6. Allow message access On your phone, open Instagram, then Settings, Messages and story replies, Message controls, Connected tools, and turn on Allow access to messages.

Paste this once the token is generated

I've generated my Instagram token and found my app secret in App settings, Basic. Save both as Worker secrets without showing them on screen, then check that Meta has verified the webhook and that comments, messages and messaging_postbacks are subscribed.

If comments aren’t coming through

Comments aren't reaching the bot. Check the app is Live, the account is public, message access is on in the Instagram app, and the comments permission has the access level it needs. If Meta wants Advanced Access, help me write the app review request.

3. Set up a reel before you post it

Do this before every video with a keyword. The rule waits and attaches to the reel as soon as it goes up.

Paste this before you post

Set up a rule for my next post: keyword GUIDE, public replies "Check your DMs" and "Just sent it, check your message requests", DM text "Here you go", one button "Get the guide" linking to [your link], follow check on, reminder after 60 minutes.

Then test it

Run that rule in dry run and show me exactly what someone who comments guide would see, step by step.

The real test Post the reel, comment the keyword from your second account, and check you get the public reply, the DM with the button, and the link after you tap it.

What breaks it

None of these show a clear error, so check them first when something goes quiet.

  • The app is still in Development Instagram sends nothing until the Meta app is Live.
  • Message access is off Without Allow access to messages in the Instagram app, the bot can’t send DMs from your account.
  • The account is private or personal Switch it to Business or Creator and make it public.
  • ManyChat is still on the same post People get two DMs. Turn ManyChat off for a post before you turn the bot on for it.
  • Testing from your own account The bot ignores you. Use a second account.
  • A post goes viral Instagram limits how many private replies you can send an hour. The bot queues the rest and sends them later, so nobody gets skipped.

What it costs

  • Instagram API and the Meta app Free.
  • Cloudflare The free plan covers it. If you ever hit the daily limit, it pauses until the next day instead of charging you.
  • Claude A paid plan to build it. Nothing after that.
  • ManyChat, for comparison The paid plans charge monthly and go up as your contact list grows.
More free guides

buildwithbyron.com/video

One prompt, 10 animation styles

The exact prompt behind the fox-in-a-balloon reel. Change one word and Claude or ChatGPT draws the same scene in a completely different style.

ShowcaseClaudeChatGPT29 Nov 2026

buildwithbyron.com/agency-connectors

3 AI Connectors for Agency Owners

How to connect Meta Ads, Fireflies and Gamma to Claude or ChatGPT, with the best prompt for each one and one prompt that uses all three.

GuideClaudeChatGPTClaude Code28 Nov 2026

buildwithbyron.com/agency-principles

20 Principles for Running an AI Agency

Every principle from the reel, what it means, the first thing to do about it, and a prompt to do it with Claude or ChatGPT.

GuideClaudeChatGPT28 Nov 2026

See every guide →