: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 Instagram API version v26.0 (#86323)
Tom Owersccbcdf836036
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/instagram/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/instagram/source.pyindex 054efeac63cf..89a523327fb2 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/instagram/source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/instagram/source.py@@ -59,8 +59,8 @@ class InstagramSource(ResumableSource[InstagramSourceConfig, InstagramResumeConfapi_docs_url = "https://developers.facebook.com/docs/instagram-platform"# Meta pins the Graph API by URL path segment and keeps each version alive for# roughly two years, so the pin is a real choice rather than a constant.- supported_versions = ("v22.0", "v23.0")- default_version = "v23.0"+ supported_versions = ("v22.0", "v23.0", "v26.0")+ default_version = "v26.0"lists_tables_without_credentials = Truediff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/instagram/tests/test_instagram_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/instagram/tests/test_instagram_source.pyindex 80b82081107a..577e7db93290 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/instagram/tests/test_instagram_source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/instagram/tests/test_instagram_source.py@@ -115,7 +115,10 @@ class TestInstagramSource:def test_the_graph_api_version_is_pinned_to_something_the_code_calls(self) -> None:assert self.source.default_version in self.source.supported_versions- assert self.source.resolve_api_version(None) == "v23.0"+ # New sources land on the newest Graph API version; an unpinned row resolves to it too.+ assert self.source.resolve_api_version(None) == "v26.0"+ # An existing pin is honored verbatim so older sources keep hitting their own version path.+ assert self.source.resolve_api_version("v23.0") == "v23.0"assert self.source.api_docs_url is not None and self.source.api_docs_url.startswith("https://")def test_get_schemas_lists_every_endpoint(self) -> None:@@ -189,7 +192,7 @@ class TestInstagramSource:assert validate.call_args.kwargs["access_token"] == "refreshed-token"assert validate.call_args.kwargs["instagram_account_id"] == ACCOUNT_ID- assert validate.call_args.kwargs["api_version"] == "v23.0"+ assert validate.call_args.kwargs["api_version"] == "v26.0"def test_validate_credentials_fails_cleanly_when_the_connection_is_gone(self) -> None:with (@@ -252,7 +255,10 @@ class TestInstagramSource:# Each table checkpoints a URL built for its own edge, so the Redis slots differ.assert media._key != comments._key- def test_source_for_pipeline_syncs_with_the_connection_token(self) -> None:+ # Each supported version's pin must reach the request layer verbatim, so a source pinned to+ # an older Graph API version keeps hitting its own path once v26.0 is the default.+ @pytest.mark.parametrize("pinned_version", ["v22.0", "v23.0", "v26.0"])+ def test_source_for_pipeline_syncs_with_the_connection_token(self, pinned_version: str) -> None:config = InstagramSourceConfig(instagram_integration_id=7, instagram_account_id=ACCOUNT_ID, start_date="2024-01-01")@@ -260,7 +266,7 @@ class TestInstagramSource:"media",should_use_incremental_field=True,db_incremental_field_last_value="2024-06-01T00:00:00+0000",- api_version="v22.0",+ api_version=pinned_version,)with (@@ -272,7 +278,7 @@ class TestInstagramSource:kwargs = build_source.call_args.kwargsassert kwargs["access_token"] == "refreshed-token"assert kwargs["endpoint"] == "media"- assert kwargs["api_version"] == "v22.0"+ assert kwargs["api_version"] == pinned_versionassert kwargs["instagram_account_id"] == ACCOUNT_IDassert kwargs["start_date"] == "2024-01-01"assert kwargs["should_use_incremental_field"] is True