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 supporting infrastructure: new Next.js API routes for selector dropdown data ( Updates docs and UI assets by adding Written by Cursor Bugbot for commit b2bd567. 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 via the Facebook Marketing API, cascading account/campaign dropdowns, and auto-generated docs. The tool implementations, block config, selector registry, and OAuth provider wiring are generally well-structured and follow existing patterns. However, there is a critical bug in the OAuth Key changes:
Issues found:
Confidence Score: 1/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[User clicks Connect Meta Ads] --> B[OAuth redirect to Meta\nads_read permission]
B --> C[User grants permission]
C --> D[auth.ts linkAccount callback]
D --> E[Exchange short-lived token\nfor long-lived token via fb_exchange_token]
E --> F[Store long-lived token in DB]
F --> G[User opens Meta Ads block]
G --> H[accounts route:\nGET /me/adaccounts - limit=200]
H --> I[Account dropdown populated]
I --> J[User selects account]
J --> K[campaigns route:\nGET /act_id/campaigns - limit=200]
K --> L[Campaign dropdown populated]
L --> M{User selects operation}
M -->|get_account| N[GET /act_id]
M -->|list_campaigns| O[GET /act_id/campaigns]
M -->|list_ad_sets| P[GET /campaign_id or act_id/adsets]
M -->|list_ads| Q[GET /adset_id or campaign_id or act_id/ads]
M -->|get_insights| R[GET /parentId/insights\nlevel + date_preset]
N & O & P & Q & R --> S[transformResponse maps\nsnake_case to camelCase]
S --> T[Output returned to workflow]
|
…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 |
…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>
|
@cursor review |
|
@greptile review |
|
@greptile |
Summary
ads_readscope for read-only operationsType of Change
Testing
Tested manually
Checklist