Skip to content

Make the app "live" — fire notifications/email on AUTO events (upload, auto-match, tx-sync)

Goal (owner, 2026-06-14)

When a user UPLOADS an invoice → auto-match + email; when bank txs UPDATE → auto-match (+notify). "Things we don't seem to have now."

KEY FINDING — the infra is ALL there; it just isn't wired to the AUTO paths

(audit 2026-06-14). Resend email configured (RESEND_API_KEY etc.) + lib/email/client.ts sendEmail; full notification system lib/notifications/notify.ts with producers notifyInvoiceCreated, notifyPaymentMatched (in-app+email), notifyBankSync, notifyDataIntegrity, notifyMatchSuggestion?(none); in-app = Firestore notifications (aote-system), email fires at severity ≥ warning via notifyRoles → sendIntegrityAlertEmail. Auto-matching already RUNS on upload (onVendorInvoiceCreated) + tx-sync (onTransactionsCreated). The catch: producers are only CALLED on MANUAL actions (manual match POST, project-invoice create). The AUTO paths only console.log.

Gap → wiring (the actual work — a handful of targeted calls, not a build)

  1. Auto-match LINKED → call notifyPaymentMatched in applyVendorLink (matching/vendorMatch.server.ts ~82). #1 "feels not live" gap.
  2. Invoice upload → call notifyInvoiceCreated (or a vendor-receipt variant) after createReceipt / vendor-invoices/upload (today only project-invoice POST notifies).
  3. Bank tx-update → match → call notifyBankSync (+ match summary) from the sync endpoints / onTransactionsCreated (producer EXISTS, never called).
  4. Match SUGGESTION (ambiguous/new-vendor) → new notifyMatchSuggestion producer, call from hooks after a suggestion is recorded (helps QA / catches misses).
  5. Ensure the chosen severity actually EMAILS (email gates at ≥ warning) — pick per-event: upload=info(in-app), auto-match=info+email?, misalignment=warning+email.

Dormant extras (optional, same system)

  • Resend webhook handler pages/api/webhooks/resend.ts (bounce/complaint) — stub, no logic.
  • Overdue-invoice cron /api/cron/check-overdue-invoices.ts — doesn't exist.
  • Verify RESEND_API_KEY set in PROD Vercel (gates all email; local .env.local has it).

Notes

Relates to [[project_notification_system]] / [[project_user_mgmt_notification_onboarding]] — which are more built than those memos imply. Recipients are RBAC roles (admin / auditing_ accountant / bookkeeper); for a single-operator setup that's the owner.

Log

  • 2026-06-14 created (owner add-on). Audited: infra exists, fires on manual not auto. Scoped wiring.
  • 2026-06-14 SPLIT into UID'd parts (owner): T-038 auto-match-linked · T-039 invoice-upload · T-040 tx-update→match · T-041 suggestion+misalignment (+ dormant extras). THIS task = umbrella + the audit/gap-table; the parts hold the per-event wiring.

Decision log

2026-07-09 — umbrella audit refreshed + parts routed

  • ✅ Read AGENTS.md. State of the four parts as of today: T-038 half-shipped (PATCH-path matched-invoice notify live; auto-matcher path silent) — re-scoped, → Accounting (Diagnostics); T-039 untouched (vendor-invoice upload fully silent) — → Records (Infrastructure) (owner, 2026-07-09); T-040 half-shipped (statement-sync notify live; tx-sync match summary missing) — re-scoped, → Accounting (Diagnostics); T-041 untouched (no suggestion producer; its Resend webhook extra now belongs to T-162 P3 / User Management — carve-out to avoid double-build); routing suggestion pending owner confirmation. Consumption-side counterpart: T-162 Notifications Center (User Management).
  • Source: EOP Local Assistance (fork) · session edb0abc7-6373-449b-8e31-379fd38d391b