# 03 · Comment to DM (a ManyChat replacement)

Someone comments a keyword on your post, receives a DM with a button, taps it and gets the link. Their email
and Instagram handle land in your email tool.

**For your AI:** walk me through building this one step at a time. Ask how I use Instagram and which email
tool I use first. Don't move on until the current step works.

## First, check

- Do you pay for ManyChat or a tool like it? How many automations do you actually run?
- Do you post with a comment call to action at least a few times a month? If not, keep it simple and reply by hand.

## What you need

- An Instagram professional account (business or creator).
- A Meta developer app with the Instagram API (Instagram login), messaging and comment permissions.
  Standard Access is enough to start if it only serves your own account.
- An email tool with an API (MailerLite, ConvertKit or similar).
- A Cloudflare Worker with D1 (a small database) and a timer that runs every minute.
  The $5 a month Workers plan covers this and other small tools.

## Where it runs

Online, on Cloudflare. It has to: it checks for comments every minute, day and night.

## The steps

1. **Connect.** Get a token for your Instagram account and confirm the tool can read your latest posts and
   their comments.
2. **An automation.** A row in the database: which post, which keyword, the first DM, the button text, the
   link, the second DM. Let it wait for your next post, so you can set it up before you publish.
3. **Watch for comments.** Every minute, read new comments on posts with an automation. Comment webhooks
   need Meta's Advanced Access, so check by asking instead.
4. **The first DM.** When a comment has the keyword, send a private reply with a button. One per comment.
   Instagram only allows a private reply within 7 days of the comment.
5. **The link.** When they tap or reply, send the second DM with the link. Give each person their own link
   that counts the click and forwards to the page.
6. **The email.** If they send their email, add it to your email tool with their handle and a group per keyword.
7. **A dashboard.** Behind a password: each automation, how many commented, got the DM, tapped, gave an email.

## Checklist before you rely on it

- [ ] Your own comments and replies never trigger it.
- [ ] One person commenting twice gets one DM, not two.
- [ ] The dashboard and its API refuse anyone without your password.
- [ ] Tokens live in the hosting's secret settings, never in a file or in chat.
- [ ] The token renews itself before it expires, and you get told if it fails.
- [ ] A boosted post runs as an ad on its own post: it needs its own automation.
- [ ] Test it with a second account before your audience does.
