Repository navigation
feat(emails): flatten the send request body - #163
Merged
Merged
Conversation
send now posts template_id and distinct_id at the top level, matching the SDK argument names and the HTTP docs. Proposed, applied and archived as 2026-10-30-flatten-email-send-body. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Generated-By: PostHog Desktop Task-Id: e72a2c10-f145-4f7c-8754-a4fcc06a18be
ioannisj
approved these changes
Nov 2, 2026
ioannisj
left a comment
Contributor
There was a problem hiding this comment.
🤖 An AI agent wrote this on behalf of @ioannisj.
No findings. The flat body matches what the server takes since PostHog/posthog#126287, and that PR keeps the nested body working for the SDK versions already out. The spec, the HTTP mapping row and the acceptance feature all line up with it.
posthog Bot
added a commit
that referenced
this pull request
Nov 9, 2026
Deep re-audit of posthog-php, posthog-ruby and posthog-go against the 69 cross-SDK contracts, at sdk-specs 5160f2f. Selection: php and ruby were the two stalest pointers (6 weeks, outside the ~4-week window) and had the largest backfill; go is the remaining matrix SDK named in the mcp-analytics applicability table, which five of this cycle's 19 spec commits touch. All three are server SDKs, where the Emails, Exception Event Metadata, Tracing Headers and config-version-2 flag deltas land. Contract surface grew to 69 with Experiment Exposure (#162). Main findings: - Emails went from one implementation to four. All three SDKs ship it and all three pass, including #163's flattened send body, Cloud app-host resolution, and a once-per-call idempotency key. - #129's span-context bridge and #123's trace context on exception events landed in all three. posthog-go is alone in getting the detached-work scenario right, and alone in the trace-context path being reachable only through an opt-in helper in a separate module. - None of the three reads /flags?v=4, so Experiment Exposure is ➖ on all three by the spec's own applicability sentence — raised as a scope question. - posthog-ruby ships a 3,798-line MCP package the spec's applicability table records as "not yet"; scored 🟡, with the table flagged for update. - The #132 jitter requirement is now unmet on five of seven SDKs checked; posthog-go passes jitter: 0 at every ingestion call site while its own Emails client jitters. Scope: compliance/ only. Generated-By: PostHog Desktop Task-Id: 86b4f98b-a338-40c2-912e-9e3a9dc366fd
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.
Problem
The emails contract pins the
sendbody as{"template": {"id"}, "to", "message_data", "identifiers": {"distinct_id"}}. The server now documents a flat body (PostHog/posthog#126287) that uses the same names as the SDK arguments, so the contract should require that.Changes
sendSHALL post{"template_id", "to", "message_data", "distinct_id"}, withdistinct_idonly when the caller passed one. The table row, the requirement and every scenario body are updated.acceptance/public/emails.featurepins the flat body.2026-10-30-flatten-email-send-body. The proposal notes that the server keeps accepting the nested body, so released SDK versions keep working.Implementations: PostHog/posthog-js and PostHog/posthog-python, branches
posthog/node-email-flat-bodyandposthog/emails-flat-send-body.How did you test this code?
npx -y @fission-ai/openspec@1.4.1 validate --specs --strict --no-interactivepasses, the same command CI runs.🤖 Generated with Claude Code
Created with PostHog Desktop