7 Endpunkte der Gruppe «Integrationen». Die Referenz stammt aus der englischen OpenAPI-Spezifikation und ist nicht übersetzt.
The PostHog integration
GET/v1/integrations/posthog
Sendtide forwards mail events to PostHog as sendtide_email_<type> (sent, delivered, opened, clicked, bounced, complained, unsubscribed, failed) through PostHog's batch capture API. PostHog is an optional recipient that you configure yourself with your own project; events go there only after you set it up. The project API key is never returned, only api_key_hint.
Beispiel
curl "https://api.sendtide.ch/v1/integrations/posthog" \
-H "Authorization: Bearer sk_test_…"
Antworten
| Status | Beschreibung |
200 | The integration (configured false when not set up) PostHogIntegration Felder der Antwort configured | boolean | | id | string | null | | enabled | boolean | | disabled_reason | string | null | | host | string | | api_key_hint | string | null | Example: phc_…ab12 | events | array<string> | | distinct_id | object | | distinct_id.mode | enum: hashed | plain | metadata | | distinct_id.metadata_key | string | | metadata_keys | array<string> | | success_rate_24h | number | null | | created_at | string | null (date-time) | | event_types | array<string> | | hosts | array<object> | | hosts[].id | string | | hosts[].url | string | |
|
Set up or change the PostHog integration
PUT/v1/integrations/posthog
api_key (the project API key, phc_...) is required the first time. host is https://eu.i.posthog.com (default), https://us.i.posthog.com or the https URL of a self-hosted PostHog. distinct_id.mode is hashed (default: SHA-256 of an account specific salt and the recipient address), plain (the address) or metadata (the field metadata_key of the send request's metadata, the hashed id when it is missing). Only the metadata_keys you list are sent along as metadata_<key> properties. Re-enabling clears a disable reason. Test keys cannot change it (403 test_key_forbidden).
Request-Body application/json
| Feld | Typ | Beschreibung |
api_key | string | Example: phc_abc123 |
host | string (uri) | |
events | array<enum: sent | delivered | opened | clicked | bounced | complained | unsubscribed | failed> | |
distinct_id | object | |
distinct_id.mode | enum: hashed | plain | metadata | |
distinct_id.metadata_key | string | Example: user_id |
metadata_keys | array<string> | |
enabled | boolean | |
Beispiel
curl -X PUT "https://api.sendtide.ch/v1/integrations/posthog" \
-H "Authorization: Bearer sk_test_…" \
-H "Content-Type: application/json" \
-d '{"api_key":"phc_abc123"}'
Antworten
| Status | Beschreibung |
200 | Updated PostHogIntegration Felder der Antwort configured | boolean | | id | string | null | | enabled | boolean | | disabled_reason | string | null | | host | string | | api_key_hint | string | null | Example: phc_…ab12 | events | array<string> | | distinct_id | object | | distinct_id.mode | enum: hashed | plain | metadata | | distinct_id.metadata_key | string | | metadata_keys | array<string> | | success_rate_24h | number | null | | created_at | string | null (date-time) | | event_types | array<string> | | hosts | array<object> | | hosts[].id | string | | hosts[].url | string | |
|
201 | Set up PostHogIntegration Felder der Antwort configured | boolean | | id | string | null | | enabled | boolean | | disabled_reason | string | null | | host | string | | api_key_hint | string | null | Example: phc_…ab12 | events | array<string> | | distinct_id | object | | distinct_id.mode | enum: hashed | plain | metadata | | distinct_id.metadata_key | string | | metadata_keys | array<string> | | success_rate_24h | number | null | | created_at | string | null (date-time) | | event_types | array<string> | | hosts | array<object> | | hosts[].id | string | | hosts[].url | string | |
|
422 | Fehler im üblichen Format, Fehler und Limits |
Remove the PostHog integration
DELETE/v1/integrations/posthog
Deletes the integration with its project key and its delivery log. Events already sent stay in PostHog.
Beispiel
curl -X DELETE "https://api.sendtide.ch/v1/integrations/posthog" \
-H "Authorization: Bearer sk_test_…"
Antworten
Send a test event to PostHog now
POST/v1/integrations/posthog/test
Sends one sendtide_test event (it creates no person) and reports PostHog's answer.
Beispiel
curl -X POST "https://api.sendtide.ch/v1/integrations/posthog/test" \
-H "Authorization: Bearer sk_test_…"
Antworten
| Status | Beschreibung |
200 | Result Felder der Antwort delivered | boolean | | status | integer | | duration_ms | integer | | error | string | |
|
404 | Fehler im üblichen Format, Fehler und Limits |
Send the events of the last days to PostHog
POST/v1/integrations/posthog/backfill
Queues the selected mail events of the last days (1 to 30, at most 50'000 events, else 422 too_many_events). An event that still has a pending delivery is skipped. PostHog drops events it already has (same event id). Unsubscribes are not part of a backfill.
Request-Body application/json
| Feld | Typ | Beschreibung |
days * | integer | |
Beispiel
curl -X POST "https://api.sendtide.ch/v1/integrations/posthog/backfill" \
-H "Authorization: Bearer sk_test_…" \
-H "Content-Type: application/json" \
-d '{"days":1}'
Antworten
Deliveries to PostHog, newest first
GET/v1/integrations/posthog/deliveries
Parameter
| Name | Ort | Typ | Beschreibung |
status | query | enum: pending | delivered | failed | |
limit | query | integer | Page size. The default and the maximum depend on the endpoint (emails 50 up to 500, received mail 50 up to 200, audit up to 200, the others 100 up to 500 or 1000). Default: 100 |
cursor | query | string | The next_cursor of the previous page. Opaque; pass it unchanged to the same endpoint with the same filters. |
Beispiel
curl "https://api.sendtide.ch/v1/integrations/posthog/deliveries" \
-H "Authorization: Bearer sk_test_…"
Antworten
| Status | Beschreibung |
200 | Deliveries Felder der Antwort data | array<WebhookDelivery> | | data[].id | integer | | data[].event_id | string | null | Example: evt_1042 | data[].event | enum: email.queued | email.sent | email.delivered | email.delayed | email.opened | email.machine_opened | email.clicked | email.bounced | email.complained | email.rejected | email.failed | email.suppressed | email.canceled | email.held | email.unsubscribed | email.received | | data[].status | enum: pending | delivered | failed | | data[].source | enum: event | retry | replay | | data[].attempts | integer | | data[].last_status | integer | null | | data[].last_error | string | null | | data[].duration_ms | integer | null | | data[].next_attempt_at | string | null (date-time) | | data[].created_at | string (date-time) | | next_cursor | string | null | |
|
Send the event of a delivery to PostHog again
POST/v1/integrations/posthog/deliveries/{delivery_id}/retry
Parameter
| Name | Ort | Typ | Beschreibung |
delivery_id * | path | integer | |
Beispiel
curl -X POST "https://api.sendtide.ch/v1/integrations/posthog/deliveries/42/retry" \
-H "Authorization: Bearer sk_test_…"
Antworten
| Status | Beschreibung |
202 | Queued Felder der Antwort id | integer | | status | enum: pending | |
|
404 | Fehler im üblichen Format, Fehler und Limits |
409 | Fehler im üblichen Format, Fehler und Limits |