Skip to main content

Clone & customize competitor Facebook ads with Gemini AI and Apify

Workflow preview

Workflow preview
100%
Clone & customize competitor Facebook ads with Gemini AI and Apify preview
Open on n8n.io

Important notice

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

1. Workflow Overview

Nano Banana Ad Cloning System This n8n template demonstrates how to automatically clone and adapt competitor Facebook ads for your own product using AI. Simply provide a Facebook Ad Library URL and...

Best for

  • Market Research automation workflows
  • Multimodal AI automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.formtrigger, n8n-nodes-base.splitinbatches, n8n-nodes-base.httprequest, n8n-nodes-base.extractfromfile, n8n-nodes-base.googledrive, n8n-nodes-base.merge, n8n-nodes-base.aggregate, n8n-nodes-base.converttofile

Source and attribution

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

Original n8n.io source

1.1 Workflow description

Title
Clone & customize competitor Facebook ads with Gemini AI and Apify
Workflow name
Clone & customize competitor Facebook ads with Gemini AI and Apify

Nano Banana Ad Cloning System

This n8n template demonstrates how to automatically clone and adapt competitor Facebook ads for your own product using AI. Simply provide a Facebook Ad Library URL and your product image, and the workflow scrapes competitor ads, analyzes their design and messaging, then generates new versions featuring your product while maintaining the original ad's style and effectiveness.

Use cases

  • Adapt successful competitor ad creatives for your own products
  • Test proven ad formats without starting from scratch
  • Quickly produce multiple ad variations based on high-performing competitors
  • Scale ad creative production by leveraging competitor insights
  • A/B test different visual approaches inspired by market leaders

Good to know

  • The workflow processes up to 20 ads from the provided Facebook Ad Library URL
  • Gemini's image generation may occasionally flag content as prohibited (workflow handles this automatically)
  • Generated ads maintain the original style while swapping product branding and packaging
  • All competitor reference ads and generated clones are automatically saved to Google Drive
  • Image generation takes approximately 10-30 seconds per ad

How it works

  1. Form Submission: User submits a Facebook Ad Library URL and uploads their product image
  2. Product Processing: The product image is converted to base64 for AI processing
  3. Ad Scraping: Apify's Facebook Ad Library Scraper extracts up to 20 ads from the provided URL
  4. Iteration Setup: The workflow processes each scraped ad individually
  5. Image Download: Each competitor ad image is downloaded and converted to base64
  6. Reference Storage: Original competitor ads are uploaded to Google Drive for reference
  7. Prompt Generation: Gemini 2.5 Pro analyzes both images and creates detailed instructions for cloning the ad while replacing competitor branding with your product
  8. Ad Generation: Gemini 2.5 Flash Image Preview generates the new ad image based on the instructions
  9. Content Filter: Checks if generation was blocked for prohibited content
  10. Upload & Loop: Successfully generated ads are uploaded to Google Drive, then the workflow moves to the next ad

How to use

  1. Click the form trigger URL to access the submission form
  2. Enter a Facebook Ad Library URL (e.g., from a competitor's page showing active ads)
  3. Upload your product image with clear branding and packaging
  4. Submit the form and wait for processing to complete
  5. Find your cloned ads and reference images organized in Google Drive folders
  6. Review generated ads and select the best performers for your campaigns

Requirements

  • Apify account for Facebook Ad Library scraping
  • Google Gemini API account for ad analysis and image generation
  • Google Drive account for storing reference ads and generated clones
  • Valid Facebook Ad Library URL with accessible ads

Customizing this workflow

  • Adjust the number of ads scraped in the scrape_ads node (currently set to 20 per source)
  • Modify the prompt instructions in build_prompt node to emphasize different aspects (e.g., color schemes, layouts, text placement)
  • Change the Google Drive folders in upload_ad_reference and upload_image nodes to organize by campaign or product line
  • Add text overlay generation to include custom headlines or CTAs on generated images
  • Implement quality scoring to automatically filter and rank generated ad variations
  • Add Slack/email notifications when ad generation completes or fails
  • Include metadata extraction to capture ad copy and targeting insights from scraped adsRetryClaude does not have the ability to run the code it generates yet.

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 - form_trigger

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

Block 2 - iterate_ads

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

Block 3 - download_image

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

Block 4 - convert_ad_image_to_base64

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

Block 5 - upload_ad_reference

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

Block 6 - merge

Type / Role
n8n-nodes-base.merge - merge
Config choices
Version 3.2

Block 7 - aggregate

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

Block 8 - get_image

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

Block 9 - upload_image

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

Block 10 - set_result

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

Block 11 - check_if_prohibited

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

Block 12 - convert_product_image_to_base64

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

Block 13 - generate_ad_image_prompt

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

Block 14 - generate_ad_image

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

Block 15 - build_prompt

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

Block 16 - scrape_ads

Type / Role
@apify/n8n-nodes-apify.apify - apify
Config choices
Version 1

Block 17 - Sticky Note

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

Block 18 - Sticky Note1

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

3. Summary Table

Workflow Clone & customize competitor Facebook ads with Gemini AI and Apify
Complexity advanced
Nodes 18
Categories Market Research, Multimodal AI
Author Lucas Walter
Published 09 Sept 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/8415/8415.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 Clone & customize competitor Facebook ads with Gemini AI and Apify do?

Nano Banana Ad Cloning System This n8n template demonstrates how to automatically clone and adapt competitor Facebook ads for your own product using AI. Simply provide a Facebook Ad Library URL and...

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 Market Research, Multimodal AI use case.