: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(data-warehouse): add 1 missing table to the Freshcaller source (#124316)
Tom Owers31f105e87e21
diff --git a/posthog/test/repo_invariants/dataclass_frozen_baseline.txt b/posthog/test/repo_invariants/dataclass_frozen_baseline.txtindex 2e613da51391..89ca409c83b9 100644--- a/posthog/test/repo_invariants/dataclass_frozen_baseline.txt+++ b/posthog/test/repo_invariants/dataclass_frozen_baseline.txt@@ -556,7 +556,6 @@1 products/warehouse_sources/backend/temporal/data_imports/sources/fred/fred.py1 products/warehouse_sources/backend/temporal/data_imports/sources/fred/settings.py1 products/warehouse_sources/backend/temporal/data_imports/sources/freshcaller/freshcaller.py-1 products/warehouse_sources/backend/temporal/data_imports/sources/freshcaller/settings.py1 products/warehouse_sources/backend/temporal/data_imports/sources/freshchat/freshchat.py1 products/warehouse_sources/backend/temporal/data_imports/sources/freshchat/settings.py1 products/warehouse_sources/backend/temporal/data_imports/sources/freshdesk/freshdesk.pydiff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/COVERAGE_GAPS_APPENDIX.md b/products/warehouse_sources/backend/temporal/data_imports/sources/COVERAGE_GAPS_APPENDIX.mdindex 0953987ede48..82307369cf23 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/COVERAGE_GAPS_APPENDIX.md+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/COVERAGE_GAPS_APPENDIX.md@@ -4938,7 +4938,7 @@ Today (4): `call_metrics`, `calls`, `teams`, `users`Diffed against: <https://developers.freshcaller.com/api/>-- [ ] `/api/v1/user-statuses` — lookup resolving the custom agent status IDs on users and call legs (available/break/etc) (medium)+- [x] `/api/v1/user-statuses` — lookup resolving the custom agent status IDs on users and call legs (available/break/etc) (medium)Note: Freshcaller's public API is genuinely small - calls, call_metrics (with include=life_cycle), teams, users, user-statuses, plus recording download/delete and an account export job. PostHog covers 4 of the 5 listable collections; call recordings are per-call binaries, not a queryable collection.diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/freshcaller/canonical_descriptions.py b/products/warehouse_sources/backend/temporal/data_imports/sources/freshcaller/canonical_descriptions.pyindex 4ac3facd7473..3eed1dac77d2 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/freshcaller/canonical_descriptions.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/freshcaller/canonical_descriptions.py@@ -40,6 +40,18 @@ CANONICAL_DESCRIPTIONS: CanonicalDescriptions = {"omni_channel": "Whether omni-channel routing is enabled for the team.",},},+ "user_statuses": {+ "description": "A default or custom availability status that Freshcaller users can select.",+ "docs_url": "https://developers.freshcaller.com/api/#user_status_object",+ "columns": {+ "id": "Unique identifier for the status. Users reference it as their browser or mobile status.",+ "name": "Descriptive name of the status.",+ "status_type": "Real-time availability (offline, online, busy, or acw).",+ "status_sub_type": "Sub-type of the status (offline, online, online_phone, busy, or acw).",+ "emoji": "Emoji associated with the status.",+ "enabled": "Whether the status is enabled for all users (0 or 1).",+ },+ },"calls": {"description": "A phone call handled through Freshcaller, inbound or outbound.","docs_url": "https://developers.freshcaller.com/api/#calls",diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/freshcaller/settings.py b/products/warehouse_sources/backend/temporal/data_imports/sources/freshcaller/settings.pyindex b2e0511b18e9..8ef996f40896 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/freshcaller/settings.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/freshcaller/settings.py@@ -15,7 +15,7 @@ PER_PAGE = 1000DEFAULT_START_DATETIME = "2022-01-01T00:00:00Z"-@dataclass+@dataclass(frozen=True)class FreshcallerEndpointConfig:name: strpath: str@@ -23,7 +23,7 @@ class FreshcallerEndpointConfig:# (e.g. {"users": [...], "meta": {...}}); `data_key` is that key.data_key: str# `True` only where the list endpoint honors a genuine server-side `by_time` window on- # `created_time`. `users`/`teams` expose no time filter -> full refresh only.+ # `created_time`. `users`/`teams`/`user_statuses` expose no time filter -> full refresh only.supports_incremental: bool = Falseincremental_fields: list[IncrementalField] = field(default_factory=list)# Stable datetime field used for partitioning. Always a creation timestamp, never a@@ -61,6 +61,13 @@ FRESHCALLER_ENDPOINTS: dict[str, FreshcallerEndpointConfig] = {path="/api/v1/teams",data_key="teams",),+ # The reference lists this collection under the hyphenated path but names the objects+ # `user_statuses` (e.g. `user_statuses.id` on users), so that is the wrapper key.+ "user_statuses": FreshcallerEndpointConfig(+ name="user_statuses",+ path="/api/v1/user-statuses",+ data_key="user_statuses",+ ),"calls": FreshcallerEndpointConfig(name="calls",path="/api/v1/calls",diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/freshcaller/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/freshcaller/source.pyindex ab156ac375c7..51e92dcbfbbf 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/freshcaller/source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/freshcaller/source.py@@ -29,8 +29,8 @@ from products.warehouse_sources.backend.temporal.data_imports.sources.generated_)from products.warehouse_sources.backend.types import ExternalDataSourceType-# This first cut covers Freshcaller's top-level v1 list endpoints (Users, Teams, Calls, Call-# Metrics). Account-level data export is an asynchronous request/poll job rather than a list+# This first cut covers Freshcaller's top-level v1 list endpoints (Users, Teams, User Statuses,+# Calls, Call Metrics). Account-level data export is an asynchronous request/poll job rather than a list# endpoint, and recording download/delete are per-call side endpoints — both are intentionally# left out of this first cut. There is no webhook management API.diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/freshcaller/tests/test_freshcaller.py b/products/warehouse_sources/backend/temporal/data_imports/sources/freshcaller/tests/test_freshcaller.pyindex 63521ca1413a..02e436e7903d 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/freshcaller/tests/test_freshcaller.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/freshcaller/tests/test_freshcaller.py@@ -50,17 +50,25 @@ class TestFormatDatetime:class TestPagination:- def test_paginates_by_page_number_and_saves_state(self) -> None:+ @pytest.mark.parametrize(+ "endpoint, data_key, path",+ [+ ("calls", "calls", "/api/v1/calls"),+ ("user_statuses", "user_statuses", "/api/v1/user-statuses"),+ ],+ )+ def test_paginates_by_page_number_and_saves_state(self, endpoint: str, data_key: str, path: str) -> None:result = _driver().run(- "calls",+ endpoint,[- _page("calls", [{"id": 1}], current=1, total_pages=2),- _page("calls", [{"id": 2}], current=2, total_pages=2),+ _page(data_key, [{"id": 1}], current=1, total_pages=2),+ _page(data_key, [{"id": 2}], current=2, total_pages=2),],)assert result.raised is Noneassert result.rows == [{"id": 1}, {"id": 2}]+ assert result.paths == [path, path]assert result.params("page") == ["1", "2"]# State saved once, pointing at page 2 (the next page after the first was written).assert result.saved_states == [FreshcallerResumeConfig(page=2)]