DEV Community

I replaced ManyChat with a free tool I built myself (open source)

I run a small digital bookstore from Egypt. Every single day, people comment "بكام؟" (how much?) under my Facebook and Instagram posts - and every reply I miss is a sale I lose.

The famous tools for this, like ManyChat, work fine. But they charge in dollars, every month, while I earn in Egyptian pounds. So I built my own tool instead - and made it free and open source for anyone in the same situation: ORVNZA Auto DM - https://github.com/wahedelfar/orvnza-auto-dm

How my tool works

Every 5 minutes it checks the comments on my latest Instagram reels and Facebook posts, and compares them with keyword rules I keep in a Google Sheet:

keywords dm_message active media_id
price, بكام Your message + link YES -
  • On Instagram, a match gets a private DM - as a button card when the message has a link (bare links get filtered as spam much faster), plus a short public reply saying "check your inbox".
  • On Facebook, the same message goes out as a public reply. There is a reason for that - below.
  • No keyword match? The comment goes to an AI (Groq) that knows my real catalog - book titles, page counts, and the actual price in each store. It answers in the commenter's language. And it is under strict orders: never invent a price, never invent a discount, and stay completely silent on anything off-topic.

The part I like most: to change the bot's behavior, I edit a row in the spreadsheet from my phone. No dashboard, no redeploy.

The bug that cost me an evening - and wasn't a bug

Facebook private replies (POST /{comment-id}/private_replies) kept failing on me with error 100 / subcode 33 - "object does not exist or lacks permissions". The strange part: the same Page token could read comments, post public replies, and subscribe my app to the Page's feed. I tried every ID format I could think of.

The answer: private replies are locked behind Advanced Access for pages_messaging, and getting that today means business verification plus registering as a "Tech Provider". Standard Access can read and reply publicly - it just cannot send the private reply.

So my tool replies publicly on Facebook by design. For a bookstore, that honestly works out: the next reader sees the answer too.

Safety rules, so Meta doesn't ban me

  • Max 5 sends per run, 60 per hour, per platform
  • 15-minute cooldown the moment Meta returns a rate-limit error (#4/#17/#32/#613)
  • It remembers the last 3,000 processed comment IDs, and never replies to the same person twice on the same post
  • It skips comments I already answered myself

What it runs on

Vercel Functions + Blob for state, woken up every 5 minutes by a free cron-job.org schedule (Vercel's own free cron only runs once a day, so I ring the bell from outside). The same repo also carries a Netlify port - I moved hosts mid-project and the engine didn't care, because only the small state adapter is host-specific.

Meta Graph API v21, Google Sheets for rules, Groq for the AI answers. Everything on free tiers. Setup is: import the repo, paste the env vars, add one secret - the README (Arabic first, English summary included) explains step by step how I created the Meta app and the system-user token that never expires.

Why I open-sourced it

I know many small sellers who pay for tools in dollars and earn in local currency, like me. If this saves even one of them a monthly subscription, publishing it was worth it.

If you try it, issues and PRs are welcome - and a ⭐ on the repo helps other small sellers find it: https://github.com/wahedelfar/orvnza-auto-dm

Read on DEV Community ↗ ← Back to News

Comments

No comments yet. Start the discussion.