🔓 Unlock all 10,000+ workflows & prompts free Join Newsletter →
✅ Full access unlocked — explore all 10,000 AI workflow and prompt templates Browse Templates →
Home n8n Workflow
January 22, 2026

Apify + Google Drive: clone Facebook ads faster

Lisa Granqvist Partner Workflow Automation Expert

You find a competitor ad that’s clearly working, then the grind starts. Screenshot. Download. Rename files. Try to “recreate the vibe” in Canva or Figma. By the time you’ve made two decent variations, the momentum is gone (and honestly, so is your patience).

This ad cloning automation hits performance marketers first, but ecommerce founders and agency leads feel it too. You want more tests on proven angles without turning your week into a file-management job.

This workflow turns a Facebook Ad Library URL plus your product image into organized folders of competitor references and AI-generated “style-matched” clones in Google Drive. You’ll see what it automates, what results you should expect, and where people usually get stuck.

How This Automation Works

The full n8n workflow, from trigger to final output:

n8n Workflow Template: Apify + Google Drive: clone Facebook ads faster

The Problem: Cloning Winning Facebook Ads Is Slow and Messy

Ad research is easy. Turning research into testable creatives is the part that drags. You’re juggling the Facebook Ad Library, downloads that land in random folders, and a “rebuild it by eye” process that’s never quite the same as the original. Then you still need variations. Different colors, different product shots, slightly different layouts. It’s not hard work, it’s repetitive work, which means it steals focus from the stuff that actually moves the account.

It adds up fast. Here’s where it breaks down in real life.

  • Pulling 10–20 competitor ads means lots of manual downloading, renaming, and “where did I save that?” moments.
  • Recreating a layout from a screenshot takes long enough that you end up testing fewer concepts.
  • When your files aren’t organized, you can’t compare versions cleanly, so you second-guess decisions later.
  • Creative production becomes the bottleneck, even when media buying and budgeting are ready to scale.

The Solution: Scrape, Analyze, Clone, and File Everything Automatically

This workflow starts with a simple form submission: you paste a Facebook Ad Library URL and upload your product image. From there, Apify scrapes up to 20 ads from that URL, and the automation cycles through them one-by-one so you don’t have to babysit a long run. For each competitor ad, it downloads the image, saves a clean reference copy to Google Drive, and converts both images into a format the AI can understand. Then an AI analysis step looks at the competitor creative and your product image, writes detailed “clone instructions,” and generates a new ad visual that keeps the original style while swapping in your branding and packaging. Finally, successful clones are uploaded to Google Drive alongside the originals, already grouped for review.

The workflow kicks off from a form trigger, so it feels like a mini “creative request” portal. Apify handles extraction, AI handles the style-match and adaptation, and Google Drive becomes the single source of truth for reference ads and generated clones.

What You Get: Automation vs. Results

Example: What This Looks Like

Say you want to test a competitor’s style across 20 ads. Manually, even a quick process is about 5 minutes to find, download, rename, and file each reference image, plus maybe 15 minutes to recreate each layout with your product. That’s roughly 6–7 hours of work for a full batch. With this workflow, you submit the form in about 2 minutes, then let it run; image generation is about 10–30 seconds per ad, so most batches finish in under an hour while you do other work.

What You’ll Need

  • n8n instance (try n8n Cloud free)
  • Self-hosting option if you prefer (Hostinger works well)
  • Apify for scraping Facebook Ad Library creatives.
  • Google Drive to store originals and clones.
  • Google Gemini API key (get it from Google AI Studio / Gemini API console).

Skill level: Intermediate. You’ll connect accounts, paste API keys, and confirm a few folder and form settings in n8n.

Don’t want to set this up yourself? Talk to an automation expert (free 15-minute consultation).

How It Works

Form submission trigger. You paste a Facebook Ad Library link and upload your product image. That single submission starts the run and keeps the input consistent across your team.

Competitor ads are scraped and queued. Apify pulls up to 20 ads from the URL, and n8n processes them in batches so it can loop safely without timeouts or memory issues.

Images are downloaded, converted, and analyzed. The workflow fetches each ad image, stores a reference copy in Google Drive, then encodes both the competitor image and your product image for the AI prompt-building step.

