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)¶
- Auto-match LINKED → call
notifyPaymentMatchedinapplyVendorLink(matching/vendorMatch.server.ts ~82). #1 "feels not live" gap. - Invoice upload → call
notifyInvoiceCreated(or a vendor-receipt variant) after createReceipt / vendor-invoices/upload (today only project-invoice POST notifies). - Bank tx-update → match → call
notifyBankSync(+ match summary) from the sync endpoints / onTransactionsCreated (producer EXISTS, never called). - Match SUGGESTION (ambiguous/new-vendor) → new
notifyMatchSuggestionproducer, call from hooks after a suggestion is recorded (helps QA / catches misses). - 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.