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.5 KB
Raw Blame
from dataclasses import field

from products.warehouse_sources.sources.sdk import IncrementalField, frozen


@frozen
class SalesflareEndpointConfig:
    path: str
    # Salesflare object IDs are globally unique within an account, so `id` is a safe primary key.
    primary_keys: list[str] = field(default_factory=lambda: ["id"])
    # Some list endpoints (e.g. /stages) declare no `limit`/`offset` params and return every row at once.
    paginated: bool = True


# Salesflare Core API list endpoints. All are full-refresh only: while a few objects expose a
# `modification_after` filter, the API's ordering guarantees for that filter aren't documented
# well enough to advance an incremental cursor safely, so a client-side scan would cost the same
# as a full refresh (see the implementing-warehouse-sources skill).
SALESFLARE_ENDPOINTS: dict[str, SalesflareEndpointConfig] = {
    "contacts": SalesflareEndpointConfig(path="/contacts"),
    "accounts": SalesflareEndpointConfig(path="/accounts"),
    "opportunities": SalesflareEndpointConfig(path="/opportunities"),
    "pipelines": SalesflareEndpointConfig(path="/pipelines"),
    "tasks": SalesflareEndpointConfig(path="/tasks"),
    "tags": SalesflareEndpointConfig(path="/tags"),
    "workflows": SalesflareEndpointConfig(path="/workflows"),
    "stages": SalesflareEndpointConfig(path="/stages", paginated=False),
    "users": SalesflareEndpointConfig(path="/users"),
}

ENDPOINTS = tuple(SALESFLARE_ENDPOINTS.keys())

INCREMENTAL_FIELDS: dict[str, list[IncrementalField]] = {}