Let’s talk
All projects Case study 05 / 06

Instagram automation

Zain AutoDM

My own comment-to-DM tool for Instagram. Someone comments on a reel, and a few seconds later they get a DM with the guide, after a quick follow check.

Status
Live · in daily use
Role
Built it end to end
Year
2026
Type
Cloudflare Worker + Meta API
Stack
Cloudflare WorkersD1 (SQLite)Meta Instagram APIWorkers AIJavaScript
Instagram automationHow a comment turns into a DM
01

The problem

My reels end with "comment a word and I'll DM you the guide". Paid tools do this, but they charge more as your audience grows, cap the number of DMs on the free plans, or add their own branding to every message.

One of my reels passed 100,000 views with almost 2,000 comments. That is exactly when a capped plan runs out and later commenters get nothing.

02

My approach

5 decisions that shaped the build, and why each one was made.

  1. 01

    Serverless, my own account

    One Cloudflare Worker with a D1 database, a cron job and Workers AI. It runs on Cloudflare's servers, so it keeps working when my laptop is off.

  2. 02

    Button first, link second

    Instagram allows one private reply per comment. So the first DM has a button, and the link comes after the tap, when Instagram opens the conversation.

  3. 03

    Follow check that never blocks unfairly

    Before the link, the tool checks if the person follows the account. If Instagram does not say, it sends the link anyway instead of blocking a real person.

  4. 04

    Delays through a queue

    Longer delays go through a cron queue instead of waiting inside the webhook. I learned this the hard way when a 25-second wait got cut off and a DM never finished.

  5. 05

    Catch-up after an outage

    When Meta paused the app until I verified my account, comments were missed. A one-click catch-up now finds those comments and sends the DMs, one every 20 seconds.

03

What it does now

  • Comment, DM, story reply and share triggers
  • Specific post, any post or next post
  • Keyword match, plus AI meaning match
  • Follow check with retries and a reminder
  • Button DMs with click tracking
  • Rotating public replies under the comment
  • Stats for DMs, followers gained and clicks
  • Missed-comment catch-up
04 · What I learned
“The platform rules are the real spec.”

Most of the work was not the code, it was Meta's rules: one private reply per comment, a 24-hour message window and account verification. Design around those first and the rest is simple.

Built for my own account, @zainspire. Running it for other accounts needs Meta App Review and Business Verification.