Case study

FotoLabs AI

WhatsApp-native AI photo generation platform. Users send selfies, get a personalized AI model trained in 3 minutes, then generate photorealistic images for 30 days.

~3 min

LoRA model training time

5

AI models in the pipeline

3

languages supported

$19.99

/month subscription

Production (rebranded to fenado.ai)
FotoLabs AI marketing site with dark theme

The challenge

An entire SaaS product inside WhatsApp

The client wanted an AI photo generation product with zero friction. No app download. No website login. No onboarding screens. The entire customer journey, from first contact to payment to receiving AI-generated photos, had to happen inside WhatsApp messages.

That meant building subscription billing, AI model training, content moderation, and image delivery into a conversational interface. Users would send 5-15 selfies to a WhatsApp number, pay $19.99/month through a Stripe link in the chat, then type prompts to generate photorealistic images of themselves in any setting.

The system also needed to handle abandoned checkouts with automated discount coupons, deliver a daily AI-generated photo to every subscriber, and support three languages: English, Portuguese, and Malay.

What we built

WhatsApp as the product

WhatsApp Business API as the UI layer

The entire product runs through Meta Graph API v20.0. Users message a WhatsApp number to start. The system responds with interactive buttons, image carousels, and payment links. Every screen a traditional app would have, onboarding, settings, billing, photo gallery, exists as a conversation flow. Users never open a browser or download an app.

FotoLabs AI product interface showing WhatsApp-native photo generation

Personalized AI model training in 3 minutes

Users upload 5-15 selfies through WhatsApp. The system sends each image to Fal.ai, which creates a LoRA fine-tune on Flux. Training completes in about 3 minutes. After that, the user has a personalized model that generates photorealistic images of them in any scenario they describe. The model persists for the duration of their subscription.

// User sends 12 selfies via WhatsApp

state: imagesIncomplete

images received: 12/5 (min)

// Payment confirmed via Stripe

state: generatingModel

training LoRA via Fal.ai...

// Model ready in ~3 min

state: photoPrompting

awaiting user prompt...

Multi-model AI pipeline

Each photo generation request passes through four AI systems. Groq with Llama enhances the user's text prompt into a detailed image description. Replicate with Flux generates the image using the personalized LoRA model. OpenAI GPT-4o analyzes the output for quality and relevance. The same GPT-4o instance runs NSFW moderation before delivery. Four models, one WhatsApp message as output.

Fal.ai

LoRA fine-tune training

Replicate / Flux

Image generation

Groq / Llama

Prompt enhancement

OpenAI / GPT-4o

Moderation + image analysis

Stripe billing and automated retention

Stripe handles subscription billing at $19.99/month. The system sends a checkout link inside WhatsApp. Webhook callbacks confirm payment and advance the user's state machine to model training. An hourly cron job detects users who reached the paywall but did not pay. It generates a Stripe coupon and sends the discount code via WhatsApp, all without human intervention.

// Hourly cron: abandoned paywall check

users at paywall: 47

unpaid > 1 hour: 12

// Generate Stripe coupon

coupon: FOTO-20OFF-x8k2

discount: 20%

// Send via WhatsApp

12 messages delivered

Automation and operations

  • Daily AI photo cron: every morning the system generates and delivers a fresh AI photo to each active subscriber, no prompt required.
  • NSFW content moderation via OpenAI screens every generated image before delivery. Flagged images are blocked and logged.
  • Multi-language support for English, Portuguese, and Malay. The system detects the user's language from their WhatsApp locale and responds in the correct language.
  • Admin dashboard showing WhatsApp conversation threads, user states, subscription status, and generated image history.

Architecture

XState 5 drives the conversation

XState 5 state machine

Every WhatsApp user has a state machine instance stored in Firebase. Five states control the flow: onBoarding, imagesIncomplete, paywall, generatingModel, and photoPrompting. Each incoming WhatsApp message triggers a state transition. The machine decides the next response, whether that's requesting more selfies, sending a payment link, or generating an image.

Firebase as the persistence layer

Firestore stores user profiles, state machine snapshots, subscription records, and conversation history. Firebase Storage holds uploaded selfies and generated images. Every state transition writes to Firestore, so the system resumes from the correct state if the server restarts mid-conversation.

Meta Graph API v20.0

Incoming messages hit a webhook endpoint. The system downloads media (selfies), processes text (prompts), and sends responses as WhatsApp messages with interactive buttons, images, or payment links. Rate limiting and retry logic handle Meta's API throttling.

Sentry for error tracking

AI model training, image generation, and WhatsApp API calls each have failure modes. Sentry captures errors with full context: user ID, current state, the prompt that caused the failure, and the AI model's response. The team triages issues by state, so they can spot patterns like "generation fails after paywall" within minutes.


Tools

Next.js Next.js TypeScript TypeScript Tailwind CSS Tailwind CSS Fal.ai Fal.ai Replicate Replicate Groq Groq OpenAI OpenAI XState XState Firebase Firebase Stripe Stripe WhatsApp Business API WhatsApp Business API

Results

Shipped to production

0

app downloads required

~3 min

personalized model training

5

AI models orchestrated per request

3

languages: English, Portuguese, Malay

Get in touch

Start a conversation

Tell us about your project. We'll respond within 24 hours with a clear plan, estimated timeline, and pricing range.

Based in

UAE & India