Automated Competitor Ad Spinning and Creative Generation - n8n Workflow

Analyze competitor ads from Facebook Ad Library using Apify, generate style descriptions with GPT-4o Vision, and create unique ad variations automatically using this powerful n8n workflow.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • Digital Marketing Agencies needing rapid creative iteration.

  • E-commerce Managers seeking new advertising angles based on competitor data.

  • Performance Marketers looking for automated competitive intelligence and asset generation.

  • Users wanting to implement advanced AI image generation within an n8n workflow.

Overview

Developing fresh, high-performing advertising creatives is time-consuming and often involves manual competitor analysis. This advanced n8n workflow solves this by fully automating the pipeline, moving from competitive research to asset generation.

It leverages Apify to scrape real-time data from the Facebook Ad Library, providing a wealth of competitor insights. The core innovation lies in the AI steps: GPT-4o Vision analyzes the visual components of competitor ads, and a subsequent prompt-spinning n8n node generates three unique creative variations per ad. Finally, DALL-E (via the HTTP Request n8n node) executes the generated prompts, producing campaign-ready creative variations, all logged neatly in Google Sheets and organized in Google Drive. This specific n8n workflow dramatically increases the speed and volume of high-quality ad testing.

How it Works

This comprehensive n8n workflow executes in four main steps after initial setup:


  1. Scraping and Filtering: The n8n trigger starts the process, which immediately uses the Apify API via an HTTP Request n8n node to scrape recent, active ads from the Facebook Ad Library based on user-defined keywords. A subsequent Filter n8n node ensures that only image-based ads (excluding video-only assets) are passed down the n8n workflow. The Limit n8n node controls the batch size for efficiency.

  2. Organizing Assets: For each scraped ad, the n8n workflow dynamically creates a dedicated organizational structure in Google Drive (Parent Folder, Source Folder, Spun Folder). The original competitor image is downloaded and uploaded to the Source Folder.

  3. AI Analysis and Prompt Spinning: The original ad image URL is passed to the OpenAI n8n node, leveraging GPT-4o Vision to generate an exhaustive description of the visual elements. This description, combined with a user-defined change request (e.g., 'Make it minimalistic and pastel'), is fed into the next OpenAI n8n node (Spin Prompts). This n8n node acts as a prompt engineer, generating multiple, structured variations (3 per ad) in JSON format.

  4. Image Generation and Logging: The Split Out n8n node separates these variations, entering a loop. Inside the loop, the original ad image is fetched, and the spun prompt is used to call the DALL-E image editing API (Generate Image Using GPT Image 1). The resulting AI-generated image is converted to a binary file and uploaded to the 'Spun Assets' folder via a Google Drive n8n node. Finally, a Google Sheets n8n node logs all competitor details, spun prompts, and direct links to the new creative assets, completing the entire n8n automation.

Installation Guide

To deploy this powerful n8n workflow template, follow these steps:


  1. Import the n8n workflow: Copy the provided JSON data and paste it into your n8n instance using the 'New' -> 'Import from JSON' function.

  2. Credentials Setup: You will need the following credentials configured in your n8n instance:

OpenAI API Key: Required for both GPT-4o Vision analysis and image generation.
Google Drive/Sheets Credentials: Required for file management and logging.
* Apify API Key: Required for running the Facebook Ad Library Scraper.

  1. Initial Setup Run: Run the n8n workflow once (the initial path before Set Variables). This will create the parent 'PPC Thievery' Google Drive folder and the 'PPC Thievery' Google Sheet.

  2. Configure Variables: Update the Set Variables n8n node with the actual IDs generated in Step 3 (the googleDriveFolderId and spreadsheetId). Also, customize the changeRequest variable to define the styling instructions for your new ad creatives.

  3. Configure Scraping: In the Run Ad Library Scraper HTTP Request n8n node, replace in the Authorization header. Customize the JSON body with your desired search terms and desired ad count. This n8n template is now ready for production execution.

Node Details

This n8n workflow relies on the meticulous configuration of several key n8n nodes:

Set Variables n8n node: Essential for configuration. Stores googleDriveFolderId, spreadsheetId, and the user-defined changeRequest prompt used by the AI to define new ad styles.
Run Ad Library Scraper (HTTP Request n8n node): Connects to Apify to scrape Facebook Ad Library data. Key configuration includes the API endpoint and Authorization header containing the Apify key, and a POST body specifying search parameters (e.g., keywords, country, active status).
Filter n8n node: Used to ensure data quality by filtering items where snapshot.images[0].originalimageurl exists, thus processing only image ads.
Google Drive n8n node (Create Asset Parent Folder): Dynamically creates folders using the adarchiveid for unique organization. Key setting: Folder ID is linked to the variable set in the Set Variables n8n node.
OpenAI n8n node (OpenAI Vision): Uses the analyze operation with the image URL, passing the original image to GPT-4o to generate a detailed description.
Spin Prompts (OpenAI n8n node): Utilizes a sophisticated system prompt to take the image description and the user's changeRequest to generate three variations in a specific JSON structure (variants).
Generate Image Using GPT Image 1 (HTTP Request n8n node): This handles the core image generation. It uses a multipart-form-data request targeting the OpenAI images/edits API. It requires the original image file and the prompt (the spun variant from the loop) to execute the image-to-image modification.
Google Sheets n8n node: Performs the final action, using the append operation to log all relevant metadata, links to the source folder, spun folder, and the direct link to the newly generated creative.

Related n8n Workflows

Free

Nodes: 13 Nodes
Updated: December 26 2025
View all
Created by

Hi 👋 I'm Nick. I make money with automation & teach others how they can too. If you have any questions about my templates or about my n8n builds, feel free to ask and I'll happily respond in the comments. Thanks for reading!

Featured*