Instagram DM Automation SaaS Built for Indian MarketInstagram DM Automation SaaS Built for Indian Market
The network for creativity
Join 1.25M professional creatives like you
Connect with clients, get discovered, and run your business 100% commission-free
Creatives on Contra have earned over $150M and we are just getting started
I just finished building a full Instagram DM automation SaaS for a client. Think ManyChat โ€” but built from scratch, for the Indian market. Let me walk you through what went into it. ๐Ÿ‘‡ ๐—ง๐—ต๐—ฒ ๐—ฐ๐—น๐—ถ๐—ฒ๐—ป๐˜'๐˜€ ๐—ฟ๐—ฒ๐—พ๐˜‚๐—ถ๐—ฟ๐—ฒ๐—บ๐—ฒ๐—ป๐˜๐˜€ ๐˜„๐—ฒ๐—ฟ๐—ฒ ๐—ฐ๐—น๐—ฒ๐—ฎ๐—ฟ: โ€ข Auto-DM anyone who comments a keyword on a post โ€ข Auto-DM story replies and mentions โ€ข Referral system โ€” PRO users earn โ‚น24.75 for every person they refer โ€ข Two pricing tiers: Free (โ‚น0) and Creator Pro (โ‚น429/month) โ€ข Referred users pay only โ‚น99 for their first month Simple to describe. Surprisingly nuanced to build correctly. ๐—ง๐—ต๐—ฒ ๐—ฝ๐—ฎ๐—ฟ๐˜ ๐—บ๐—ผ๐˜€๐˜ ๐—ฑ๐—ฒ๐˜ƒ๐˜€ ๐—ด๐—ฒ๐˜ ๐˜„๐—ฟ๐—ผ๐—ป๐—ด โ€” ๐—œ๐—ป๐˜€๐˜๐—ฎ๐—ด๐—ฟ๐—ฎ๐—บ ๐—ข๐—”๐˜‚๐˜๐—ต: Instagram gives you a token that expires in 1 hour. You must immediately exchange it for a 60-day long-lived token. Then refresh it at day 53. Miss any of this โ†’ every automation silently breaks at day 60. No error. Just stopped DMs. I built the full lifecycle: connect โ†’ exchange โ†’ hash + store โ†’ auto-refresh cron โ†’ manual refresh UI for users. ๐—ง๐—ต๐—ฒ ๐—ฝ๐—ฎ๐—ฟ๐˜ ๐˜๐—ต๐—ฎ๐˜ ๐—ฐ๐—ผ๐˜‚๐—น๐—ฑ'๐˜ƒ๐—ฒ ๐—ฑ๐—ฎ๐—บ๐—ฎ๐—ด๐—ฒ๐—ฑ ๐˜๐—ต๐—ฒ ๐—ฐ๐—น๐—ถ๐—ฒ๐—ป๐˜'๐˜€ ๐—ฟ๐—ฒ๐—ฝ๐˜‚๐˜๐—ฎ๐˜๐—ถ๐—ผ๐—ป: Meta retries webhook delivery 3 times if you don't respond fast enough. Without a deduplication layer, a single comment triggers three identical DMs to the same person. I've seen this happen in production at other companies โ€” users block the account immediately. Solution: a WebhookEvent table with a unique constraint on (provider, messageId). The second insert fails at the database level. No duplicate DMs. Ever. ๐—ง๐—ต๐—ฒ ๐—ฟ๐—ฒ๐—ณ๐—ฒ๐—ฟ๐—ฟ๐—ฎ๐—น ๐˜€๐˜†๐˜€๐˜๐—ฒ๐—บ ๐—ฑ๐—ฒ๐˜๐—ฎ๐—ถ๐—น ๐—œ'๐—บ ๐—ฝ๐—ฟ๐—ผ๐˜‚๐—ฑ ๐—ผ๐—ณ: The "first-time user only" rule for referral discounts is enforced by a @unique constraint on the referredUserId column โ€” not application code. Even if there's a race condition (two requests hitting the API simultaneously), the database rejects the second insert. No double-discounts possible. This is the difference between a system that works in testing and one that works in production. ๐—™๐˜‚๐—น๐—น ๐˜€๐˜๐—ฎ๐—ฐ๐—ธ ๐—ฑ๐—ฒ๐—น๐—ถ๐˜ƒ๐—ฒ๐—ฟ๐—ฒ๐—ฑ: Next.js 14 ยท tRPC ยท TanStack Query ยท BetterAuth ยท Prisma ยท PostgreSQL ยท BullMQ ยท Redis ยท Recharts This project reminded me why I love freelance work. You're not building a demo. You're building something real people will use, real money will flow through, and real businesses will depend on. That pressure makes you a better engineer. If you're a founder, startup, or business that needs a full-stack SaaS product built with this level of attention to detail โ€” let's talk. Comment below or send me a DM. Always happy to discuss your project. hashtag#Freelancing hashtag#SoftwareDevelopment hashtag#NextJS hashtag#SystemDesign hashtag#SaaS hashtag#FullStack hashtag#TypeScript hashtag#BuildInPublic hashtag#IndianDevelopers
Post image
Back to feed
The network for creativity
Join 1.25M professional creatives like you
Connect with clients, get discovered, and run your business 100% commission-free
Creatives on Contra have earned over $150M and we are just getting started