{
  "name": "Competitive ad research & image generator with Apify, GPT-4o & Facebook Ad Library",
  "nodes": [
    {
      "id": "95c7569d-ff47-43dc-86bf-d746783da7a2",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1216,
        288
      ],
      "parameters": {
        "width": 400,
        "height": 200,
        "content": "## 📱 STEP 1: Facebook Ad Library Scraping\n\nScrapes Facebook's Ad Library for competitor analysis:\n\n**Run Ad Library Scraper**: Uses Apify to extract active ads from Facebook\n**Filter**: Removes ads wi"
      }
    },
    {
      "id": "4b67c4ce-e808-44ba-95d3-0bd0e59b79d6",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        992,
        16
      ],
      "parameters": {
        "width": 420,
        "height": 200,
        "content": "## 🏗️ STEP 2: Google Drive Organization\n\nCreates structured folder system for asset management:\n\n1. **Create Asset Parent Folder**: Named after ad archive ID for unique organization\n2. **Create Child "
      }
    },
    {
      "id": "e1b8e8a3-fc7d-440a-b509-1022dab42f79",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1216,
        640
      ],
      "parameters": {
        "width": 400,
        "height": 200,
        "content": "## 🤖 STEP 3: AI Analysis & Prompt Generation\n\nAnalyzes competitor ads and generates variation prompts:\n\n1. **OpenAI Vision**: Comprehensively describes each ad image\n2. **Spin Prompts**: Creates 3 dif"
      }
    },
    {
      "id": "cf8f11fc-6c4c-4a98-9875-433a19c646fc",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        848,
        976
      ],
      "parameters": {
        "width": 420,
        "height": 220,
        "content": "## 🎨 STEP 4: AI Image Generation & Storage\n\nGenerates new ad variations and organizes results:\n\n**Loop Processing**: Handles each variation individually with rate limiting\n**GPT Image 1**: Creates new"
      }
    },
    {
      "id": "72e1f19f-15b4-4f13-bd7e-5e52bcc01e25",
      "name": "When clicking ‘Execute workflow’",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -656,
        32
      ]
    },
    {
      "id": "a76ca1c3-285c-4840-a390-d7204585407b",
      "name": "Google Drive",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        -448,
        32
      ]
    },
    {
      "id": "5116f412-d0f3-4aaa-a95c-516bae884d88",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -720,
        -128
      ],
      "parameters": {
        "width": 1140,
        "height": 340,
        "content": "## 1. Run once to create folder & database\n\n#### This generates your database (Google Sheet) and your parent folder (Google Drive). Once you have values for each, adjust the \"Set Variables\" node."
      }
    },
    {
      "id": "aef6590c-937a-4bc7-a248-24dc41639a20",
      "name": "Filter",
      "type": "n8n-nodes-base.filter",
      "position": [
        80,
        464
      ]
    },
    {
      "id": "409aaa70-34ae-45d8-8d62-5065a8a389e6",
      "name": "Run Ad Library Scraper",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -160,
        464
      ]
    },
    {
      "id": "3ea9c85f-e228-4278-bcda-d989fd98707c",
      "name": "Limit",
      "type": "n8n-nodes-base.limit",
      "position": [
        288,
        464
      ]
    },
    {
      "id": "4ca3f2d9-9036-469c-af6f-377ee7266659",
      "name": "Google Drive1",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        1392,
        464
      ]
    },
    {
      "id": "e6725a15-9250-4262-8bc2-303ab6e1ca05",
      "name": "OpenAI",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        -400,
        656
      ]
    },
    {
      "id": "adfd39a4-0845-42c6-82a4-2d953da97e52",
      "name": "Google Drive2",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        -608,
        656
      ]
    },
    {
      "id": "9e54072b-0208-4755-bb41-ce82907b202b",
      "name": "Set Variables",
      "type": "n8n-nodes-base.set",
      "position": [
        -368,
        464
      ]
    },
    {
      "id": "3994acec-9182-4085-ad98-d16bf19ba2b4",
      "name": "Spin Prompts",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        -176,
        656
      ]
    },
    {
      "id": "24ae679c-9a77-4d48-bf22-31318a716aea",
      "name": "Generate Image Using GPT Image 1",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1072,
        656
      ]
    },
    {
      "id": "c4909154-ea7d-47ae-88a3-323d0cee9f02",
      "name": "Loop Over Items",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        608,
        656
      ]
    },
    {
      "id": "407e8a41-6fac-4f36-af80-494869e305e2",
      "name": "Wait",
      "type": "n8n-nodes-base.wait",
      "position": [
        1952,
        656
      ]
    },
    {
      "id": "84161f30-a19c-48c5-aca1-6bfa4cf1f8f5",
      "name": "Split Out",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        192,
        656
      ]
    },
    {
      "id": "f08995f3-d795-4124-aad4-85d778d2e8ad",
      "name": "Edit Fields",
      "type": "n8n-nodes-base.set",
      "position": [
        416,
        656
      ]
    },
    {
      "id": "3a6dc4a2-39e9-4281-b34b-944df22a4d6f",
      "name": "Download Static Image Ad1",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        832,
        656
      ]
    },
    {
      "id": "3c845061-f894-4528-aafb-0bd8679086b1",
      "name": "Convert to File",
      "type": "n8n-nodes-base.convertToFile",
      "position": [
        1296,
        656
      ]
    },
    {
      "id": "8c676162-4a03-4196-86ae-3d6a4e18ea68",
      "name": "Google Drive3",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        1520,
        656
      ]
    },
    {
      "id": "6b856ae9-3709-4355-a57e-d8da62d3a041",
      "name": "Create Asset Parent Folder",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        512,
        464
      ]
    },
    {
      "id": "e802aa82-181f-40d5-ab3c-c0b270740979",
      "name": "Create Child Source Folder",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        736,
        464
      ]
    },
    {
      "id": "fe7a9a94-e0cd-4a35-9666-f07447775abc",
      "name": "Create Child Spun Folder",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        928,
        464
      ]
    },
    {
      "id": "6c06d975-dbce-4111-933e-8193e0f3cb45",
      "name": "Download Static Image Ad",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1168,
        464
      ]
    },
    {
      "id": "543a3114-31f6-4f87-a1bc-f7c0d8160099",
      "name": "Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1728,
        656
      ]
    },
    {
      "id": "7ac56ea5-37b8-40ca-b177-68fbf84f4550",
      "name": "Google Sheets1",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -240,
        32
      ]
    },
    {
      "id": "9cd0a069-4728-4975-b699-596f5794a6b9",
      "name": "Google Sheets2",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        208,
        32
      ]
    },
    {
      "id": "93b2d8d7-a122-4a75-8bcd-7dd1bee31f5d",
      "name": "Edit Fields1",
      "type": "n8n-nodes-base.set",
      "position": [
        0,
        32
      ]
    },
    {
      "id": "5d48773d-77d7-43a9-a362-ef2fb77d861b",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -720,
        288
      ],
      "parameters": {
        "width": 2860,
        "height": 620,
        "content": "## 2. Update \"Set Variables\" and \"Run Ad Library Scraper\" and run.\n\n#### This flow starts by running an Ad Library Scraper, generating Google Drive scaffolding for organizational purposes, and then an"
      }
    }
  ],
  "connections": {
    "Wait": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Limit": {
      "main": [
        [
          {
            "node": "Create Asset Parent Folder",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter": {
      "main": [
        [
          {
            "node": "Limit",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI": {
      "main": [
        [
          {
            "node": "Spin Prompts",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields1": {
      "main": [
        [
          {
            "node": "Google Sheets2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Drive": {
      "main": [
        [
          {
            "node": "Google Sheets1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Spin Prompts": {
      "main": [
        [
          {
            "node": "Split Out",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Drive1": {
      "main": [
        [
          {
            "node": "Google Drive2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Drive2": {
      "main": [
        [
          {
            "node": "OpenAI",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Drive3": {
      "main": [
        [
          {
            "node": "Google Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Sheets": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Variables": {
      "main": [
        [
          {
            "node": "Run Ad Library Scraper",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Sheets1": {
      "main": [
        [
          {
            "node": "Edit Fields1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert to File": {
      "main": [
        [
          {
            "node": "Google Drive3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [],
        [
          {
            "node": "Download Static Image Ad1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Run Ad Library Scraper": {
      "main": [
        [
          {
            "node": "Filter",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Child Spun Folder": {
      "main": [
        [
          {
            "node": "Download Static Image Ad",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download Static Image Ad": {
      "main": [
        [
          {
            "node": "Google Drive1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download Static Image Ad1": {
      "main": [
        [
          {
            "node": "Generate Image Using GPT Image 1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Asset Parent Folder": {
      "main": [
        [
          {
            "node": "Create Child Source Folder",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Child Source Folder": {
      "main": [
        [
          {
            "node": "Create Child Spun Folder",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Image Using GPT Image 1": {
      "main": [
        [
          {
            "node": "Convert to File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Execute workflow’": {
      "main": [
        [
          {
            "node": "Google Drive",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}