Repository navigation
fix(emails): send transactional emails through /api/messaging - #256
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
PostHog Review · Standard · reviewed c85d434: 1 Should fix.
See this review and its findings in PostHog Review. Comment @posthog review --deep for a Deep review. A Deep review takes longer and looks deeper than a Standard review.
| @send_path "/api/messaging/send/email/" | ||
| @uploads_path "/api/messaging/attachments/uploads/" | ||
| @status_path "/api/messaging/emails/" |
There was a problem hiding this comment.
P2 · Preserve older-server compatibility in the patch release
On self-hosted PostHog versions predating the new routes, these constants make every email send, attachment upload and status read return 404 despite valid credentials. Existing app_host configurations therefore stop working after the patch upgrade declared by this PR. Preserve a compatible routing option or ship this compatibility removal as a breaking release.
There was a problem hiding this comment.
Not acting on this one on purpose: the SDKs switch to the key-scoped routes outright, with no fallback to the project path. The routes are live on PostHog Cloud (PostHog/posthog#137605), and keeping the old path would keep the SDKs on the @current alias that this change exists to retire.
posthog-elixir Compliance ReportDate: 2026-11-18T17:42:00.507291+00:00 ✅ All Tests Passed!47/47 tests passed Capture Tests✅ 30/30 tests passed View Details
Feature_Flags Tests✅ 17/17 tests passed View Details
|
| hex/posthog: patch | ||
| --- | ||
|
|
||
| `PostHog.Emails` now sends emails, uploads attachments and reads email status through `/api/messaging/`, which takes the project from the project secret API key, instead of `/api/projects/@current/messaging/`. PostHog instances older than these routes answer 404. |
There was a problem hiding this comment.
Note
🤖 Claude Opus 5.5 responding on behalf of Michael
One ask on the changeset: could it name the server this needs? Something like "Needs PostHog Cloud, or a self-hosted build from 2026-11-18 or later; older self-hosted builds answer these calls with 404." I'd keep the patch bump: Cloud users see no change, and a major costs every user an upgrade for a self-hosted edge case.
There was a problem hiding this comment.
Added in 5d53f26: "Needs PostHog Cloud, or a self-hosted PostHog from 2026-11-18 or later. Older self-hosted versions answer these calls with a 404." Kept the patch bump.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
💡 Motivation and Context
PostHog.Emailscalls/api/projects/@current/messaging/.... PostHog is removing the@currentproject alias, so these calls will stop working.PostHog/posthog#137605 added key-scoped routes that take the project from the project secret API key. This PR moves the SDK to them:
/api/projects/@current/messaging/send/email//api/messaging/send/email//api/projects/@current/messaging/attachments/uploads//api/messaging/attachments/uploads//api/projects/@current/messaging/emails/{id}//api/messaging/emails/{id}/This is an outright switch with no fallback. PostHog instances older than PostHog/posthog#137605 answer 404. US and EU Cloud already serve the new routes.
💚 How did you test it?
mix test test/posthog/emails_test.exs test/posthog/emails_default_instance_test.exs: 118 tests, 0 failures. Run on Elixir 1.18.3 / OTP 27, because the.tool-versionspins (1.20.0 / OTP 29) are not installed locally.mix format --check-formattedandmix credo --strict lib/posthog/emails.expass.📝 Checklist
If releasing new changes
sampo addto generate a changeset file🤖 Agent context
Autonomy: Human-driven (agent-assisted)
claude-opus-5-5).@currentcalls and does not call the preferences route..sampo/changesets/, because the sampo CLI was not installed.🤖 Generated with Claude Code