← All samples
SAMPLE / PROTOTYPE, self-initiated, not client work. Fictional company and clients. It isn't connected to a live WhatsApp number; external services are behind offline adapters.
WhatsApp quote and invoice bot (prototype)
What it does
> quote acme 2 hours
< Quotation QT-2026-0001 for Acme Properties (fictional): AED 1795.5 (2 h @ 900, 5% off, VAT incl.)
> invoice blueview 4.5h
< Invoice INV-2026-0002 for BlueView Events (fictional): AED 4725 (4.5 h @ 1000, 0% off, VAT incl.)
- Reads the incoming message from the WhatsApp Cloud API webhook payload.
- Parses
quote|invoice <client> <hours> and looks up the client's rate and discount.
- "Learns" from history: after 3 invoices, a client automatically gets a loyalty discount. The rule is editable.
- Auto-increments document numbers (QT-YYYY-0001, INV-YYYY-0001).
- Renders the document from a template with
{{placeholders}}. In production the template lives in Google Drive and is exported to PDF.
- Logs a row to a sheet. Here that's a CSV stand-in; in production it uses the Google Sheets API
values.append.
- Replies with a summary. In production it also sends the PDF through the WhatsApp Cloud API media message.
Sample output: quotation · sheet log (CSV)
Tests
node --test test.js → # pass 4 # fail 0
The tests cover parsing, pricing maths, numbering, the loyalty discount, and the replies for an unknown client or a badly formatted message.
Production checklist (what a real build adds)
- A Meta WhatsApp Business account and Cloud API number, plus webhook verification (the client's own account and costs).
- A Google service account with access to the Drive template folder and the Sheet.
- PDF export, the email copy to the client, and a sender allow-list so only staff can create invoices.
- Hosting: a small Node service, or the same flow built in n8n/Make if you prefer no-code.
Download code (zip)