HomeWorkProcessWhy UsAboutContact
Hire Us
All work
fullstack2025

DMFlow — Instagram DM Automation SaaS

A full ManyChat alternative built for the Indian creator market — keyword-triggered auto DMs, story reply flows, a visual automation builder, referral wallet system, and a BullMQ-powered async queue that handles 250+ DMs/hour per account.

Client
Pr Creations
Duration
8 weeks
Role
Architecture + Full-stack engineering
Live
—
Stack
Next.js 14TypeScripttRPCTanStack QueryPrismaBullMQRedisBetterAuthRecharts
The Problem

Indian Instagram creators were manually replying to hundreds of comments and DMs every day — losing leads and followers because they couldn't respond fast enough. Existing tools like ManyChat cost ₹3,700/month and were built for Western markets with no referral incentive for Indian growth loops.

Our Approach
  1. 01Zero-REST architecture: every client query goes through tRPC + TanStack Query for end-to-end type safety — if you rename a procedure, TypeScript breaks at the call site before you ship
  2. 02BullMQ + Redis async DM queue — DMs are never sent synchronously. Every Instagram trigger enqueues a job with retry, exponential backoff, and Instagram rate limiting (250 DMs/hour per token) built in
  3. 03Webhook idempotency table with @@unique([provider, messageId]) — Meta retries failed webhooks 3×. Without this, one comment triggers three identical DMs. The DB constraint makes duplicate processing physically impossible
  4. 04All monetary values stored in paise (₹1 = 100 paise) — floating point arithmetic on ₹24.75 gives 2474.9999 in JS. Integer paise is always exact
  5. 05Instagram OAuth long-lived token lifecycle: exchange short-lived (1hr) → long-lived (60 days) → auto-refresh cron at day 53. Missing any step silently breaks all automations at day 60
  6. 06Referral first-time enforcement via @unique constraint on referredUserId — no application-level check needed, the DB rejects the second insert even under race conditions
  7. 07Multi-tenant architecture supporting solo creators and agency teams under one codebase via userId/organizationId dual ownership on every resource
The Solution

A production-grade Instagram DM automation SaaS with a visual automation builder (triggers → keywords → actions), an async BullMQ worker that processes webhooks and fires DMs via the Instagram Graph API, a full analytics dashboard with delivery rate tracking and hourly heatmaps, a referral wallet system where Creator Pro users earn ₹24.75 per referral, and a settings suite with billing, profile, and account deletion. Two pricing tiers: Free (₹0, 1,000 DMs/month) and Creator Pro (₹429/month, unlimited — or ₹99 first month via referral).

The Outcome

Shipped as a fully functional SaaS product with Instagram OAuth, real-time webhook processing, multi-tenant billing, and a referral growth loop. The codebase is structured for horizontal scaling — the Next.js app and BullMQ worker run as separate deployable processes so DM throughput scales independently of the web tier.

By the numbers

Results that matter.

7 pages
Dashboard sections
40+
tRPC procedures
BullMQ + Redis
DM queue
₹429 vs $49
Pricing
Previous
Vetic - Pet Clinic & Grooming
Next
Nodebase — Workflow Automation

Want results like these?

Tell us about your project. We respond within 24 hours.

Start a project
2xStudio

A two-person studio building AI agents, automation systems, and complex applications end-to-end. Available for engagements.

Navigate
  • Home
  • Work
  • About
  • Contact
Get in touch
  • imcaffiene@gmail.com
  • Start a project →

© 2026 2xStudio. All rights reserved.

Designed & built by us. Of course.