Affinity Design
Agency Guide

Connecting Meta Ads

Integrate Facebook and Instagram Ads with af-gemini-connect

Overview

Connecting Meta Ads enables powerful advertising automation:

  • Campaign creation and management
  • Audience targeting and optimization
  • Ad creative generation
  • Performance monitoring
  • Automated budget allocation

This guide walks you through setting up the Meta Ads connection.

Prerequisites

Before you begin, ensure you have:

  • Meta Business Suite account with admin access
  • Facebook Page with publishing permissions
  • Instagram Professional Account (optional, for IG ads)
  • Meta Ads API access enabled
  • af-gemini-connect account with integration permissions

Step-by-Step Connection

1. Create a Meta App

  1. Go to Meta for Developers
  2. Log in with your agency account
  3. Click My AppsCreate App
  4. Select Business as the app type
  5. Enter app details:
    • App Name: af-gemini-connect
    • Contact Email: [email protected]
    • App Purpose: Manage ads and business assets
  6. Click Create

2. Configure App Settings

  1. In your new app, go to SettingsBasic
  2. Add PlatformWebsite
  3. Enter your website URL: https://your-domain.com
  4. Go to ProductsMarketing API
  5. Click Create Token
  6. Generate a System User token with ads management permissions

3. Create a System User

  1. Go to RolesSystem Users
  2. Click Create System User
  3. Enter a name (e.g., "af-gemini-connect Bot")
  4. Assign the following permissions:
    • ads_read
    • ads_management
    • pages_read_engagement
    • pages_manage_posts
    • instagram_basic_display
  5. Generate an access token with these permissions

4. Connect Business Assets

  1. Go to App Review
  2. Click Start a Submission
  3. Request the following permissions:
    • ads_management
    • pages_read_engagement
    • pages_manage_posts
    • instagram_basic_display
  4. Submit for review (this can take 1-3 business days)

5. Configure Connection in af-gemini-connect

  1. In af-gemini-connect, go to AdminIntegrations
  2. Select Meta Ads tab
  3. Click Connect Meta Ads
  4. Enter your App ID and App Secret
  5. Click Authenticate
  6. Approve the OAuth consent screen

6. Select Business Assets

After authentication, select which assets to connect:

  • Ad Accounts — Choose which ad accounts to manage
  • Facebook Pages — Select pages for instant experience
  • Instagram Accounts — Connect professional IG accounts
  • Business Manager — Link your entire business suite

Connection Health Monitoring

Once connected, monitor your Meta Ads integration in the Integrations dashboard:

  • Connection Status: Active/Inactive
  • API Limits: Usage vs. rate limits
  • Last Sync: When campaign data was last refreshed
  • Error Logs: Any API errors or failures

Troubleshooting

"App not configured" error

  • Verify your app is in development mode and has the required permissions
  • Ensure you've completed the app review process
  • Check that your system user has the correct permissions

Missing ad accounts or pages

  • Confirm you have admin access to the assets
  • Check that assets are part of your Business Manager
  • Verify the assets are assigned to the correct app

API rate limit errors

  • Review your API usage in the Meta for Developers dashboard
  • Implement exponential backoff in your requests
  • Request a quota increase if needed

Token expiration issues

  • Ensure your system user token has the correct expiration
  • Set up automatic token refresh using the app secret
  • Monitor token health in the integrations dashboard

Best Practices

  1. Use a dedicated business account for your agency's API access
  2. Set up proper permission tiers so team members have appropriate access
  3. Monitor API usage to avoid hitting rate limits
  4. Regularly review connected assets to ensure they're still active
  5. Implement error handling to gracefully handle API failures

Next Steps

After connecting Meta Ads, you can:

  • Set up automated campaign creation
  • Configure audience targeting rules
  • Generate ad creatives with AI
  • Set up performance monitoring dashboards
  • Implement budget optimization algorithms

FAQ

Q: Can I connect multiple Meta Business accounts?
A: Yes, you can connect multiple business accounts, but each client should have their own dedicated connection.

Q: How often does data sync?
A: Sync frequency is configurable from every 15 minutes to daily.

Q: What happens if I disconnect an asset?
A: Disconnecting will stop data collection and may affect automated campaigns.

Q: Are there limits on API calls?
A: Yes, Meta imposes rate limits. Monitor usage in the developer dashboard.

Q: Can I manage Instagram ads without a professional account?
A: No, Instagram ads require a professional account linked to a Facebook Page.

On this page