AI generates a style-matched clone and saves it. The system creates detailed clone instructions, generates the new ad visual, checks if content was blocked, then uploads the finished image back into Google Drive.

You can easily modify the number of ads processed to match your review capacity. See the full implementation guide below for customization options.

Step-by-Step Implementation Guide

Step 1: Configure the Form Trigger

Set up the form intake so the workflow can receive a Facebook Ad Library URL and a product image upload.

  1. Add and configure Form Intake Trigger with Form Title set to Facebook Ad Thief Form.
  2. In Form Fields, add a required text field labeled Facebook Ad Library Url with placeholder https://www.facebook.com/.
  3. Add a required file field labeled Your Product Image and keep Multiple Files disabled.

Tip: Use the form description from Form Intake Trigger to guide users: Upload your product image and submit a facebook ad library url for the ads you want to clone/spin for your produc.t.

Step 2: Connect the Ad Scraping Pipeline

Convert the uploaded product image and scrape the ad library for matching ad assets.

  1. In Encode Product Image, set Operation to binaryToPropery and Binary Property Name to Your_Product_Image.
  2. In Scrape Ad Library, confirm Operation is Run actor and get dataset and Memory is 512.
  3. Set Custom Body to the provided JSON and ensure the URL uses the expression {{ $('Form Intake Trigger').item.json['Facebook Ad Library Url'] }}.
  4. Credential Required: Connect your apifyOAuth2Api credentials in Scrape Ad Library.

⚠️ Common Pitfall: The actorId in Scrape Ad Library contains [YOUR_ID]. Replace it with your Apify actor ID to avoid empty datasets.

Step 3: Batch, Fetch, and Parallelize Ad Assets

Cycle through scraped ads, download reference images, and process them in parallel for storage and encoding.

  1. Leave Cycle Ad Batches as default to iterate through dataset items.
  2. In Fetch Ad Image, set URL to {{ $node['Cycle Ad Batches'].json.snapshot.cards.first().original_image_url }}.
  3. Fetch Ad Image outputs to both Store Ad Reference and Encode Ad Image in parallel.
  4. In Store Ad Reference, set Name to {{ $node['Cycle Ad Batches'].json.snapshot.cards.first().title }} and choose your Drive and Folder.
  5. Credential Required: Connect your googleDriveOAuth2Api credentials in Store Ad Reference.
  6. In Encode Ad Image, set Operation to binaryToPropery.
  7. Use Combine Inputs to merge Store Ad Reference and Encode Ad Image before Aggregate Results.

Tip: Ensure Cycle Ad Batches continues the loop by using the outputs from Save Generated Image and Validate Content Status back into the batch node.

Step 4: Set Up Prompt Composition and AI Requests

Aggregate data, craft the prompt, and call Gemini endpoints to generate the new ad creative.

  1. In Aggregate Results, keep defaults to bundle combined inputs into a single item.
  2. In Compose Prompt Text, confirm the prompt field contains the long instruction string used to guide image rewriting.
  3. In Create Image Prompt, set URL to https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-pro:generateContent and Method to POST.
  4. Set JSON Body to the provided template and keep the inline data expressions: {{ $node['Encode Product Image'].json.data }} and {{ $node['Encode Ad Image'].json.data }}.
  5. Credential Required: Connect your httpHeaderAuth credentials in Create Image Prompt.
  6. In Generate Ad Visual, set URL to https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash-image-preview:generateContent and keep the JSON body expression {{ JSON.stringify($json.candidates.first().content.parts.first().text) }}.
  7. Credential Required: Connect your httpHeaderAuth credentials in Generate Ad Visual.

⚠️ Common Pitfall: If the Gemini API responds with rate limits or timeouts, increase the retry settings in Create Image Prompt and Generate Ad Visual (already configured with retries).

Step 5: Validate, Build, and Save Generated Images

Filter prohibited content, transform the generated image output into a file, and store it in Google Drive.

  1. In Validate Content Status, confirm the condition checks {{ $json.candidates.first().finishReason }} equals PROHIBITED_CONTENT.
  2. In Assign Image Output, set the image_result assignment to {{ $json.candidates[0].content.parts.filter(item => item.inlineData).first().inlineData.data }}.
  3. In Build Image File, set Operation to toBinary and Source Property to image_result.
  4. In Save Generated Image, set Name to Cloned Ad #{{ $runIndex + 1 }} and select the target Drive and Folder.
  5. Credential Required: Connect your googleDriveOAuth2Api credentials in Save Generated Image.

