feat(leads): notify founder on a genuinely external lead#33
Merged
Conversation
The first real external lead (info@ourlivesapp.com) sat undiscovered for 3 days — surfaced only on a manual /admin refresh. There was no notification path. - New lib/internal.ts: shared internal-traffic detection (extracted from the admin summary route, which was the only copy — now reused, can't drift). - New sendLeadNotificationEmail() in lib/billing/email.ts: best-effort founder ping via the existing Resend client. Never throws — a notification failure can't break a lead capture. Recipient defaults to asaf@amoss.co.il, override with LEAD_NOTIFY_TO. No-ops if Resend isn't configured. - Wire both lead-write paths (/api/lead, /api/free-scan): notify only for a brand-new (not re-subscribe) AND external (not self-test/probe) email. Needs no new prod env — Resend already powers welcome emails. Verified: tsc + eslint clean, and the gating logic correctly NOTIFYs for strangers and SKIPs every founder/test/probe address. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
✅ No accessibility violations detectedScanned axe-core automated checks catch roughly 57% of WCAG issues. Manual review still recommended. Powered by axle · Remediation assistance, not compliance certification. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The first real external lead (
info@ourlivesapp.com, 2 Jun) sat undiscovered for 3 days — surfaced only on a manual/adminrefresh. There was no notification path. This closes that gap.What
lib/internal.ts(new) — shared internal-traffic detection, extracted fromapp/api/admin/summary/route.ts(the only copy). Both the dashboard and the lead routes now use it, so the "internal vs external" rule can't drift between them. Net-59lines in the summary route.sendLeadNotificationEmail()inlib/billing/email.ts— best-effort founder ping via the existing Resend client. Never throws — a notification failure can't break a lead capture. Recipient defaults toasaf@amoss.co.il(override viaLEAD_NOTIFY_TO). No-ops if Resend isn't configured./api/lead,/api/free-scan) — notify only when the lead is brand-new (not an idempotent re-subscribe) and external (not a self-test / health probe).Notes
LEAD_NOTIFY_TOis optional.Verification
tsc --noEmit→ exit 0eslint(all changed files) → exit 0info@ourlivesapp.com+ generic strangers; SKIP fortest+verify-*@gmail.com,*@axle-test.local,asaf@*, and empty.🤖 Generated with Claude Code