Repository navigation
fix(emails): send transactional emails through /api/messaging - #1275
Conversation
PostHog is removing the @current project alias. Send emails, upload attachments and read email statuses through the key-scoped /api/messaging/ routes, which take the project from the project secret API key. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PR overviewNo security issues were found in this pull request. Reviews
|
SDK performance: posthog-pythonBenchmarks completed. No changes flagged for review. Flags require at least a 5% change in the median and all six pairs agreeing on direction. This is a noise filter, not proof of a performance change or a CI gate. View all results
Values are medians of paired measurements. Not flagged does not mean unchanged. Unavailable means a measurement could not be provided, not zero. Estimated allocation measurements retain their instrumentation uncertainty. RSS measures the whole process, not just SDK allocations; observed peaks are sampled checkpoints. Paired ranges in the diagnostics describe variability, not confidence intervals. Each shard uses its own runner; compare Before PR against With PR within a row, not across shards. Compared 102 metric rows; 102 rows shown in all results. Omitted or shortened data remain in |
| pypi/posthog: patch | ||
| --- | ||
|
|
||
| `posthog.emails` sends emails, uploads attachments and reads email statuses through `/api/messaging/...`, which takes the project from the project secret API key. It no longer calls `/api/projects/@current/messaging/...`, since PostHog is removing the `@current` alias. A self-hosted PostHog older than these routes answers these calls with 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 354c4a7: "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>
posthog-python now sends transactional emails, uploads attachments, and reads statuses through the key-scoped /api/messaging/ paths (PostHog/posthog-python#1275). Say on the Python page that these need PostHog Cloud, or a self-hosted PostHog from 2026-11-18 or later, and that older self-hosted versions answer with a 404. The change is not released yet. Its only pending changeset is a patch on 8.0.1, so the page names 8.0.2 as the first version with the new paths. Generated-By: PostHog Desktop Task-Id: 84d4e062-c5f3-423d-9da2-29044f6e2abc
💡 Motivation and Context
posthog.emailscalls/api/projects/@current/messaging/.... PostHog is removing the@currentalias, 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 email client onto 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. A self-hosted PostHog older than PostHog/posthog#137605 answers these calls with 404.
💚 How did you test it?
pytest posthog/test/test_emails.py --timeout=30: 199 passed. The tests now expect the new URLs.ruff format --checkandruff checkon the changed files.📝 Checklist
If releasing new changes
sampo addto generate a changeset file🤖 Agent context
Autonomy: Human-driven (agent-assisted)
claude-opus-5-5).remote_configandllm_promptscalls still use@currentand are left for a separate change.posthog.🤖 Generated with Claude Code