Skip to main content

Competitive ad research & image generator with Apify, GPT-4o & Facebook Ad Library

Workflow preview

Workflow preview
100%
Competitive ad research & image generator with Apify, GPT-4o & Facebook Ad Library preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

AI Ad Scraper & Image Generator with Facebook Ad Library Categories: PPC Automation, Creative Generation, Competitive Intelligence This workflow creates an end to end ad library scraper and AI imag...

Best for

  • Content Creation automation workflows
  • Multimodal AI automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.stickynote, n8n-nodes-base.manualtrigger, n8n-nodes-base.googledrive, n8n-nodes-base.filter, n8n-nodes-base.httprequest, n8n-nodes-base.limit, @n8n/n8n-nodes-langchain.openai, n8n-nodes-base.set

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Nick Saraev.

Original n8n.io source

1.1 Workflow description

Title
Competitive ad research & image generator with Apify, GPT-4o & Facebook Ad Library
Workflow name
Competitive ad research & image generator with Apify, GPT-4o & Facebook Ad Library

AI Ad Scraper & Image Generator with Facebook Ad Library

Categories: PPC Automation, Creative Generation, Competitive Intelligence

This workflow creates an end-to-end ad library scraper and AI image spinner system that automatically discovers competitor ads, analyzes their design elements, and generates multiple unique variations ready for your own campaigns. Built to eliminate 60-70% of manual creative work for PPC agencies, this system transforms competitor research into actionable ad variants in minutes.

Benefits

  • Automated Competitor Research - Scrapes Facebook Ad Library for active competitor campaigns automatically
  • AI-Powered Creative Analysis - Uses OpenAI vision to comprehensively analyze ad design elements and copy
  • Intelligent Image Generation - Creates 3+ unique variations per source ad while maintaining effective layouts
  • Complete Asset Organization - Automatically organizes source ads and generated variations in structured Google Drive folders
  • Campaign-Ready Output - Generates Google Sheets database with direct links to all assets for immediate campaign deployment
  • Massive Time Savings - Replaces hours of manual creative work with automated competitive intelligence and generation

How It Works

Facebook Ad Library Scraping:

  • Connects to Facebook's Ad Library through Apify scraper integration
  • Searches active ads based on keywords, industries, or competitor targeting
  • Filters for image-based ads and removes video-only content for processing

Intelligent Asset Organization:

  • Creates unique Google Drive folder structure for each scraped ad campaign
  • Separates source competitor ads from AI-generated variations
  • Maintains organized asset library for easy campaign management and iteration

AI-Powered Creative Analysis:

  • Uses OpenAI's vision model to comprehensively describe each competitor ad
  • Identifies design elements, color schemes, layout patterns, and messaging approaches
  • Generates detailed creative briefs for intelligent variation generation

Smart Image Variation System:

  • Creates 3 unique style variations per source ad using advanced AI prompting
  • Maintains effective layout structures while changing colors, fonts, and styling
  • Customizes messaging and branding to match your business requirements

Campaign Database Integration:

  • Logs all source ads and generated variations in organized Google Sheets
  • Provides direct links to all assets for immediate campaign deployment
  • Tracks performance data and creative iterations for ongoing optimization

Required Setup Configuration

Google Drive Structure: The workflow automatically creates this folder organization:

PPC Thievery (Parent Folder) ├── [Ad Archive ID] (Per Campaign) │ ├── 1. Source Assets (Original competitor ads) │ └── 2. Spun Assets (AI-generated variations)

Google Sheets Database Columns:

  • timestamp - Unique record identifier
  • ad_archive_id - Facebook's internal ad identifier
  • page_id - Advertiser's Facebook page ID
  • original_image_url - Direct link to source competitor ad
  • page_name - Advertiser's business name
  • ad_body - Original ad copy text
  • date_scraped - When the ad was discovered
  • spun_prompts - AI-generated variation instructions
  • asset_folder - Link to campaign's Google Drive folder
  • source_folder - Link to original ads folder
  • spun_folder - Link to generated variations folder
  • direct_spun_image_link - Direct link to generated ad image

