Use this robust n8n workflow to automate competitive intelligence. Scrape Facebook ads using Apify, analyze video, image, and text content with OpenAI and Gemini, and log insights to Google Sheets.
Download this n8n workflow template and start using it instantly.
Markdown-formatted text:
Marketing Agencies: Looking to scale competitor monitoring and generate data-driven ad copy for clients.
PPC Specialists: Needing an automated way to track high-performing Facebook ad creative and messaging strategies.
AI Automation Builders: Seeking complex n8n templates that integrate external scraping APIs (Apify) with advanced AI models (Gemini, OpenAI).
Data Analysts: Requiring a consistent pipeline to extract, classify, and enrich unstructured ad data.
Understanding competitor advertising strategy is crucial, yet manually monitoring the Facebook Ad Library is time-consuming. This powerful n8n workflow solves this problem by creating a fully automated AI ad spy tool.
Starting with an n8n trigger, the system leverages Apify to scrape hundreds of active Facebook ads based on predefined keywords. It then filters for high-quality pages (over 1000 likes) before routing the ads into three distinct processing pipelines based on media type: video, image, or text. The video pipeline uses Google Gemini's multimodal capabilities, involving temporary storage in Google Drive, for deep analysis. The image pipeline uses GPT-4 Vision for creative breakdown. The resulting intelligence—a detailed summary and strategically rewritten ad copy—is logged automatically into a Google Sheet, creating a dynamic, searchable competitive intelligence database. This complex n8n template provides immense business value for agencies seeking a scalable, revenue-generating service.
This advanced n8n workflow operates in three main stages:
When clicking ‘Execute workflow’).Run Ad Library Scraper n8n node executes an Apify task via HTTP Request, retrieving a list of active Facebook ads based on a specific search term (e.g., 'AI automation').Filter For Likes n8n node filters the results, ensuring only ads from advertisers with more than 1000 page likes proceed, focusing the analysis on established competitors.Switch n8n node determines the content type (Video, Image, or Text) based on the presence of specific media URLs in the scraped data, sending items to the appropriate batch processor. Items are separated using three SplitInBatches nodes. Video Analysis: For video ads, the workflow downloads the video, uploads it to Google Drive, and initiates a complex resumable upload process to the Gemini API using multiple HTTP Request nodes. The Analyze Video with Gemini n8n node then provides a detailed description of the video content.
Image Analysis: For image ads, the Analyze Image n8n node utilizes OpenAI's GPT-4o model (vision capability) to analyze the image URL and generate a descriptive image prompt.
Output Summary nodes) receives the raw ad data and the AI-generated visual description (where applicable). It uses a specialized prompt to generate two critical pieces of output in JSON format: a comprehensive strategic summary of the ad and a rewrittenAdCopy based on competitive insights.Add as Type = Video/Image/Text) appends all relevant data points—page ID, date, analysis summary, rewritten copy, and the raw AI prompt (image/video description)—into a dedicated Google Sheets database. This completes the fully automated competitor analysis n8n workflow.Markdown-formatted text:
Run Ad Library Scraper n8n node. Replace in the Authorization header parameter with your actual Apify API key. Customize the search URL within the JSON body if needed.Analyze Image, Output Image Summary/Video Summary/Text Summary).) into the query parameters of the following n8n nodes: Begin Gemini Upload Session, Upload Video to Gemini, and Analyze Video with Gemini.Add as Type = ... Google Sheets n8n nodes, link the correct Google Sheet document ID and sheet name where you wish to store the competitor analysis data.Markdown-formatted text:
When clicking ‘Execute workflow’ (Manual Trigger): The initial n8n trigger that starts the entire data extraction and processing cycle.
Run Ad Library Scraper (HTTP Request): Sends a POST request to the Apify service to initiate and retrieve results from the Facebook Ad Library scraper. Key Configuration: Uses a Bearer Token for authorization and defines search parameters for active ads over the last 7 days.
Filter For Likes (Filter n8n node): Ensures data quality by allowing only items where the advertiser's page likes count is greater than 1000.
Switch (Logic n8n node): A routing node that checks for the existence of videosdurl or originalimageurl to direct the flow into the appropriate AI processing path (Video, Image, or Text).
Download Video (HTTP Request): Downloads the raw video binary data from the Facebook source URL provided by the scraping result.
Analyze Image (OpenAI n8n node): Uses the gpt-4o model for vision analysis. Takes the ad image URL and generates a comprehensive text description of the creative, which is used as an input prompt for summarization.
Analyze Video with Gemini (HTTP Request): Calls the Gemini API to analyze the uploaded video file, providing a detailed textual description of the video content. This is a crucial step in this multi-modal n8n workflow.
Output [Media Type] Summary (OpenAI n8n node): These nodes utilize a highly structured system prompt with GPT-4.1 to perform strategic competitor analysis. They output a JSON object containing the summary of the competitor's strategy and optimized, rewrittenAdCopy for internal use.
Use this complex n8n workflow to automatically triage new Gmail emails, classify them using Google Gemini and OpenAI, prioritize alerts via Telegram, and empower a conversational AI agent with custom n8n node tools for immediate actions.

Use this advanced n8n workflow to automatically generate personalized Gmail replies using HubSpot CRM context (deals, tickets, companies) via the Google Gemini AI agent, requiring human approval through Slack before sending.

Automate Gmail cleaning with this powerful n8n workflow. Use a specialized n8n node powered by AI to classify and automatically delete SPAM and marketing OFFER emails, ensuring a clean, focused inbox.

Use this powerful n8n workflow to automatically analyze Strava activity data (running, cycling, swimming) using the Google Gemini AI agent, generate personalized coaching insights, and deliver them via email. This n8n template streamlines performance review.

Automate high-volume AI content creation using this robust n8n workflow template. Leverage Google Sheets for planning and OpenAI for dynamic guest post generation.

Use this powerful n8n workflow to automatically generate hairstyle previews using OpenAI Image Edit based on an n8n form submission. Upload the result to Cloudinary and instantly share it to a designated LINE group. Get started with n8n templates today.

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!







































