feat(meta-ads): add meta ads integration for campaign and ad performance queries#3563
feat(meta-ads): add meta ads integration for campaign and ad performance queries#3563waleedlatif1 wants to merge 9 commits intostagingfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview Introduces five new tool implementations ( Adds UX support for cascading selectors via new selector keys ( Written by Cursor Bugbot for commit b339b48. Configure here. |
Greptile SummaryThis PR adds a full Meta Ads integration with 5 read-only tools (get account info, list campaigns, list ad sets, list ads, get performance insights), OAuth wiring via the Facebook Graph API v24.0, and cascading account/campaign dropdown selectors. The implementation is well-structured and consistent with the patterns used by other integrations in the codebase. Key issues found:
Confidence Score: 1/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant UI as Block UI
participant Selector as Selector Registry
participant AccountsAPI as /api/tools/meta_ads/accounts
participant CampaignsAPI as /api/tools/meta_ads/campaigns
participant Tool as Tool Runner
participant MetaAPI as graph.facebook.com/v24.0
UI->>Selector: Credential selected
Selector->>AccountsAPI: POST {credential, workflowId}
AccountsAPI->>MetaAPI: GET /me/adaccounts
MetaAPI-->>AccountsAPI: [{id, account_id, name, account_status}]
AccountsAPI-->>Selector: {accounts: [{id, name}]}
Selector-->>UI: Populate account dropdown
UI->>Selector: Account selected
Selector->>CampaignsAPI: POST {credential, workflowId, accountId}
CampaignsAPI->>MetaAPI: GET /act_{id}/campaigns
MetaAPI-->>CampaignsAPI: [{id, name, status}]
CampaignsAPI-->>Selector: {campaigns: [{id, name, status}]}
Selector-->>UI: Populate campaign dropdown
UI->>Tool: Execute (operation, accountId, campaignId, ...)
Tool->>MetaAPI: GET /act_{id}/{resource}?fields=...
MetaAPI-->>Tool: {data: [...]}
Tool-->>UI: Transformed output
|
…nce queries - Add 5 tools: get_account, list_campaigns, list_ad_sets, list_ads, get_insights - Add account and campaign selectors with cascading dropdown support - Add OAuth config with ads_read scope - Generate docs
…um date preset to docs - Pass access token via Authorization header instead of URL query param in getUserInfo, matching all other providers - Add missing 'maximum' date preset to tool param description and docs
f11f141 to
bb8b314
Compare
Addressing Review Comments1.
|
|
@greptile |
|
@cursor review |
- Use useId() for MetaAdsIcon SVG gradient IDs to prevent collisions when multiple instances render on the same page - Filter conversions to only count actual conversion action types (offsite_conversion, onsite_conversion, app_custom_event) instead of summing all actions
|
@cursor review |
|
@greptile review |
…rity, account statuses, DELETED filter - Add stripActPrefix() helper to prevent act_ double-prefix bug when users provide prefixed IDs - Clarify totalCount descriptions to indicate response-level count (not total in account) - Show all ad accounts in selector with status badges instead of silently filtering to active only - Add DELETED to status filter dropdown options Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
All 4 issues from the Greptile review have been addressed in b339b48: 1. 2. Misleading 3. Accounts selector silently excludes non-active accounts — Fixed. Now shows all accounts regardless of status. Non-active accounts get a status badge appended to their name (e.g., "My Account (Disabled)", "My Account (Pending Risk Review)"). 4. |
|
@cursor review |
|
@greptile review |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 2 total unresolved issues (including 1 from previous review).
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
…th connect Meta's auth code flow returns a short-lived token (~1-2h) with no refresh token. Add fb_exchange_token call in account.create.after hook to exchange for a long-lived token (~60 days), following the same pattern as Salesforce's post-connect token handling. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…s in conversions The conversion filter was only matching offsite_conversion.* subtypes but missing onsite_conversion.* and app_custom_event.* subtypes, which the Meta API commonly returns at the subtype level. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Summary
ads_readscope for read-only operationsType of Change
Testing
Tested manually
Checklist