Set Variables Configuration: Update these values in the "Set Variables" node:

  • googleDriveFolderId - Your parent Google Drive folder ID
  • changeRequest - Your brand-specific variation instructions
  • spreadsheetId - Your Google Sheets database ID

Apify API Setup:

  1. Create Apify account and obtain API key
  2. Replace <your-apify-api-key-here> with actual credentials
  3. Customize search terms in the JSON body for your target competitors
  4. Adjust scraping count (default: 20 ads per run)

Business Use Cases

  • PPC Agencies - Automate competitive research and creative generation for client campaigns
  • E-commerce Brands - Monitor competitor advertising strategies and generate response campaigns
  • Marketing Teams - Scale creative production with AI-powered competitive intelligence
  • Freelance Marketers - Offer advanced competitive analysis and creative services to clients
  • SaaS Companies - Track competitor messaging and generate differentiated ad variations
  • Agency Teams - Replace manual creative research with automated competitive intelligence systems

Revenue Potential

This system revolutionizes PPC agency economics:

  • 60-70% reduction in manual creative work and competitive research time
  • 3-5x faster campaign launch times with ready-to-use creative assets
  • $2,000-$5,000 service value for comprehensive competitive intelligence and creative generation
  • Scalable competitive advantage through automated monitoring of competitor campaigns
  • Premium positioning offering AI-powered creative intelligence that competitors can't match manually

Difficulty Level: Advanced
Estimated Build Time: 2-3 hours
Monthly Operating Cost: ~$100 (Apify + OpenAI + Google APIs)

Watch My Complete Live Build

Want to see me build this entire system from scratch? I walk through every component live - including the ad library integration, AI analysis setup, image generation pipeline, and all the debugging that goes into creating a production-ready competitive intelligence system.

🎥 See My Live Build Process: "Ad Library Scraper & AI Image Spinner System (N8N Build)"

This comprehensive tutorial shows the real development process - including advanced AI prompting for image generation, competitive analysis strategies, and the organizational systems that make this scalable for agency use.

Set Up Steps

Initial Database Setup:

  • Run the initialization flow once to create your Google Drive folder and Sheets database
  • Copy the generated folder ID and spreadsheet ID into the "Set Variables" node
  • Configure your brand-specific change request template for consistent output

Apify Integration:

  • Set up Apify account with Facebook Ad Library scraper access
  • Configure API credentials and test with small ad batches
  • Customize search parameters for your target competitors and industries

AI Service Configuration:

  • Connect OpenAI API for vision analysis and image generation
  • Set up appropriate rate limiting to control processing costs
  • Test the complete AI pipeline with sample competitor ads

Google Services Setup:

  • Configure Google Drive API credentials for automated folder creation
  • Set up Google Sheets integration for campaign database management
  • Test the complete asset organization and tracking workflow

Campaign Customization:

  • Define your brand guidelines and messaging requirements in the change request
  • Set up variation templates for different campaign types and industries
  • Configure batch processing limits based on your API usage requirements

Production Optimization:

  • Remove the limit node for full-scale competitive monitoring
  • Set up automated scheduling for regular competitive intelligence gathering
  • Monitor and optimize AI prompts based on generated creative quality

Advanced Optimizations

Scale the system with:

  • Multi-Platform Scraping: Extend to LinkedIn, Twitter, and Google Ads for comprehensive competitive intelligence
  • Performance Tracking: Integrate with ad platforms to track performance of generated variations
  • Style Guide Automation: Create industry-specific variation templates for consistent brand application
  • A/B Testing Integration: Automatically test generated variations against source ads for performance optimization
  • CRM Integration: Connect competitive intelligence data with sales and marketing systems

