Automation WhatsApp interactive + document draft actions (1.5.0) — Production Readiness Audit
| Field | Value |
|---|---|
| Date | 2026-10-01 |
| Status | Go for production (merge/deploy remaining) |
| Scope | Automation actions send_whatsapp_interactive, generate_quotation, generate_invoice; catalog automation 1.4.0 → 1.5.0 (no whatsapp-cloud bump — interactive send already shipped in WhatsApp Cloud 1.4.0) |
| Companion | Automation developer guide · Automation create_project 1.4.0 · WhatsApp interactive 1.4.0 · CHANGELOG |
Executive summary
Three Phase 1 automation actions, all following the existing create_project / send_whatsapp_template related-context pattern (no new architecture):
send_whatsapp_interactive(modulewhatsapp-cloud) wrapsWhatsAppConversationService::queueInteractive— reply buttons or a list, same conversation/lead resolution assend_whatsapp_template. Requires the conversation's 24-hour customer service window to be open (existing rule, unchanged).generate_quotation(modulequotations) drafts aQuotationviaQuotationService::create. Status always staysdraft— nothing is sent. Requiresopportunity_id(from action config or anopportunity.*trigger); soft-links company/contact from the opportunity and notes it (mirrorscreate_project's soft-link + note pattern).generate_invoice(moduleinvoices) drafts aCustomerInvoiceviaCustomerInvoiceService::create. Status always staysdraft. No FK is required; soft-linksquotation_id/company_id/contact_idfrom the trigger when available and notes that record.
Two optional starter templates: opportunity_stage_generate_quotation (opportunities + quotations) and whatsapp_inbound_quick_replies (whatsapp-cloud). Builder config shipped for all three actions in the SPA.
Go / No-Go: Go. Cutover: migrate-only catalog bump to 1.5.0.
| Gate | Result |
|---|---|
| Platform freeze | Pass |
Action registry (config_fields) + ActionRunner handler map | Pass |
send_whatsapp_interactive — conversation/lead resolution, CS-window guard, button/list payload mapping | Pass |
generate_quotation — requires opportunity_id; soft-link + note; fails run clearly when unresolved | Pass |
generate_invoice — optional soft-links (quotation/opportunity/contact/company); note on trigger entity | Pass |
Both generated documents remain draft (never auto-sent) | Pass (verified via service call, no status transition) |
Starter templates opportunity_stage_generate_quotation / whatsapp_inbound_quick_replies | Pass |
| SPA action config (WhatsApp interactive type/body/buttons/list/footer; quotation/invoice title/notes/assignee/opportunity picker) | Pass |
| Catalog migrate-only automation 1.5.0 + CatalogSeeder | Pass |
| Pest (automation suite) | 39/40 — 1 pre-existing unrelated failure (see below) |
Frontend tsc -b + oxlint | Pass (no new errors; pre-existing warnings only) |
Pre-existing unrelated failure (not introduced by this change)
AutomationEngineSupportTest::it declares CatalogSeeder companion versions for automation catalog bumps expects contacts => '1.6.0' but CatalogSeeder already has contacts => '1.7.0' (shipped by the separate Contact/Company follow-ups + import/export change, 2026-09-30). Reproduced identically on origin/main before this branch's changes. Out of scope for this PR — flagged for a follow-up one-line test fix.
Upgrade & staging smoke
php artisan migrate --force— catalogautomation→ 1.5.0 (do notdb:seed).- Entitle Automation + WhatsApp Cloud (interactive) / Quotations / Invoices as needed.
- WhatsApp interactive: open a conversation inside the 24h CS window → workflow with
send_whatsapp_interactive(button type) → Manual Run or triggerwhatsapp.message_received→ confirm queued interactive message with correct buttons. - Generate quotation: activate
opportunity_stage_generate_quotation(or a custom workflow) → change an opportunity's stage → confirm a draft quotation with soft-linked company/contact and an opportunity note. - Generate invoice: workflow on
quotation.createdwithgenerate_invoice→ confirm a draft invoice linked to the quotation (quotation/company/contact) and a note on the quotation. - Confirm neither generated document transitions past
draftand no email/WhatsApp send is triggered by these actions.
Rollback
Catalog down → 1.4.0. No schema changes (existing tables only) — code rollback removes the three action classes/registry entries; no cleanup required.