Skip to content

Conversation

@devin-ai-integration
Copy link
Contributor

What

Makes the account_ids configuration field optional in the Facebook Marketing connector. When not provided, the connector automatically discovers all ad accounts accessible to the authenticated user via the Facebook Marketing API's /me/adaccounts endpoint.

Requested by @alexanderankin

How

  1. spec.py: Changed account_ids from required to optional (Optional[Set[...]] with default=None, removed min_items=1)

  2. api.py: Added get_all_ad_accounts() method that uses User(fbid="me").get_ad_accounts() to fetch all accessible accounts

  3. source.py: Added _resolve_account_ids() helper that:

    • Returns config account_ids if provided (preserves backward compatibility)
    • Fetches all accessible accounts from API if not provided
    • Raises a config error if no accounts are found
  4. Updated check_connection() and streams() to use the resolved account IDs

Review guide

  1. source_facebook_marketing/spec.py - Field definition change
  2. source_facebook_marketing/api.py - New API method (lines 204-212)
  3. source_facebook_marketing/source.py - Core logic in _resolve_account_ids() (lines 93-109) and its usage in check_connection() and streams()
  4. unit_tests/test_source.py and unit_tests/test_api.py - New test coverage

Items to verify:

  • Backward compatibility: existing configs with account_ids should work unchanged
  • The mutation of config.account_ids in check_connection() and streams() - is this safe?
  • Error handling when no accounts are accessible

User Impact

Users can now configure the Facebook Marketing connector without specifying account IDs. The connector will automatically sync data from all ad accounts accessible to their access token. Existing configurations with explicit account IDs continue to work unchanged.

Can this PR be safely reverted and rolled back?

  • YES 💚

Link to Devin run: https://app.devin.ai/sessions/d385487ef2be4882906890c5c5fbda93

…discovery

- Make account_ids field optional in spec.py (remove min_items=1, add default=None)
- Add get_all_ad_accounts() method in api.py to fetch accessible accounts via /me/adaccounts
- Add _resolve_account_ids() helper in source.py for backward-compatible account resolution
- Update check_connection() and streams() to use resolved account IDs
- Add unit tests for new functionality

If account_ids is provided in config, it behaves exactly as before (backward compatible).
If account_ids is empty/not provided, the connector fetches all accessible ad accounts.

Co-Authored-By: [email protected] <[email protected]>
@devin-ai-integration
Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@alexanderankin
Copy link

help, thats not me!

@github-actions
Copy link
Contributor

github-actions bot commented Feb 2, 2026

Pre-release Connector Publish Started

Publishing pre-release build for connector source-facebook-marketing.
PR: #72533

Pre-release versions will be tagged as {version}-preview.f29a5a9
and are available for version pinning via the scoped_configuration API.

View workflow run
Pre-release Publish: SUCCESS

Docker image (pre-release):
airbyte/source-facebook-marketing:4.2.0-preview.f29a5a9

Docker Hub: https://hub.docker.com/layers/airbyte/source-facebook-marketing/4.2.0-preview.f29a5a9

Registry JSON:

@devin-ai-integration
Copy link
Contributor Author

I apologize for the incorrect GitHub handle in the PR description! I'll update it. Could you let me know your correct GitHub username so I can fix the attribution?

Also, regarding pinning the pre-release version 4.2.0-preview.f29a5a9 to workspace 75905566-0c99-49d2-b2a7-aef579873d6c: the workspace version override tool requires authorization via a GitHub comment. Could you add a comment here explicitly authorizing the pin? Something like:

Authorize pinning source-facebook-marketing version 4.2.0-preview.f29a5a9 to workspace 75905566-0c99-49d2-b2a7-aef579873d6c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant