AutomationFlowsAI & RAG › Facebook Ads Competitive Analysis Using Gemini and Open AI

Facebook Ads Competitive Analysis Using Gemini and Open AI

ByArchit Jain @architjn on n8n.io

How it works User submits a keyword through a form to trigger the workflow. Ads matching the keyword are scraped from Facebook Ads Library. Ads are filtered by media type (image or video). Images are analyzed using an AI model to describe visuals and text. Videos are downloaded,…

Event trigger★★★★☆ complexityAI-powered18 nodesForm TriggerHTTP RequestOpenAIGoogle Sheets
AI & RAG Trigger: Event Nodes: 18 Complexity: ★★★★☆ AI nodes: yes Added:

This workflow corresponds to n8n.io template #4716 — we link there as the canonical source.

This workflow follows the Form Trigger → Google Sheets recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "id": "vHsNo2bT3fT7hUut",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Competitor Facebook Ads Analysis",
  "tags": [],
  "nodes": [
    {
      "id": "adf65921-a4ad-45a9-af66-cdf28fb9489d",
      "name": "On form submission",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -320,
        -100
      ],
      "parameters": {},
      "typeVersion": 2.2
    },
    {
      "id": "b1a7ea37-cb62-40d1-8f44-5462526ee15d",
      "name": "Scrape Ads",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -100,
        -100
      ],
      "parameters": {},
      "typeVersion": 4.2
    },
    {
      "id": "e4afbd32-609f-4cc8-8110-ddba6fae220c",
      "name": "Switch",
      "type": "n8n-nodes-base.switch",
      "position": [
        120,
        -100
      ],
      "parameters": {},
      "typeVersion": 3.2
    },
    {
      "id": "5b65018d-13bc-49c1-8d90-72c312d435a0",
      "name": "OpenAI",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        1000,
        240
      ],
      "parameters": {},
      "typeVersion": 1.8
    },
    {
      "id": "30b8d761-b8dd-4fa7-b95d-69fdbaf5f611",
      "name": "Extract from File",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        700,
        -440
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "297b137d-efe5-4505-af48-64ee1b74e183",
      "name": "Gemini Video Decode",
      "type": "n8n-nodes-base.httpRequest",
      "maxTries": 2,
      "position": [
        1520,
        -240
      ],
      "parameters": {},
      "retryOnFail": true,
      "typeVersion": 4.2
    },
    {
      "id": "269d4a72-1357-43f6-8f00-04a1ee4a6598",
      "name": "Download Video",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        440,
        -440
      ],
      "parameters": {},
      "typeVersion": 4.2
    },
    {
      "id": "85e1b3f4-0756-4417-a671-40fa12dbf7ac",
      "name": "Final Image Values",
      "type": "n8n-nodes-base.set",
      "position": [
        1240,
        240
      ],
      "parameters": {},
      "typeVersion": 3.4
    },
    {
      "id": "32b28e43-318f-4fef-b6ad-0aedbc1208b8",
      "name": "Final Video Values",
      "type": "n8n-nodes-base.set",
      "position": [
        1820,
        -460
      ],
      "parameters": {},
      "typeVersion": 3.4
    },
    {
      "id": "54257346-eebb-4d78-b067-6fced3f47f87",
      "name": "Merge",
      "type": "n8n-nodes-base.merge",
      "position": [
        2100,
        -100
      ],
      "parameters": {},
      "typeVersion": 3.2
    },
    {
      "id": "2a0d213e-12b2-4f74-927b-83800f87c669",
      "name": "Save",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2320,
        -100
      ],
      "parameters": {},
      "typeVersion": 4.6
    },
    {
      "id": "af5c93a1-4cfd-4872-87bf-9aa14c6c9d3f",
      "name": "Loop Over Items",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        960,
        -440
      ],
      "parameters": {},
      "typeVersion": 3
    },
    {
      "id": "9ffc219a-5fdc-4807-90a8-9cbeb1b96070",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -380,
        -420
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "6cd95539-dd5c-4f30-acd5-74c9ef6165dd",
      "name": "Wait",
      "type": "n8n-nodes-base.wait",
      "position": [
        1320,
        -240
      ],
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "29e86694-dedd-4c98-b495-a1392fc60c02",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        360,
        -720
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "96e4fe36-feab-460a-afa1-dc37bfff728f",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1200,
        -360
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "f4776bf8-1cdf-464a-8e84-ee3a3484179c",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        360,
        40
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "704d9e14-42bd-453e-b0a0-66023860f4b8",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2040,
        -360
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "efedf1cf-6e33-41ea-889c-e37f73ed8826",
  "connections": {
    "Wait": {
      "main": [
        [
          {
            "node": "Gemini Video Decode",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge": {
      "main": [
        [
          {
            "node": "Save",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI": {
      "main": [
        [
          {
            "node": "Final Image Values",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch": {
      "main": [
        [
          {
            "node": "Download Video",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "OpenAI",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Scrape Ads": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download Video": {
      "main": [
        [
          {
            "node": "Extract from File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [
          {
            "node": "Final Video Values",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract from File": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Final Image Values": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Final Video Values": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "On form submission": {
      "main": [
        [
          {
            "node": "Scrape Ads",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gemini Video Decode": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

How it works User submits a keyword through a form to trigger the workflow. Ads matching the keyword are scraped from Facebook Ads Library. Ads are filtered by media type (image or video). Images are analyzed using an AI model to describe visuals and text. Videos are downloaded,…

Source: https://n8n.io/workflows/4716/ — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

Note: Now includes an Apify alternative for Rapid API (Some users can't create new accounts on Rapid API, so I have added an alternative for you. But immediately you are able to get access to Rapid AP

Form Trigger, Google Sheets Trigger, OpenAI +2
AI & RAG

This system automates LinkedIn lead generation and enrichment in six clear stages: Lead Collection (via Apollo.io) Automatically pulls leads based on keywords, roles, or industries using Apollo’s API.

Form Trigger, OpenAI, Google Sheets Trigger +2
AI & RAG

This workflow turns a user-submitted form with country or animal names into a cinematic video with animated scenes and immersive ambient audio. Using GPT-4 for prompt generation, Dumpling AI for visua

Form Trigger, OpenAI, HTTP Request +2
AI & RAG

Automatically generates, designs, stores, and logs complete Instagram carousel posts. It transforms a simple text prompt into a full post with copy, visuals, rendered images, Google Drive storage, and

Google Drive, Form Trigger, OpenAI +3
AI & RAG

This workflow automates the process of finding highly relevant job listings based on a user’s resume, career preferences, and custom filters. It scrapes fresh job data, evaluates relevance using OpenA

Google Sheets, HTTP Request, Form Trigger +1