Important Considerations

  • API Rate Limits: Built-in delays prevent service overload and ensure reliable operation
  • Creative Quality: System generates multiple variations to account for AI generation variability
  • Legal Compliance: Use generated variations as inspiration while respecting intellectual property rights
  • Cost Management: Monitor OpenAI image generation costs and adjust batch sizes accordingly
  • Competitive Ethics: Focus on learning from successful patterns rather than direct copying

Why This System Works

The competitive advantage lies in speed and scale:

  • Minutes vs. Hours: Generate campaign-ready creative variations in minutes instead of hours of manual work
  • Systematic Analysis: AI vision provides consistent, comprehensive analysis that humans might miss
  • Organized Intelligence: Structured asset management enables rapid campaign deployment and iteration
  • Scalable Monitoring: Automated competitive research that scales beyond manual capacity
  • Quality Variations: Multiple AI-generated options ensure high-quality creative output

Check Out My Channel

For more advanced automation systems and proven agency-building strategies that generate real revenue, explore my YouTube channel where I share the exact methodologies used to scale automation agencies to $72K+ monthly revenue.

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Sticky Note2

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 2 - Sticky Note3

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 3 - Sticky Note4

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 4 - Sticky Note5

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 5 - When clicking ‘Execute workflow’

Type / Role
n8n-nodes-base.manualTrigger - manualTrigger
Config choices
Version 1

Block 6 - Google Drive

Type / Role
n8n-nodes-base.googleDrive - googleDrive
Config choices
Version 3

Block 7 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 8 - Filter

Type / Role
n8n-nodes-base.filter - filter
Config choices
Version 2.2

Block 9 - Run Ad Library Scraper

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 10 - Limit

Type / Role
n8n-nodes-base.limit - limit
Config choices
Version 1

Block 11 - Google Drive1

Type / Role
n8n-nodes-base.googleDrive - googleDrive
Config choices
Version 3

Block 12 - OpenAI

Type / Role
@n8n/n8n-nodes-langchain.openAi - openAi
Config choices
Version 1.8

Block 13 - Google Drive2

Type / Role
n8n-nodes-base.googleDrive - googleDrive
Config choices
Version 3

Block 14 - Set Variables

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 15 - Spin Prompts

Type / Role
@n8n/n8n-nodes-langchain.openAi - openAi
Config choices
Version 1.8

Block 16 - Generate Image Using GPT Image 1

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 17 - Loop Over Items

Type / Role
n8n-nodes-base.splitInBatches - splitInBatches
Config choices
Version 3

Block 18 - Wait

Type / Role
n8n-nodes-base.wait - wait
Config choices
Version 1.1

Block 19 - Split Out

Type / Role
n8n-nodes-base.splitOut - splitOut
Config choices
Version 1

Block 20 - Edit Fields

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 21 - Download Static Image Ad1

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 22 - Convert to File

Type / Role
n8n-nodes-base.convertToFile - convertToFile
Config choices
Version 1.1

Block 23 - Google Drive3

Type / Role
n8n-nodes-base.googleDrive - googleDrive
Config choices
Version 3

Block 24 - Create Asset Parent Folder

Type / Role
n8n-nodes-base.googleDrive - googleDrive
Config choices
Version 3

Showing the first 24 of 32 workflow blocks. Download the JSON for the full node graph.

3. Summary Table

Workflow Competitive ad research & image generator with Apify, GPT-4o & Facebook Ad Library
Complexity advanced
Nodes 32
Categories Content Creation, Multimodal AI
Author Nick Saraev
Published 19 Jul 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/6172/6172.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Competitive ad research & image generator with Apify, GPT-4o & Facebook Ad Library do?

AI Ad Scraper & Image Generator with Facebook Ad Library Categories: PPC Automation, Creative Generation, Competitive Intelligence This workflow creates an end to end ad library scraper and AI imag...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Content Creation, Multimodal AI use case.