Meta Ads AI Analysis & Upload Automation - n8n Workflow

members
4 min read
Meta Ads AI Analysis & Upload Automation - n8n Workflow

This advanced n8n workflow combines AI-powered content analysis with automated Meta Ads Manager upload functionality. The system automatically analyzes video and image assets using Google Gemini and OpenAI GPT-4.1, generating optimized ad copy variations, and then seamlessly uploads the complete campaigns to Meta Ads Manager. This workflow transforms raw creative assets into fully-configured Facebook and Instagram advertisements with AI-generated copy that's tailored for maximum engagement.

The automation features sophisticated AI agents that analyze visual content, extract key messaging elements, and generate multiple variations of primary text, headlines, and link descriptions optimized for paid social advertising performance.

Key Features

AI-Powered Content Analysis

  • Video Analysis with Gemini: Comprehensive video content analysis including transcription, scene description, hook identification, and offer extraction
  • Image Analysis with GPT-4.1: Detailed image analysis extracting visual elements, text, USPs, and brand elements
  • Multi-Variant Copy Generation: Creates 3 variations each of primary text (125 chars), headlines (255 chars), and link descriptions
  • Intelligent Asset Processing: Handles both video and image assets with format-specific AI analysis

Automated Meta Ads Integration

  • Smart Asset Upload: Automatically uploads processed creatives to Meta Ads Manager
  • Multi-Format Support: Handles video ads with preview thumbnails and single/multi-image campaigns
  • Cross-Platform Optimization: Configures ads for Facebook, Instagram, Messenger, and Audience Network
  • Creative Customization: Applies placement-specific rules and asset labeling for optimal delivery

Workflow Management

  • Google Drive Integration: Monitors designated folders for new creative assets
  • Sheet-Based Control: Manages workflow through Google Sheets interface with custom menu triggers
  • Batch Processing: Efficiently processes multiple assets with built-in rate limiting
  • Status Tracking: Real-time updates of analysis progress and upload completion

Prerequisites

Required Accounts & API Access

  • Meta Developer Account: With live app status and appropriate permissions
  • Google Cloud Account: For Gemini API access and Google services
  • OpenAI Account: For GPT-4.1 API access
  • Google Services: Drive and Sheets API credentials
  • n8n Instance: Self-hosted or cloud with required AI and API node packages

API Requirements

  • Meta Graph API v22.0 with ads management permissions
  • Google Gemini API key for video analysis
  • OpenAI API key for GPT-4.1 image analysis
  • Google Drive and Sheets OAuth2 credentials

Setup Instructions

1. AI Service Configuration

  1. Google Gemini Setup:
    • Create Google Cloud project and enable Gemini API
    • Generate API key from Google AI Studio
    • Configure Gemini credentials in n8n
  2. OpenAI Setup:
    • Create OpenAI account and generate API key
    • Ensure GPT-4.1 access for optimal analysis quality
    • Configure OpenAI credentials in n8n

2. Meta Developer Configuration

  1. Create Meta Developer app with live status
  2. Generate long-lived access token with permissions:
    • ads_management
    • business_management
    • pages_read_engagement
  3. Note Ad Account IDs, Page IDs, and Instagram User IDs

3. Google Services Setup

  1. Enable Google Drive and Sheets APIs in Google Cloud Console
  2. Create OAuth2 credentials for both services
  3. Create dedicated Google Drive folder for asset uploads
  4. Make a copy of the Google Sheets template

4. Workflow Configuration

  1. Import the workflow JSON into your n8n instance
  2. Configure all required credentials:
    • Google Gemini API
    • OpenAI API
    • Facebook Graph API
    • Google Drive OAuth2
    • Google Sheets OAuth2

5. Settings Configuration

  1. Update the settings and settings1 nodes with:
    • Your Google Sheets URL
    • Your Google Drive folder URL
  2. Configure webhook URLs in the Google Sheets template
  3. Execute and pin settings nodes to preserve configurations

6. Google Sheets Setup

  1. Fill in the "Settings" tab with:
    • Meta account information (Ad Account IDs, Page IDs)
    • Webhook URLs for both analysis and upload triggers
    • Campaign configuration parameters
  2. Use the "Assets" sheet to manage AI analysis queue
  3. Configure campaigns in the "Ready to Upload" sheet

Workflow Triggers & Operations

Analysis Workflow

  • Webhook Trigger: "Meta → Analyze Assets" menu option in Google Sheets
  • Automatic Processing: Processes assets marked for analysis in the Assets sheet
  • AI Analysis: Video assets use Gemini, image assets use GPT-4.1
  • Copy Generation: Creates multiple ad copy variations for A/B testing

Upload Workflow

  • Webhook Trigger: "Meta → Upload Ads" menu option in Google Sheets
  • Asset Processing: Handles both analyzed and manual assets
  • Meta Upload: Creates complete ad campaigns in paused status
  • Status Updates: Tracks progress and completion in Google Sheets

AI Analysis Capabilities

Video Analysis (Gemini)

  • Complete transcription of spoken and on-screen text
  • Shot-by-shot scene descriptions
  • Hook and attention-grabbing element identification
  • Offer and call-to-action extraction
  • Brand element and visual style analysis
  • Customer journey mapping

Image Analysis (GPT-4.1)

  • Comprehensive visual element extraction
  • Text and overlay transcription
  • USP and benefit identification
  • Emotional tone and target audience assessment
  • Brand consistency analysis
  • Creative description generation

File Support & Processing

  • Video Formats: MP4, MOV, AVI with automatic compression handling
  • Image Formats: JPG, PNG with multi-variant creative support
  • Large File Handling: Google Drive virus scan workarounds
  • Asset Management: Automatic metadata extraction and organization

Important Notes

  • All ads are created in "PAUSED" status for review before activation
  • AI analysis respects character limits for each ad component
  • Multiple text variations enable comprehensive A/B testing
  • Custom placement rules optimize delivery across Meta platforms
  • Webhook Configuration: Ensure webhook URLs match your n8n endpoints
  • Processing time varies based on asset complexity and AI model availability
  • Both German and English language prompts supported for international use

Advanced Features

  • Intelligent Asset Routing: Different AI models for optimal video vs. image analysis
  • Structured Output: JSON-formatted responses ensure consistent data handling
  • Error Handling: Robust retry mechanisms and fallback processing
  • Batch Optimization: Rate limiting prevents API quota exceeded errors
  • Creative Versioning: Maintains complete audit trail of AI-generated variations

This automation dramatically reduces manual creative development time while leveraging state-of-the-art AI to generate high-quality, conversion-optimized ad copy that maintains brand consistency and maximizes campaign performance across Meta's advertising ecosystem.

Download the Files

This is a free resource for subscribers to my newsletter – you'll receive this file and updates whenever I publish new content. I don't have the time to spam you – I just want to share my knowledge and build a community of like-minded people. And you can obviously unsubscribe anytime if I happen to not deliver on my promise.

Once you've subscribed the article is unlocked and you can directly download the files to get started with this workflow.