: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(warehouse_sources): support whop API version 2026-10-29-8 (#126944)
Tom Owers74a30850c07a
diff --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 5e6bd03aa737..9ebefc4d1eed 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@@ -13232,6 +13232,7 @@ Diffed against: <https://raw.githubusercontent.com/whopio/whopsdk-python/main/re- [ ] `Courses (GET /api/v1/courses)` — identify course content associated with synced experiences and products (medium)- [ ] `Course students (GET /api/v1/course_students)` — measure enrollment and student participation by course (medium)- [ ] `Course lesson interactions (GET /api/v1/course_lesson_interactions)` — measure lesson engagement and learning progress (medium)+- [x] `External accounts (GET /api/v1/external_accounts)` — identify the social, ads, and marketing accounts connected to the company (low)Note: Read the official SDK reference and resource modules, including raw request paths and the production base URL. Individual reference pages supplied embedded OpenAPI schemas for legacy memberships, fees, reviews, and courses. Current documentation renames plans to variants and company filters to account filters, so some additions need version handling. Fees and member logs require parent loops; excluded credentials, uploads, and webhook delivery records.diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/whop/canonical_descriptions.py b/products/warehouse_sources/backend/temporal/data_imports/sources/whop/canonical_descriptions.pyindex 7ded157f619d..5e1402030389 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/whop/canonical_descriptions.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/whop/canonical_descriptions.py@@ -29,6 +29,7 @@ CANONICAL_DESCRIPTIONS: CanonicalDescriptions = {"metadata": "Custom key-value pairs for the membership (commonly used for software licensing, e.g., HWID). Max 50 keys, 100 chars per key, 500 chars per string value.","payment_collection_paused": "Whether recurring payment collection for this membership is temporarily paused by the company.","plan": "The plan the customer purchased to create this membership.",+ "variant_id": "The variant the buyer purchased, prefixed `plan_`.","product": "The product this membership grants access to.","promo_code": "The promotional code currently applied to this membership's billing. Null if no promo code is active.","renewal_period_end": "The end of the current billing period for this recurring membership. As a Unix timestamp. Null if the membership is not recurring.",@@ -67,6 +68,7 @@ CANONICAL_DESCRIPTIONS: CanonicalDescriptions = {"payment_method_type": "The type of payment instrument used for this payment (e.g., card, Cash App, iDEAL, Klarna, crypto). Null when the processor does not supply a type.","payments_failed": "The number of failed payment attempts for the payment.","plan": "The plan attached to this payment.",+ "variant_id": "The variant that was charged, prefixed `plan_`.","product": "The product this payment was made for","promo_code": "The promo code used for this payment.","refundable": "True only for payments that are `paid`, have not been fully refunded, and were processed by a payment processor that allows refunds.",@@ -131,6 +133,7 @@ CANONICAL_DESCRIPTIONS: CanonicalDescriptions = {"created_at": "The datetime the entry was created.","id": "The unique identifier for the entry.","plan": "The waitlisted plan that this entry is a signup for.",+ "variant_id": "The variant this signup belongs to, prefixed `plan_`.","product": "The product associated with this entry's waitlisted plan. Null if the plan is not tied to a product.","status": "The status of an entry to a waitlist.","user": "The user who submitted this waitlist entry.",@@ -182,6 +185,7 @@ CANONICAL_DESCRIPTIONS: CanonicalDescriptions = {"needs_response_by": "The deadline by which dispute evidence must be submitted. Null if no response deadline is set.","payment": "The original payment that was disputed.","plan": "The plan associated with the disputed payment. Null if the dispute is not linked to a specific plan.",+ "variant_id": "The variant the disputed payment was made on, prefixed `plan_`.","product": "The product associated with the disputed payment. Null if the dispute is not linked to a specific product.","reason": "A human-readable reason for the dispute.","reason_code": "The card network reason code for the dispute. Null when the payment processor did not provide one.",@@ -283,6 +287,7 @@ CANONICAL_DESCRIPTIONS: CanonicalDescriptions = {"mode": "The different modes a checkout can be set to.","payment_method_configuration": "The explicit payment method configuration for the session, if any. This currently only works in 'setup' mode. Use the plan's payment_method_configuration for payment method.","plan": "The plan to use for the checkout configuration",+ "variant": "Variant used for payment checkout. `null` in setup mode.","purchase_url": "A URL you can send to customers to complete a checkout. It looks like `/checkout/plan_xxxx?session={id}`","redirect_url": "The URL to redirect the user to after the checkout configuration is created",},@@ -338,4 +343,20 @@ CANONICAL_DESCRIPTIONS: CanonicalDescriptions = {"user": "The user whose token balance was affected by this transaction.",},},+ "external_accounts": {+ "description": "An external account is an account on another platform linked to a Whop account, such as a Facebook page, Instagram account, TikTok account, or Klaviyo account.",+ "docs_url": "https://docs.whop.com/api-reference/beta/external-accounts/external-account",+ "columns": {+ "error": "Why this external account currently can't be used for advertising — a failed share or a Meta-side restriction. Null when the account is healthy.",+ "external_id": "The platform-specific ID for this external account.",+ "id": "Unique identifier for the external account.",+ "name": "The display name of the external account on the platform.",+ "parent_external_account": "The external account this one belongs to on the platform, such as the Facebook page that owns an Instagram account. Null when the external account stands on its own, or when it is a partner.",+ "platform": "The platform the external account exists on.",+ "profile_picture_url": "The URL where the profile picture of the external account can be accessed.",+ "url": "The URL where the external account can be accessed on the platform. Null while a Whop-owned account is still being provisioned.",+ "username": "The username of the external account on the platform. Null while a Whop-owned account is still being provisioned, and on platforms without usernames, such as Klaviyo.",+ "verified": "Whether the external account is verified on the platform.",+ },+ },}diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/whop/settings.py b/products/warehouse_sources/backend/temporal/data_imports/sources/whop/settings.pyindex 84c46f848adc..280e7d310c22 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/whop/settings.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/whop/settings.py@@ -11,7 +11,8 @@ BASE_URL = "https://api.whop.com/api/v1"# source always sends the version pinned on the source instead of letting the key decide.WHOP_API_VERSION_2025_01_01 = "2025-01-01"WHOP_API_VERSION_2026_10_13_1 = "2026-10-13-1"-WHOP_API_VERSIONS = (WHOP_API_VERSION_2025_01_01, WHOP_API_VERSION_2026_10_13_1)+WHOP_API_VERSION_2026_10_29_8 = "2026-10-29-8"+WHOP_API_VERSIONS = (WHOP_API_VERSION_2025_01_01, WHOP_API_VERSION_2026_10_13_1, WHOP_API_VERSION_2026_10_29_8)API_VERSION_HEADER = "Api-Version-Date"# The query param that narrows a list to the connected company. Later versions renamed it, and@@ -20,6 +21,7 @@ API_VERSION_HEADER = "Api-Version-Date"COMPANY_FILTER_PARAM: dict[str, str] = {WHOP_API_VERSION_2025_01_01: "company_id",WHOP_API_VERSION_2026_10_13_1: "account_id",+ WHOP_API_VERSION_2026_10_29_8: "account_id",}WHOP_API_KEYS_URL = "https://whop.com/dashboard/developer"@@ -47,12 +49,22 @@ class WhopEndpointConfig:supports_created_after: bool = Falsepartition_key: str | None = "created_at"latest_path: str | None = None+ # The versions the endpoint is verified on. None means every supported version.+ versions: tuple[str, ...] | None = None+ # The versions whose webhook payloads match the endpoint's rows. None means every supported version.+ webhook_versions: tuple[str, ...] | None = Nonedef path_for(self, api_version: str) -> str:if api_version == WHOP_API_VERSION_2025_01_01:return self.pathreturn self.latest_path or self.path+ def served_on(self, api_version: str) -> bool:+ return self.versions is None or api_version in self.versions++ def webhooks_served_on(self, api_version: str) -> bool:+ return self.webhook_versions is None or api_version in self.webhook_versions+WHOP_ENDPOINTS: dict[str, WhopEndpointConfig] = {"memberships": WhopEndpointConfig(@@ -88,11 +100,14 @@ WHOP_ENDPOINTS: dict[str, WhopEndpointConfig] = {supports_direction=True,supports_created_after=True,),+ # From 2026-10-24 the list returns receipt-backed `pay_` invoices, while Whop documents `invoice.*`+ # payloads only for the legacy invoice object. Webhook rows would not match the polled rows."invoices": WhopEndpointConfig(path="/invoices",supports_created_at_order=True,supports_direction=True,supports_created_after=True,+ webhook_versions=(WHOP_API_VERSION_2025_01_01, WHOP_API_VERSION_2026_10_13_1),),"refunds": WhopEndpointConfig(path="/refunds",@@ -143,10 +158,25 @@ WHOP_ENDPOINTS: dict[str, WhopEndpointConfig] = {"affiliates": WhopEndpointConfig(path="/affiliates", company_id_required=True, supports_direction=True),"shipments": WhopEndpointConfig(path="/shipments"),"company_token_transactions": WhopEndpointConfig(path="/company_token_transactions", company_id_required=True),+ # Whop renamed social accounts to external accounts in 2026-10-06, and the 2025-01-01 contract+ # documents neither the path nor its company filter. The resource carries no `created_at`+ # column, so it only syncs as a full refresh.+ "external_accounts": WhopEndpointConfig(+ path="/external_accounts",+ supports_created_at_order=True,+ supports_direction=True,+ partition_key=None,+ versions=(WHOP_API_VERSION_2026_10_13_1, WHOP_API_VERSION_2026_10_29_8),+ ),}ENDPOINTS = tuple(WHOP_ENDPOINTS.keys())++def endpoints_for(api_version: str) -> tuple[str, ...]:+ return tuple(name for name, config in WHOP_ENDPOINTS.items() if config.served_on(api_version))++# Every Whop resource we sync exposes `created_at` as an immutable ISO 8601 datetime, and# `created_after` is the only server-side timestamp filter offered across the catalog. `/payments`# also takes `updated_after`, but its `order` enum has no `updated_at` column, so an updated_at@@ -214,7 +244,14 @@ SCHEMA_TO_WEBHOOK_EVENTS: dict[str, list[str]] = {WEBHOOK_SCHEMA_NAMES = tuple(SCHEMA_TO_WEBHOOK_EVENTS.keys())-ALL_WEBHOOK_EVENTS = sorted({event for events in SCHEMA_TO_WEBHOOK_EVENTS.values() for event in events})++def webhook_schema_names_for(api_version: str) -> tuple[str, ...]:+ return tuple(name for name in WEBHOOK_SCHEMA_NAMES if WHOP_ENDPOINTS[name].webhooks_served_on(api_version))+++def webhook_events_for(api_version: str) -> list[str]:+ return sorted({event for name in webhook_schema_names_for(api_version) for event in SCHEMA_TO_WEBHOOK_EVENTS[name]})+# Schema name -> the resource prefix shared by its event types. Whop names events# `<resource>.<action>` (e.g. `payment.succeeded`), so the hog template splits on the first dot anddiff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/whop/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/whop/source.pyindex d09cbba4748a..5ce02d9d160f 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/whop/source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/whop/source.py@@ -32,16 +32,16 @@ from products.warehouse_sources.backend.temporal.data_imports.sources.common.webfrom products.warehouse_sources.backend.temporal.data_imports.sources.generated_configs.whop import WhopSourceConfigfrom products.warehouse_sources.backend.temporal.data_imports.sources.whop import whop as api_clientfrom products.warehouse_sources.backend.temporal.data_imports.sources.whop.settings import (- ENDPOINTS,INCREMENTAL_FIELDS,MERGE_ONLY_ENDPOINTS,RESOURCE_TO_EVENT_PREFIX,SCHEMA_TO_WEBHOOK_EVENTS,- WEBHOOK_SCHEMA_NAMES,WHOP_API_KEYS_URL,WHOP_API_VERSION_2025_01_01,- WHOP_API_VERSION_2026_10_13_1,+ WHOP_API_VERSION_2026_10_29_8,WHOP_API_VERSIONS,+ endpoints_for,+ webhook_schema_names_for,)from products.warehouse_sources.backend.temporal.data_imports.sources.whop.whop import WhopResumeConfigfrom products.warehouse_sources.backend.types import ExternalDataSourceType@@ -79,7 +79,7 @@ class WhopSource(lists_tables_without_credentials = True # static endpoint catalog — safe for public docssupported_versions = WHOP_API_VERSIONS- default_version = WHOP_API_VERSION_2026_10_13_1+ default_version = WHOP_API_VERSION_2026_10_29_8api_docs_url = "https://docs.whop.com/developer/api/versioning"@property@@ -118,9 +118,9 @@ class WhopSource(f"Create a company API key in the [Developer tab]({WHOP_API_KEYS_URL}) of your Whop ""dashboard. Grant it read access to the resources you want to sync: ""`company:basic:read`, `member:basic:read`, `payment:basic:read`, "- "`access_pass:basic:read`, `plan:basic:read`, `promo_code:basic:read` and "- "`invoice:basic:read`, plus `developer:manage_webhook` if you want PostHog to "- "register the webhook for you."+ "`access_pass:basic:read`, `plan:basic:read`, `promo_code:basic:read`, "+ "`invoice:basic:read` and `social_account:read`, plus `developer:manage_webhook` if "+ "you want PostHog to register the webhook for you."),secret=True,),@@ -186,6 +186,9 @@ class WhopSource("Whop rejected the request for this table, so it can't sync. Turn off syncing for this ""table, then re-enable the sync."),+ "is not available on API version": (+ "This table isn't available on the Whop API version this source uses. Turn off syncing for this table."+ ),}def get_canonical_descriptions(self) -> CanonicalDescriptions:@@ -206,12 +209,13 @@ class WhopSource() -> list[SourceSchema]:# Endpoints with no `created_at` sort option page newest-first and stop at the watermark,# which re-yields boundary rows that only a merge on `id` can dedupe.+ pinned = self._api_version_date(api_version)return build_endpoint_schemas(- ENDPOINTS,+ endpoints_for(pinned),INCREMENTAL_FIELDS,names,merge_only=MERGE_ONLY_ENDPOINTS,- supports_webhooks=WEBHOOK_SCHEMA_NAMES,+ supports_webhooks=webhook_schema_names_for(pinned),)def validate_credentials(diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/whop/tests/test_whop.py b/products/warehouse_sources/backend/temporal/data_imports/sources/whop/tests/test_whop.pyindex 0d7d67132fdf..7b972c922bc6 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/whop/tests/test_whop.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/whop/tests/test_whop.py@@ -16,7 +16,6 @@ from products.warehouse_sources.backend.temporal.data_imports.sources.common.tes)from products.warehouse_sources.backend.temporal.data_imports.sources.generated_configs.whop import WhopSourceConfigfrom products.warehouse_sources.backend.temporal.data_imports.sources.whop.settings import (- ALL_WEBHOOK_EVENTS,BASE_URL,ENDPOINTS,PAGE_SIZE,@@ -39,7 +38,8 @@ from products.warehouse_sources.backend.temporal.data_imports.sources.whop.whopCOMPANY_ID = "biz_test"LEGACY = "2025-01-01"-LATEST = "2026-10-13-1"+PREVIOUS = "2026-10-13-1"+LATEST = "2026-10-29-8"SYNC_ENDPOINT = "payments"@@ -106,10 +106,13 @@ class TestApiVersion:"pinned, sent_version, filter_param, endpoint, path",[(LEGACY, LEGACY, "company_id", "entries", "/api/v1/entries"),+ (PREVIOUS, PREVIOUS, "account_id", "entries", "/api/v1/waitlist_entries"),(LATEST, LATEST, "account_id", "entries", "/api/v1/waitlist_entries"),# A row created by a pod still on the unversioned code during the deploy.("v1", LEGACY, "company_id", "products", "/api/v1/products"),(None, LATEST, "account_id", "products", "/api/v1/products"),+ (PREVIOUS, PREVIOUS, "account_id", "external_accounts", "/api/v1/external_accounts"),+ (LATEST, LATEST, "account_id", "external_accounts", "/api/v1/external_accounts"),],)def test_sync_sends_the_pinned_version(self, pinned, sent_version, filter_param, endpoint, path):@@ -120,6 +123,22 @@ class TestApiVersion:assert request.path == pathassert request.param(filter_param) == COMPANY_ID+ @pytest.mark.parametrize("pinned, served", [(LEGACY, False), ("v1", False), (PREVIOUS, True), (LATEST, True)])+ def test_discovery_follows_what_each_version_documents(self, pinned, served):+ schemas = WhopSource().get_schemas(+ WhopSourceConfig(api_key="test-api-key", company_id=COMPANY_ID), team_id=1, api_version=pinned+ )+ assert ("external_accounts" in {schema.name for schema in schemas}) is served+ invoices = next(schema for schema in schemas if schema.name == "invoices")+ assert invoices.supports_webhooks is (pinned != LATEST)++ def test_a_table_the_pin_does_not_serve_fails_before_any_request(self):+ result = _driver().run("external_accounts", [], api_version=LEGACY)++ assert isinstance(result.raised, ValueError)+ assert "not available on API version" in str(result.raised)+ assert result.requests == []+class TestPagination:def test_follows_end_cursor_and_saves_resume_state(self):@@ -211,16 +230,19 @@ WEBHOOK_URL = "https://ph.example/webhook"class TestCreateWebhook:@pytest.mark.parametrize(- "api_version, version_fields",+ "api_version, version_fields, registers_invoice_events",[# An unpinned v1 webhook delivers the "2025-01-01" shape the legacy pulls return.- (LEGACY, {"api_version": "v1"}),+ (LEGACY, {"api_version": "v1"}, True),# Later versions reject `api_version` with a 400, and the pin keeps deliveries in the# shape the latest pulls return.- (LATEST, {"api_version_date": LATEST}),+ (PREVIOUS, {"api_version_date": PREVIOUS}, True),+ # Receipt-backed invoices have no documented `invoice.*` payload, so webhook rows would+ # not match the polled ones.+ (LATEST, {"api_version_date": LATEST}, False),],)- def test_returns_the_generated_signing_secret(self, api_version, version_fields):+ def test_returns_the_generated_signing_secret(self, api_version, version_fields, registers_invoice_events):with scripted_network([ScriptedResponse(status=201, json={"id": "hook_1", "webhook_secret": "whsec_abc"})]) as network:@@ -229,13 +251,10 @@ class TestCreateWebhook:assert result.success is Trueassert result.extra_inputs == {"signing_secret": "whsec_abc"}payload = network.requests_log[0].json()- assert payload == {- "url": WEBHOOK_URL,- "events": ALL_WEBHOOK_EVENTS,- "resource_id": COMPANY_ID,- "enabled": True,- **version_fields,- }+ events = payload.pop("events")+ assert payload == {"url": WEBHOOK_URL, "resource_id": COMPANY_ID, "enabled": True, **version_fields}+ assert "payment.succeeded" in events+ assert ("invoice.paid" in events) is registers_invoice_events@pytest.mark.parametrize("status_code", [401, 403, 422, 500])def test_non_success_falls_back_to_manual_setup(self, status_code):diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/whop/tests/test_whop_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/whop/tests/test_whop_source.pyindex 8263325f2e10..bef03ab6c259 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/whop/tests/test_whop_source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/whop/tests/test_whop_source.py@@ -80,7 +80,12 @@ class TestWhopSource:@pytest.mark.parametrize("method_name", ["create_webhook", "delete_webhook", "get_external_webhook_info"])@pytest.mark.parametrize("pinned, sent_version",- [("2025-01-01", "2025-01-01"), ("v1", "2025-01-01"), (None, "2026-10-13-1")],+ [+ ("2025-01-01", "2025-01-01"),+ ("v1", "2025-01-01"),+ ("2026-10-13-1", "2026-10-13-1"),+ (None, "2026-10-29-8"),+ ],)def test_webhook_management_passes_the_connected_company(self, method_name, pinned, sent_version):# The webhook endpoints require the company, and a webhook created under the wrong version@@ -104,7 +109,7 @@ class TestWhopSource:"biz_test",WEBHOOK_URL,sorted(SCHEMA_TO_WEBHOOK_EVENTS["refunds"]),- "2026-10-13-1",+ "2026-10-29-8",)def test_source_for_pipeline_plumbs_the_sync_inputs(self):diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/whop/whop.py b/products/warehouse_sources/backend/temporal/data_imports/sources/whop/whop.pyindex 84aaf03890f3..f00c9de28428 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/whop/whop.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/whop/whop.py@@ -29,15 +29,15 @@ from products.warehouse_sources.backend.temporal.data_imports.sources.common.soufrom products.warehouse_sources.backend.temporal.data_imports.sources.common.typings import SourceResponsefrom products.warehouse_sources.backend.temporal.data_imports.sources.common.webhook_s3 import WebhookSourceManagerfrom products.warehouse_sources.backend.temporal.data_imports.sources.whop.settings import (- ALL_WEBHOOK_EVENTS,API_VERSION_HEADER,BASE_URL,COMPANY_FILTER_PARAM,PAGE_SIZE,- WEBHOOK_SCHEMA_NAMES,WHOP_API_VERSION_2025_01_01,WHOP_ENDPOINTS,sort_mode_for,+ webhook_events_for,+ webhook_schema_names_for,)REQUEST_TIMEOUT = 30@@ -140,6 +140,8 @@ def whop_source(db_incremental_field_last_value: Optional[Any] = None,) -> SourceResponse:config = WHOP_ENDPOINTS[endpoint]+ if not config.served_on(api_version):+ raise ValueError(f"Whop table {endpoint} is not available on API version {api_version}")watermark = _parse_datetime(db_incremental_field_last_value) if should_use_incremental_field else Nonerest_config: RESTAPIConfig = {@@ -196,7 +198,7 @@ def whop_source()webhook_enabled = False- if webhook_source_manager is not None and endpoint in WEBHOOK_SCHEMA_NAMES:+ if webhook_source_manager is not None and endpoint in webhook_schema_names_for(api_version):webhook_enabled = async_to_sync(webhook_source_manager.webhook_enabled)(webhook_only=False)def items():@@ -313,7 +315,7 @@ def create_webhook(api_key: str, company_id: str, webhook_url: str, api_version:"""body: dict[str, Any] = {"url": webhook_url,- "events": ALL_WEBHOOK_EVENTS,+ "events": webhook_events_for(api_version),"resource_id": company_id,"enabled": True,}