00 / Comment a word, get the link
Someone comments a word on your reel, or DMs it to you, and your link lands in their DMs. Most people rent that feature and pay for every person it talks to. This is the one we built for ourselves, and you can download it.
It runs in your own Cloudflare and Meta accounts. The code is free under the MIT license. What follows is what it does, what you need, the six Meta steps, how to test it without messaging anyone by mistake, and the rules Instagram enforces.
01 / What it does
It has a small admin page behind a password: your keywords, the messages, a log of everything sent, the people who asked and what they answered.
02 / Before you start
| Item | What | Note |
|---|---|---|
| A professional account, creator or business | Instagram only lets professional accounts use its messaging API | |
| Meta | A Meta developer account | Free. This is where the app that connects to Instagram lives |
| Cloudflare | A Cloudflare account | The bot runs on Workers. The free plan has daily limits, so check them against your volume |
| A computer | Node.js and a terminal | Or an AI that can run commands for you. See the end of section 03 |
| A second account | Another Instagram account you control | For testing. The bot ignores your own comments, so you cannot test it from the main account |
03 / Get it running
Download the ZIP and unzip it, or clone the repository. Open a terminal in that folder.
Open wrangler.jsonc and set your Instagram handle, your business name and a contact email. The last two appear on the privacy page Meta asks for.
Dry run is on by default. It logs what it would send and sends nothing.
npm install npx wrangler login npx wrangler secret put ADMIN_PASSWORD npx wrangler secret put VERIFY_TOKEN npx wrangler deploy
The admin password is yours to pick. The verify token is any random string. You will paste it into Meta in step 4 of the next section. The last command prints your bot’s address.
Go to your bot’s address followed by /admin and sign in. The Setup tab lists the three addresses Meta needs: the webhook, the privacy page and the data deletion page.
Paste this into an AI that can run commands on your computer, such as Claude Code. It can do the Cloudflare half. The Meta half needs you, because it is your Instagram account.
https://github.com/Camby-Ai/dm-bot Set this up on my Cloudflare account. Read the README first. Keep DRY_RUN on. Ask me before you create an account, accept any terms or store a secret. Stop when it is deployed and tell me the three addresses Meta needs.
04 / The Meta side
At developers.facebook.com, create an app and pick the use case Manage messaging & content on Instagram.
In the app: App roles, Add people, Instagram Tester, and type your handle. Then on instagram.com: Settings, Apps and websites, Tester invites, Accept.
Under API setup with Instagram login, add your account and generate a token. Copy the account ID shown beside it into IG_USER_ID in wrangler.jsonc, then store the token and the app secret.
npx wrangler secret put IG_ACCESS_TOKEN npx wrangler secret put IG_APP_SECRET npx wrangler deploy
The app secret is the Instagram app secret on the Instagram login page, not the Meta app secret. The bot uses it to check that each message really came from Meta.
Callback URL: your bot’s address followed by /webhook. Verify token: the string you stored earlier. Then turn on comments, messages and messaging_postbacks.
Paste in the privacy and data deletion addresses from the Setup tab. Instagram sends nothing to an unpublished app.
Instagram, Settings, Messages and story replies, Message controls, Connected tools, Allow access to messages.
These are the names we clicked in November 2026. If a screen looks different, paste what you see into your AI with the step you are on and let it find the new name.
05 / Go live safely
A keyword that is a common word will fire on ordinary messages. Match it only when the whole message is that word, or choose a word people do not use by accident.
06 / Be honest about it
| Rule | What it means | What the bot does |
|---|---|---|
| One reply per comment | You get one private reply to a comment, within 7 days of it | It uses that reply for the question |
| The 24 hour window | After that you can only message someone within 24 hours of their last message or tap | It stops and leaves the rest to you |
| The 60 minute follow-up | Someone who commented and never answered may be outside what Instagram allows | It tries, logs the error and marks them expired. We have not tested this path on comments |
| Tap answers | Instagram may refuse buttons on the first reply to a comment | It sends the question again as plain text. Untested |
| Two kinds of token | An Instagram login token, or a system-user token from Meta Business settings | It handles both. Ours runs on the second. We have not run the first one live |
| Your own comments | The bot never reacts to your own account | So test from a second account |
Check these against Meta’s documentation before you rely on them. Meta changes its rules, and a bot that breaks them can lose its access.
This is a tool for sending people something they asked for. It is not a way to message people who did not ask.
07 / If you get stuck
The code is the short part. The hour goes to Meta: the app, the tester invite, the token, the webhook and the phone setting, in that order.
If a step fails, paste the exact error into your AI and let it patch the step. If you would rather have it set up with you, that is a conversation I am happy to have.
Tell me what you want your first keyword to send. I will tell you if this fits.