PostHog integration
Sendtide can forward delivery, open and click events to your PostHog project so you can connect email behavior with your product analytics. By default no email address leaves, only a hash.
PostHog is an optional destination that you set up yourself, with your own project. Nothing flows there until you do. PostHog is not a sub-processor of Sendtide, you are responsible for the data at the destination, see the DPA. Only a key with scope full or admin changes the setup, a test key cannot (403 test_key_forbidden).
Set up
In the dashboard under Integrations or through the API:
curl -X PUT https://api.sendtide.ch/v1/integrations/posthog \
-H "Authorization: Bearer $SENDTIDE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"api_key": "phc_abc123",
"host": "https://eu.i.posthog.com",
"events": ["delivered", "opened", "clicked", "bounced"],
"distinct_id": { "mode": "hashed" },
"metadata_keys": ["plan"]
}'
| Field | Meaning |
|---|---|
api_key |
the project API key (phc_…), required the first time. Personal keys (phx_…) do not work (422 invalid_posthog_key). It is never returned, only api_key_hint. |
host |
https://eu.i.posthog.com (default), https://us.i.posthog.com or the https URL of your own PostHog. Anything else gives 422 invalid_host. |
events |
which events you want, see below |
distinct_id |
how PostHog recognizes the recipient, see below |
metadata_keys |
up to 20 fields from the metadata of your emails that go along as properties |
enabled |
turns the integration on or off. Turning it on clears a disable reason. |
GET /v1/integrations/posthog shows the state (configured: false until it is set up), DELETE removes the integration with its key and delivery log. What is already at PostHog stays there. Without a setup the other endpoints answer 404 posthog_not_configured. POST /v1/integrations/posthog/test sends one sendtide_test event (without a person) and reports the answer of PostHog.
Events
Sendtide sends one event sendtide_email_<name> per recipient through the batch API of PostHog:
events |
Event in PostHog | from Sendtide event |
|---|---|---|
sent |
sendtide_email_sent |
email.sent |
delivered |
sendtide_email_delivered |
email.delivered |
opened |
sendtide_email_opened |
email.opened and email.machine_opened |
clicked |
sendtide_email_clicked |
email.clicked |
bounced |
sendtide_email_bounced |
email.bounced |
complained |
sendtide_email_complained |
email.complained |
unsubscribed |
sendtide_email_unsubscribed |
email.unsubscribed |
failed |
sendtide_email_failed |
email.failed |
Properties
| Property | Content |
|---|---|
$lib |
always sendtide |
sendtide_event_id |
the id of the event (evt_…), the same on every attempt |
recipient_domain |
domain of the recipient |
message_id, stream, tags, template |
id, stream, tags and template alias of the email |
metadata_<key> |
the metadata fields you allowed |
machine_open |
for opens: true when a privacy proxy or scanner opened |
link_url |
for clicks: the link that was clicked |
bounce_class, bounce_type |
for bounces: class (for example unknown_user) and type |
source, category |
for unsubscribes: source and category |
Who is the recipient? Privacy of distinct_id
With distinct_id.mode you decide what PostHog gets as an identifier:
| Mode | Identifier | Privacy |
|---|---|---|
hashed (default) |
SHA-256 of a per-account salt and the address | The address does not leave Sendtide. Sendtide sets $process_person_profile: false, so PostHog creates no person profile. |
metadata |
the field metadata_key from the metadata of the email, for example your user_id |
This connects the events with your users in PostHog without sending the address. If the field is missing, Sendtide falls back to the hashed identifier. |
plain |
the email address | Only if you explicitly want it and have a data processing agreement with PostHog. |
For the US cloud you are responsible for a lawful transfer to the USA. Pick the EU cloud to keep it simple.
Send past events (backfill)
Did you set up the integration later? POST /v1/integrations/posthog/backfill with {"days": 14} queues the selected events of the last 1 to 30 days, at most 50,000 (else 422 too_many_events). An event that already has a pending delivery is skipped, and PostHog drops events it already has (same event id). Unsubscribes are not part of a backfill.
Check deliveries
GET /v1/integrations/posthog/deliveries lists the deliveries to PostHog (status: pending, delivered, failed), POST …/deliveries/{delivery_id}/retry sends an event again. Deliveries retry errors as with webhooks. If you delete a person’s data in Sendtide, that does not reach what is already at PostHog.
Analysis inside Sendtide needs no forwarding: the Analytics API.