feat(api): EmailNotifier — Resend-backed help-wanted notifications (closes #82)#98
Merged
Conversation
Plan was queued (status: planned) in PR #96; flipping to in-progress as we start the implementation. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Installed via: npm install --workspace=apps/api resend Resend ships an HTTPS-API SDK (no SMTP); aligned with the plan's choice of transport for the help-wanted notifier. When RESEND_API_KEY is unset (tests, dev without an account), the notifier falls back to LoggingNotifier so existing code paths keep working without configuration. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…loses #82) Replaces the LoggingNotifier no-op with a real email notifier for the two help-wanted notification kinds the Notifier interface declares (notifyHelpWantedInterest, notifyHelpWantedFilled). Implementation: - apps/api/src/notify/templates.ts — pure-function template renderers for both notification kinds. Plain-text + HTML alternatives, with HTML-escaped interpolation of user-supplied fields (role title, full name, message body). External-link transform from #91 doesn't apply here — emails carry absolute URLs to the site host. - apps/api/src/notify/email-notifier.ts — Resend-API-backed class. Translates {data, error} response shape: throwing SDK + Resend- reported errors + missing-email all return delivered:false; the route still returns 202 to the caller per spec. - services plugin: installs EmailNotifier when RESEND_API_KEY is set, otherwise falls back to LoggingNotifier. Means dev + tests stay configuration-free; existing tests untouched. - env.ts: RESEND_API_KEY (optional secret), CFP_NOTIFICATION_FROM (defaults to "Code for Philly <notifications@codeforphilly.org>"). 11 new tests: template assertions (interest + filled, with + without message, HTML-escape of user-supplied fields), notifier paths (Resend success, Resend-reported error, SDK throw, missing email → no Resend call). 302/302 API tests pass. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- .env.example: section for both vars with dev-friendly defaults +
"leave unset to use LoggingNotifier" note.
- kustomize base configmap: CFP_NOTIFICATION_FROM baked in; the
sealed-secret for RESEND_API_KEY is operator-supplied per env.
- docs/operations/deploy.md env table: two new rows.
- docs/operations/secrets.md: RESEND_API_KEY rotation procedure +
the SPF/DKIM/DMARC pre-flight requirement on the sender domain
(unverified domains get spam-filtered immediately).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Closeout: flip to done, tick all validations (11 new tests + 302/302 API tests, lint + type-check clean), fill Notes (HTML escaping was load-bearing, Resend SDK's two failure shapes, unset-API-key fallback kept existing tests passing, dual text+html bodies) + Follow-ups (newsletter export endpoint, bounce/complaint webhooks, PII redaction in logs, Slack DM via #95, templating engine when 3+ notifications exist). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
Replaces the no-op `LoggingNotifier` with a real Resend-backed implementation for help-wanted-role notifications, per `specs/behaviors/help-wanted-roles.md`. Email-only first cut; Slack DM is split off to #95 because it needs deeper Slack-integration trust.
What's new
Test plan
Closes #82.
🤖 Generated with Claude Code