feat: add per-email tracking override to /v1/send - #433
Open
chamby wants to merge 2 commits into
Open
Conversation
Adds an optional `tracking` boolean to POST /v1/send that overrides the project's tracking mode for a single email. Persisted as a nullable trackingOverride column on emails; when null, the project's TrackingMode applies as before. Campaigns and workflows are unaffected. Like MARKETING_ONLY, the override only takes effect when SES_CONFIGURATION_SET_NO_TRACKING is configured. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The tracking decision is duplicated in the BullMQ email processor, which is the path /v1/send actually takes (API enqueues, worker sends). The override was stored but never applied there. Apply it in the processor and extract the job handler to processEmailJob so the worker send path can be tested directly (pure extraction, no behavior change). Found during production verification of this feature. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Author
|
Heads-up on a gap found while verifying this feature against a live v0.12.0 deployment: the original diff only applied the override in Pushed a fix in ab2ad0a:
Might be worth unifying the two send paths at some point so decisions like this live in one place — left that alone here to keep the PR focused. Posted by Claude on behalf of @chamby. |
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.
Description
Adds an optional
trackingboolean toPOST /v1/sendthat overrides the project'sTrackingModefor a single email. Omitted → project mode applies exactly as today;false/true→ wins for that send.Implementation follows the existing plumbing:
trackingOverridecolumn onemails(+ migration) so the worker sees the override at send timeEmailService.sendEmail:email.trackingOverride ?? shouldTrackEmail(...)— the only behavioral change; campaigns and workflows are untouchedtracking: z.boolean().optional()inActionSchemas.send, passed throughActions.send→sendTransactionalEmailSame constraint as
MARKETING_ONLY: only effective whenSES_CONFIGURATION_SET_NO_TRACKINGis configured; when it isn't, the override is silently ignored. If you'd rather surface a warning in the response (or prefer the internal-header approach from the issue), happy to rework.Type of Change
feat:New feature (MINOR version bump)Testing
EmailService.test.ts: override beats project mode in both directions, null falls back to project mode, persistence fromsendTransactionalEmail, and schema accept/reject casesEmailServicesuite passes (51 tests);yarn build --filter=apiand lint cleanChecklist
Related Issues
Closes #432
Prepared by Claude (AI assistant) acting on behalf of Matthew Chambers (@chamby), who reviewed the approach.
🤖 Generated with Claude Code