/ Cases / Bakery / AI agent

A bakery run entirely from WhatsApp

The customer fills a basket from WhatsApp's native catalog and pays; the bank transfer confirms itself. The owner manages orders, inventory, cash and expenses from the same chat.

/ Pan Nuestro/ 2026.04/ Catalog synced with Meta in 1–2 s · the AI classifies, it doesn't improvise

1–2 s

catalog sync

6

admin modules over chat

/ The problem

Orders came in on WhatsApp as free text and were copied over by hand. Confirming every transfer took time and caused errors.

/ What we built

  • WhatsApp's native catalog with photos; it syncs with Meta in 1–2 seconds when a product is edited.
  • The bank transfer confirms itself by matching amount, name and time.
  • The AI only classifies the intent and never writes to the customer; if it isn't sure, it hands off to a person.
  • Owner's panel inside WhatsApp: orders, metrics, inventory, cash, expenses and products.

/ How it works

  1. 01Customer browses the catalog
  2. 02Fills the basket
  3. 03Pays
  4. 04Transfer confirms itself
  5. 05Order goes to the team

/ Real code

supabase/functions/payment-webhook/index.tsts
  const cutoff = new Date(Date.now() - 48 * 3600 * 1000).toISOString();
  const { data: raw, error } = await supabase
    .from("orders")
    // …
    .eq("payment_method", "transfer")
    .neq("payment_status", "paid")
    .gte("created_at", cutoff)
    .order("created_at", { ascending: false });
  // …
  // Filter by amount within 1 cent tolerance
  const candidates = (raw || []).filter((o) =>
    Math.abs(Number(o.total) - amount) < 0.01
  );
  // …
  if (candidates.length === 1) {
    await markOrderPaid(candidates[0].id, recRef, "transfer_bank");
    // …
  }
  // Multiple candidates with same amount — try fuzzy name match.
  // …
    if (candidateNames.some((cn) => hasNameOverlap(cn, senderName))) {
      nameMatches.push(c);
    }
  // …
  if (nameMatches.length === 1) {
    await markOrderPaid(nameMatches[0].id, recRef, "transfer_bank");
    // …
  }

■ A transfer with no reference reconciles itself when the amount matches a single order; on a tie it uses the sender name, and otherwise it does not guess.

/ Stack

WhatsApp Cloud APIMeta CommerceWhatsApp FlowsSupabase Edge FunctionsDeepSeek