⚠️ Common Pitfall: The Folder ID in Save Generated Image uses [CONFIGURE_YOUR_API_KEY]. Replace it with a valid Google Drive folder ID.

Step 6: Test and Activate Your Workflow

Validate the end-to-end flow to ensure images are scraped, generated, and stored correctly.

  1. Click Execute Workflow and submit the Form Intake Trigger with a valid Facebook Ad Library URL and a PNG/JPG product image.
  2. Confirm Scrape Ad Library returns dataset items and Cycle Ad Batches iterates through them.
  3. Verify Fetch Ad Image runs and that both Store Ad Reference and Encode Ad Image receive data in parallel.
  4. Check that Create Image Prompt and Generate Ad Visual respond successfully and that Save Generated Image writes files to Google Drive.
  5. Once the test succeeds, switch the workflow Active toggle to enable production use.
🔒

Unlock Full Step-by-Step Guide

Get the complete implementation guide + downloadable template

Common Gotchas

  • Apify credentials can expire or need specific permissions. If things break, check your Apify token settings in your Apify account first.
  • If you’re using Wait nodes or external rendering, processing times vary. Bump up the wait duration if downstream nodes fail on empty responses.
  • Default prompts in AI nodes are generic. Add your brand voice early or you’ll be editing outputs forever.

Frequently Asked Questions

How long does it take to set up this ad cloning automation automation?

About an hour if your Apify, Google Drive, and Gemini accounts are ready.

Do I need coding skills to automate ad cloning automation?

No. You’ll mainly connect accounts, paste API keys, and choose where files should be saved.

Is n8n free to use for this ad cloning automation workflow?

Yes. n8n has a free self-hosted option and a free trial on n8n Cloud. Cloud plans start at $20/month for higher volume. You’ll also need to factor in Gemini API usage for image analysis and generation.

Where can I host n8n to run this automation?

Two options: n8n Cloud (managed, easiest setup) or self-hosting on a VPS. For self-hosting, Hostinger VPS is affordable and handles n8n well. Self-hosting gives you unlimited executions but requires basic server management.

Can I customize this ad cloning automation workflow for different folder naming and fewer than 20 ads?

Yes, and it’s one of the first tweaks worth making. You can change the limit in the Apify scrape step (the workflow is set to process up to 20 ads), and you can adjust the Google Drive upload steps to name folders by client, campaign, or product line. Most people also edit the prompt text step to push specific brand rules like “always use our headline style” or “keep backgrounds minimal.” If you want only the top few ads, add simple filtering before the batch loop.

Why is my Apify connection failing in this workflow?

Usually it’s an expired or incorrect Apify API token. Update the credential in n8n, then confirm the Apify task has access to the Facebook Ad Library scraper you’re calling. If it still fails, the source URL may not have accessible ads, or Apify may be rate limiting the run when you push too many requests quickly.

How many ads can this ad cloning automation handle?

This template is set to process up to 20 ads per Facebook Ad Library URL.

Is this ad cloning automation better than using Zapier or Make?

For this use case, yes, because you’re chaining scraping, file handling, image processing, and AI generation in one workflow. Zapier and Make can do parts of it, but multi-step looping with images gets awkward fast, and you often hit premium limits once you scale tests. n8n also gives you the self-host option, which matters when you run lots of batches. If you only need to save a single scraped link somewhere, other tools are fine. Talk to an automation expert if you want a recommendation based on your volume and team setup.

Once this is running, competitor research stops being a dead end. You get organized references and a stack of clones you can actually test, without turning your creative week into admin work.

Need Help Setting This Up?

Our automation experts can build and customize this workflow for your specific needs. Free 15-minute consultation—no commitment required.

Lisa Granqvist

Workflow Automation Expert

Expert in workflow automation and no-code tools.

×

Use template

Get instant access to this n8n workflow Json file

💬
Get a free quote today!
Get a free quote today!

Tell us what you need and we'll get back to you within one working day.

Get a free quote today!
Get a free quote today!

Tell us what you need and we'll get back to you within one working day.

Launch login modal Launch register modal