Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(workflows): point the transactional email snippet at the send endpoint (#126153)

Harley Alexander82213405c481
diff --git a/products/workflows/frontend/TemplateLibrary/TransactionalEmailApiExample.tsx b/products/workflows/frontend/TemplateLibrary/TransactionalEmailApiExample.tsx
index 778b66644edb..8f35f9e076fd 100644
--- a/products/workflows/frontend/TemplateLibrary/TransactionalEmailApiExample.tsx
+++ b/products/workflows/frontend/TemplateLibrary/TransactionalEmailApiExample.tsx
@@ -18,10 +18,12 @@ export function TransactionalEmailApiExample({
const messageData = variables?.length
? `{ ${variables.map((name) => `"${name}": "..."`).join(', ')} }`
: '{ "first_name": "Jane", "reset_link": "https://example.com/reset" }'
- const snippet = `curl -X POST ${window.location.origin}/api/projects/${currentTeamIdStrict}/messaging_templates/${templateId}/send/ \\
+ const snippet = `curl -X POST ${window.location.origin}/api/projects/${currentTeamIdStrict}/messaging/send/email/ \\
-H "Authorization: Bearer $POSTHOG_PROJECT_SECRET_API_KEY" \\
-H "Content-Type: application/json" \\
+ -H "Idempotency-Key: password-reset-123" \\
-d '{
+ "template": { "id": "${templateId}" },
"identifiers": { "distinct_id": "jane-distinct-id" },
"message_data": ${messageData}
@@ -47,6 +49,10 @@ export function TransactionalEmailApiExample({
<code>identifiers.distinct_id</code> is the person the send is recorded against. Leave it out and
the recipient's email address is used.
</li>
+ <li>
+ <code>Idempotency-Key</code> makes a retry safe. A send with the same key within 24 hours returns
+ the first send's message ID instead of sending the email again.
+ </li>
</ul>
<CodeSnippet language={Language.Bash}>{snippet}</CodeSnippet>
</div>