Add HubSpot sync for coupon and newsletter opt-ins#37
Merged
Conversation
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
Adds HubSpot subscriber sync to the existing michaelzick.com newsletter and NGU coupon flows. NGU coupon signups still send the coupon email first, and contact-form workbook/newsletter opt-ins still send the contact notification first; HubSpot sync runs afterward as a best-effort integration so CRM issues do not block successful form submissions.
gender = Male,lifecyclestage = subscriber, and the configured HubSpot owner.First entry: michaelzick.comfor new contacts andExisting entry: michaelzick.comfor existing contacts, skipping duplicate entry notes.Changes
hubspot-subscriber.ts(new) — server-only HubSpot config, contact upsert, note association, duplicate-note detection, sanitized error handlingngu-coupon/route.ts— syncs coupon subscribers to HubSpot after visitor/admin emails sendcontact/route.ts— syncs HubSpot only for workbook/newsletter opt-ins, preserving normal contact form behaviorserver.test.ts— adds coverage for env fallback, normalization, contact create/update, conflict retry, duplicate-note skipping, sanitized failures, and name/no-name request bodiesAGENTS.md,CLAUDE.md,GEMINI.md— documents HubSpot env vars and subscriber-sync behaviorTest plan
npm testnpm run agent-briefs:checknpm run lintnpm run typechecknpm run checkCreated by Codex