← Back to projects

ZapSync · AI customer service on WhatsApp

Multi-tenant SaaS that I designed, built and operate on my own. The AI serves customers of restaurants, pizzerias, barbershops and clinics, takes orders, books appointments and hands off to a human when needed.

  • Node.js
  • PostgreSQL
  • OpenAI
  • Groq
  • Meta Cloud API
  • MCP
  • GitHub Actions

Problem

Small businesses lose sales because they cannot answer WhatsApp in time, and numbered menus push customers away. An AI that serves customers alone has to get prices and orders right every time, never go silent and cost little per conversation.

What I built

  • Message pipeline: HMAC-verified webhook, deduplication, batching of back-to-back messages, per-conversation queue, audio via Whisper and images via a vision model.
  • 11-step fallback cascade across OpenAI and Groq (gpt-5.4-mini, gpt-oss-120b and gpt-oss-20b) with strict JSON Schema structured output.
  • Hybrid menu RAG in PostgreSQL: keyword search (accents, plurals, synonyms) plus embeddings with cosine similarity, re-embedding only what changed.
  • MCP server with 16 tools so owners can run the business by chatting with an AI assistant, plus a dashboard tab showing cost, latency and guardrails.
  • Self-service onboarding with Meta Embedded Signup and recurring billing via Mercado Pago, with automatic suspension and reactivation.

Decisions

  • The model decides what, the database decides how much: prices recomputed from the menu, invented quantities reset to 1, and orders blocked when the store is closed.
  • A deterministic scorer for the evals, with no LLM-as-judge, so the score does not depend on another model.
  • The cascade order comes from the benchmark, not gut feeling: the same eval set on each model in isolation, measuring accuracy, latency and cost.
  • Two-layer protection against prompt injection: a prompt rule and a code-level lock that only accepts an order after the summary.

Results

  • 97% accuracy (168 of 174) on the benchmark, 1.6 s typical response, 2.5 s worst case (p95) and US$ 5.45 per 1,000 replies.
  • The security category went from 89% to 100% after fixing the prompt injection flaw the benchmark found.
  • 194 automated tests against a real PostgreSQL database on every push via GitHub Actions.
  • A public demo capped at roughly US$ 1.50 per month, with a daily budget and a per-person limit.

Screens

← Back to projects