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.

1.3 KB
Raw Blame
from products.warehouse_sources.sources.sdk import incremental_field

BASE_URL = "https://api.systeme.io/api/"
PAGE_SIZE = 100

ENDPOINTS = {
    "contacts": "contacts",
    "tags": "tags",
    "newsletters": "mailing/newsletters",
    "courses": "school/courses",
    "enrollments": "school/enrollments",
    "communities": "community/communities",
    "memberships": "community/memberships",
    "digital_products": "payment/digital-products",
    "physical_products": "payment/physical-products",
    "campaigns": "mailing/campaigns",
    "campaign_steps": "mailing/campaigns/{campaignId}/steps",
}

# Child endpoint -> parent endpoint whose `id` fills the child path's `{campaignId}`.
FANOUT_PARENTS = {"campaign_steps": "campaigns"}

INCREMENTAL_FIELDS = {"contacts": [incremental_field("registeredAt")]}
PARTITION_KEYS = {
    "contacts": "registeredAt",
    "tags": "createdAt",
    "digital_products": "createdAt",
    "physical_products": "createdAt",
}

AUTH_ERROR = "Systeme.io rejected your API key. Create a new key in your profile settings and reconnect."
PERMISSION_ERROR = "Your API key cannot access this Systeme.io resource. Check your account permissions and reconnect."
NON_RETRYABLE_ERRORS = {
    "401 Client Error": AUTH_ERROR,
    "403 Client Error": PERMISSION_ERROR,
}