{
  "name": "AI Facebook ad spy tool with Apify, OpenAI, Gemini & Google Sheets",
  "nodes": [
    {
      "id": "sticky-note-1",
      "name": null,
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1200,
        -400
      ],
      "parameters": {
        "width": 380,
        "height": 200,
        "content": "## 🕵️ STEP 1: Facebook Ad Library Scraping\n\nThis workflow extracts competitor ads from Facebook's public ad library:\n\n1. **Run Ad Library Scraper**: Uses Apify to scrape active Facebook ads based on s"
      }
    },
    {
      "id": "sticky-note-2",
      "name": null,
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -200,
        -800
      ],
      "parameters": {
        "width": 420,
        "height": 240,
        "content": "## 📹 STEP 2: Video Ad Processing Pipeline\n\nFor video ads, this complex pipeline analyzes content:\n\n1. **Download Video**: Gets video file from Facebook\n2. **Upload to Drive**: Stores video for Gemini "
      }
    },
    {
      "id": "sticky-note-3",
      "name": null,
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -200,
        -100
      ],
      "parameters": {
        "width": 400,
        "height": 220,
        "content": "## 🖼️ STEP 3: Image & Text Ad Processing\n\n**Image Route:**\n• **Analyze Image**: Uses GPT-4 Vision to describe image content\n• **Output Summary**: Generates competitor analysis with image insights\n• **"
      }
    },
    {
      "id": "sticky-note-4",
      "name": null,
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        600,
        -400
      ],
      "parameters": {
        "width": 400,
        "height": 220,
        "content": "## 💰 BUSINESS VALUE & APPLICATIONS\n\n**Competitive Intelligence:**\n• Analyze competitor ad strategies across text, image, and video formats\n• Track messaging evolution and creative approaches\n• Identif"
      }
    },
    {
      "id": "18536cf3-1626-44ee-95d5-6eb28baa712b",
      "name": "When clicking ‘Execute workflow’",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -1300,
        -140
      ]
    },
    {
      "id": "e201ba62-cc45-45e6-b50c-08f913a27c87",
      "name": "Switch",
      "type": "n8n-nodes-base.switch",
      "position": [
        -640,
        -140
      ]
    },
    {
      "id": "ca9ee8b5-c562-4339-b6ad-6c7e8d31e4ef",
      "name": "Filter For Likes",
      "type": "n8n-nodes-base.filter",
      "position": [
        -860,
        -140
      ]
    },
    {
      "id": "abdf6521-2599-4741-9dab-f6ce60775ec7",
      "name": "Wait",
      "type": "n8n-nodes-base.wait",
      "position": [
        380,
        160
      ]
    },
    {
      "id": "56c2f9ea-5427-4cd1-a7ce-0f3b918960d2",
      "name": "Wait1",
      "type": "n8n-nodes-base.wait",
      "position": [
        640,
        -140
      ]
    },
    {
      "id": "1b41ce15-b4b1-4189-940e-f4d38062619e",
      "name": "Download Video",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -120,
        -520
      ]
    },
    {
      "id": "9a1730f8-c73c-4771-a718-a6729f68374c",
      "name": "Upload Video to Drive",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        100,
        -520
      ]
    },
    {
      "id": "decfca56-689f-4332-9813-00edf6ec00b5",
      "name": "Wait2",
      "type": "n8n-nodes-base.wait",
      "position": [
        2100,
        -440
      ]
    },
    {
      "id": "6adbf90c-a132-4ef1-88f7-9ab798c955a3",
      "name": "Run Ad Library Scraper",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -1080,
        -140
      ]
    },
    {
      "id": "1380cc04-7732-4070-8306-7c986c513ce7",
      "name": "Loop Over Image Ads",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        -420,
        -140
      ]
    },
    {
      "id": "dafb1f75-ba45-4c08-8581-5e6554de9089",
      "name": "Loop Over Text Ads",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        -420,
        160
      ]
    },
    {
      "id": "66fc9090-11f2-4da1-bdec-9a24be1f5669",
      "name": "Loop Over Video Ads",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        -420,
        -445
      ]
    },
    {
      "id": "2a753af7-acfd-4813-9fc7-1feeae3e38ec",
      "name": "Begin Gemini Upload Session",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        300,
        -520
      ]
    },
    {
      "id": "fed903ba-79f3-466f-b1e3-6cc72f05f341",
      "name": "Redownload Video",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        520,
        -520
      ]
    },
    {
      "id": "bf9a84ef-a025-4d08-bc70-0627c1e5f553",
      "name": "Upload Video to Gemini",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        740,
        -520
      ]
    },
    {
      "id": "9f389a74-0097-4e4f-847f-c80494d9b8a8",
      "name": "Analyze Video with Gemini",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1220,
        -520
      ]
    },
    {
      "id": "1528dc3d-fff4-452c-ad42-2d2e9bdf1f4e",
      "name": "Output Video Summary",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        1500,
        -520
      ]
    },
    {
      "id": "e3fc12fa-d845-435c-95e7-1fc121f0bb48",
      "name": "Add as Type = Video",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1860,
        -520
      ]
    },
    {
      "id": "47291e4b-ae46-4bff-8134-8cf330cfb7aa",
      "name": "Analyze Image",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        -120,
        -220
      ]
    },
    {
      "id": "34ee9e0e-4be8-41f2-b3fc-1868ec912fb8",
      "name": "Output Image Summary",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        80,
        -220
      ]
    },
    {
      "id": "522169ec-669f-441a-9d20-3679426d0b9d",
      "name": "Add as Type = Image",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        440,
        -220
      ]
    },
    {
      "id": "f43bb15e-9c7d-4a97-9a10-7c9ce835f1f6",
      "name": "Output Text Summary",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        -200,
        80
      ]
    },
    {
      "id": "62aec040-3729-447b-864d-00685857d721",
      "name": "Add as Type = Text",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        160,
        80
      ]
    },
    {
      "id": "7079dc10-2ce5-4df9-889a-0e861f1025a5",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1320,
        -560
      ],
      "parameters": {
        "width": 700,
        "height": 260,
        "content": "## AI Facebook Ad Spy Tool\n\nSteps:\n1. Add API key to \"Run Ad Library Scraper\" node\n2. Add filtering threshold in \"Filter For Likes\" node\n3. Add Gemini API key to \"Begin Gemini Upload Session\", \"Upload"
      }
    },
    {
      "id": "33c52cea-4169-43b1-91e9-f8c6c35f06e1",
      "name": "Wait3",
      "type": "n8n-nodes-base.wait",
      "position": [
        960,
        -520
      ]
    }
  ],
  "connections": {
    "Wait": {
      "main": [
        [
          {
            "node": "Loop Over Text Ads",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait1": {
      "main": [
        [
          {
            "node": "Loop Over Image Ads",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait2": {
      "main": [
        [
          {
            "node": "Loop Over Video Ads",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait3": {
      "main": [
        [
          {
            "node": "Analyze Video with Gemini",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch": {
      "main": [
        [
          {
            "node": "Loop Over Video Ads",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Loop Over Image Ads",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Loop Over Text Ads",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Analyze Image": {
      "main": [
        [
          {
            "node": "Output Image Summary",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download Video": {
      "main": [
        [
          {
            "node": "Upload Video to Drive",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter For Likes": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Redownload Video": {
      "main": [
        [
          {
            "node": "Upload Video to Gemini",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Add as Type = Text": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Text Ads": {
      "main": [
        [],
        [
          {
            "node": "Output Text Summary",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Add as Type = Image": {
      "main": [
        [
          {
            "node": "Wait1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Add as Type = Video": {
      "main": [
        [
          {
            "node": "Wait2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Image Ads": {
      "main": [
        [],
        [
          {
            "node": "Analyze Image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Video Ads": {
      "main": [
        [],
        [
          {
            "node": "Download Video",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Output Text Summary": {
      "main": [
        [
          {
            "node": "Add as Type = Text",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Output Image Summary": {
      "main": [
        [
          {
            "node": "Add as Type = Image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Output Video Summary": {
      "main": [
        [
          {
            "node": "Add as Type = Video",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload Video to Drive": {
      "main": [
        [
          {
            "node": "Begin Gemini Upload Session",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Run Ad Library Scraper": {
      "main": [
        [
          {
            "node": "Filter For Likes",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload Video to Gemini": {
      "main": [
        [
          {
            "node": "Wait3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Analyze Video with Gemini": {
      "main": [
        [
          {
            "node": "Output Video Summary",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Begin Gemini Upload Session": {
      "main": [
        [
          {
            "node": "Redownload Video",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Execute workflow’": {
      "main": [
        [
          {
            "node": "Run Ad Library Scraper",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}