: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
fix(appsflyer): show where to find the app id during setup (#127429)
Tom Owers5f58ae7fa4f9
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/appsflyer/appsflyer.py b/products/warehouse_sources/backend/temporal/data_imports/sources/appsflyer/appsflyer.pyindex 2cb25b748d9d..cee9b68a6ea0 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/appsflyer/appsflyer.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/appsflyer/appsflyer.py@@ -300,8 +300,8 @@ def validate_credentials(api_token: str, app_id: str) -> bool:app = _validate_app_id(app_id)except ValueError:raise AppsFlyerCredentialsError(- "The AppsFlyer app id looks invalid. Use your app's identifier from the dashboard "- "(e.g. 'id123456789' for iOS or the package name for Android)."+ "That AppsFlyer app ID isn't valid. In AppsFlyer, open My apps and copy the ID under your app name, "+ "such as 'id123456789' or 'com.example.app'.") from None# http.client encodes headers as latin-1, so a smart quote pasted with the token would crash the request.if not _normalize_token(api_token).isascii():@@ -338,7 +338,9 @@ def validate_credentials(api_token: str, app_id: str) -> bool:)if response.status_code == 404:raise _credentials_error(- "AppsFlyer couldn't find an app with that app id. Please check the app id.", response, api_token+ "AppsFlyer couldn't find an app with that app ID. In AppsFlyer, open My apps and copy the ID under your app name.",+ response,+ api_token,)# Any other status is unexpected (e.g. a 400 from a malformed request) — surface the real# code rather than blaming the token or app id, which sends users debugging the wrong thing.diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/appsflyer/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/appsflyer/source.pyindex 1dded56669a2..2e2f8b5848b8 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/appsflyer/source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/appsflyer/source.py@@ -130,7 +130,7 @@ class AppsFlyerSource(SimpleSource[AppsFlyerSourceConfig]):label="AppsFlyer",caption="""Enter your AppsFlyer credentials to pull aggregate performance reports and raw event data into the PostHog Data warehouse.-You can find your API token (V2) in AppsFlyer under your account menu > Security center > AppsFlyer API tokens. The app id is your app's identifier as shown in the dashboard (e.g. `id123456789` for iOS or the package name for Android). Add one source per app.+You can find your API token (V2) in AppsFlyer under your account menu > Security center > AppsFlyer API tokens. You can find your app ID in AppsFlyer on the My apps page, under the app name (e.g. `id123456789` for iOS or the package name for Android). Add one source per app.Raw data tables (installs, in-app events, uninstalls, retargeting conversions, ad revenue and the Protect360 fraud reports) and the Master API report need an AppsFlyer subscription that covers them. Protect360 is a separate add-on. AppsFlyer limits raw data to the last 90 days.""",iconPath="/static/services/appsflyer.png",@@ -145,6 +145,7 @@ Raw data tables (installs, in-app events, uninstalls, retargeting conversions, atype=SourceFieldInputConfigType.TEXT,required=True,placeholder="id123456789",+ caption="In AppsFlyer, open My apps and copy the ID under your app name, such as `id123456789` for iOS or `com.example.app` for Android.",secret=False,),SourceFieldInputConfig(diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/appsflyer/tests/test_appsflyer.py b/products/warehouse_sources/backend/temporal/data_imports/sources/appsflyer/tests/test_appsflyer.pyindex 9d9f47e7bab5..e8b82941d92c 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/appsflyer/tests/test_appsflyer.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/appsflyer/tests/test_appsflyer.py@@ -117,7 +117,7 @@ class TestValidateCredentials:# 401 means the token is bad; 403/404 mean the app id (or subscription) is the problem.(401, "API token"),(403, "denied access"),- (404, "app id"),+ (404, "My apps"),],)def test_validate_credentials_distinguishes_token_from_app_id(@@ -160,7 +160,7 @@ class TestValidateCredentials:@pytest.mark.parametrize("api_token, app_id, expected_substring",[- ("token", "bad app!", "app id"),+ ("token", "bad app!", "My apps"),("token\u201d", "id123", "API token"),("\u201ctoken\u201d", "id123", "API token"),],