Repository navigation
feat(reputation): Google Postmaster Tools and SNDS on the dashboard - #100
Merged
Merged
Conversation
A Sender reputation card on the dashboard shows 30 days of Gmail data per sending domain (Postmaster Tools v2: user-reported spam rate, SPF/DKIM/DMARC pass rates, delivery errors, compliance with Google's sender requirements) and Outlook data per IP (SNDS filter result, complaint rate, trap hits). Google connects over OAuth with the read-only traffic scope; SNDS through its automated data access link, fetched only from Microsoft's hosts. Tokens and links are stored encrypted. A background job syncs each connection daily, and alerts (Gmail spam >= 0.1% / 0.3%, compliance needs work, SNDS yellow/red) show on the card and email the owners when they start or get worse. REST, MCP, docs and ADR 0004. Google retired domain/IP reputation grades in Postmaster Tools v2, so the compliance verdict replaces the Low/Bad reputation alert. Closes #76
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.
Part of #79. Closes #76.
Changed premises (see ADR 0004)
SPAM_RATE,AUTH_SUCCESS_RATEfor SPF/DKIM/DMARC,DELIVERY_ERROR_RATEandgetComplianceStatus. Google's compliance verdict replaces the "domain reputation Low/Bad" alert.postmaster.traffic.readonly. SendLit checks the team's ESP From domains instead of listing Postmaster domains, which would need a domain-management scope. Domains not verified in Postmaster Tools are flagged.What
DB (migration 0020):
reputation_connections: per team and provider; encrypted refresh token or SNDS link, status, last error,next_sync_at, alert state, per-domain state.reputation_daily_stats: subject, day and metrics, unique per connection, subject and day.API
/reputation:GETPOST google/connect(returns the sign-in URL)DELETE googlePUT snds(validates by fetching)DELETE sndsPOST sync(once per 5 min)/integrations/google-postmaster/callbackwith a signed 15-minute state; redirects back to the dashboard.Sync job: a loop every 10 minutes (
REPUTATION_SYNC_CHECK_SECONDS) atomically claims due connections and syncs each daily. Outages retry after 1h; revoked Google access or an expired SNDS link waits for the user.Alerts: Gmail spam ≥0.1% is a warning and ≥0.3% critical; compliance needs work; SNDS yellow or red. They show on the card and email org owners only when new or worse.
SNDS safety: links are fetched only from
substrate.office.comandsendersupport.olc.protection.outlook.comover https withredirect: manual(plusSNDS_ALLOWED_HOSTSfor tests). The parser handles the header-less export, a header row, and HTML error pages.MCP:
get_reputation,sync_reputation,connect_google_postmaster,disconnect_google_postmaster,connect_snds,disconnect_snds(settings scopes; disconnects marked destructive).Web: a "Sender reputation" card on the dashboard. It has:
shadcn
chartwas added via the CLI. Fixed the CLI's boguscnimport again, and added biome-ignores on upstream markup as for the other generated components.Docs:
email-marketing/reputation, MCP docs,.env.example(GOOGLE_POSTMASTER_CLIENT_ID/_SECRET), ADR 0004.Verification
check.sh(725 API tests incl. 10 new: parser, host allowlist, Google stats/compliance, alert dedupe, reauth, SNDS expiry, single claim, OAuth callback/state),check:drift,test:conformance, docs build.Browser E2E (8/8) against a local stand-in for Google OAuth, Postmaster v2 and an SNDS link:
This run also caught an invisible chart line (the theme has no
--chart-1; now uses--primaryand no animation).Before launch on sendlit.app
https://api.sendlit.app/integrations/google-postmaster/callback, enable the Gmail Postmaster Tools API, and get the consent screen verified for the Postmaster scope.