Analyze competitor Facebook ads with Apify, OpenAI, and Google Sheets

Go to Workflow
13 views
Built by Dr. Firas Dr. Firas
Created on August 04, 2026

Description

Quick overview
This workflow manually scrapes Facebook Ad Library results via apify, filters for high-like advertisers, analyzes video/image/text ads with OpenAI (vision + text), and appends a strategic summary plus rewritten ad copy for each ad to Google Sheets.

How it works
Starts when you run the workflow manually.
Sends your keyword, country, status, and limit settings to an apify Facebook Ad Library scraper API to fetch recent ads and their details.
Filters out ads from advertisers whose Facebook page likes are below the configured minimum.
Routes each remaining ad into video, image, or text-only processing based on which creative fields are present.
For video and image ads, uses OpenAI Vision to describe the ad creative (video cover frame or image) and then uses OpenAI to generate a structured strategic analysis and a rewritten version of the ad copy.
For text-only ads, uses OpenAI to generate the same structured strategic analysis and rewritten ad copy from the scraped ad data.
Appends each analysis result to a Google Sheets spreadsheet for tracking and review.

Setup
Add an apify API token as an HTTP Header Auth credential and ensure you have access to the Apify actor used by the Facebook Ad Library scraper request.
Add an OpenAI API credential with access to the configured vision and chat models, and update the model IDs in the configuration if needed.
Connect Google Sheets OAuth2 credentials and select the target spreadsheet and sheet in each of the three Google Sheets append steps.
Adjust the configuration values (search keywords, country, active status, minimum page likes, and max ads) to match the competitors and markets you want to monitor.

Additional info
Analyze competitor Facebook ads with Apify and OpenAI
šŸ“„ Open full documentation on Notion

Need help customizing?
Contact me for consulting and support : Linkedin

MY NEW YOUTUBE CHANNEL
šŸ‘‰ Subscribe to my new YouTube channel. Here I'll share videos and Shorts with practical tutorials and FREE templates for n8n.

Nodes Used (6)

AI Agent
@n8n/n8n-nodes-langchain.agent
Google Sheets
n8n-nodes-base.googleSheets
HTTP Request
n8n-nodes-base.httpRequest
OpenAI
@n8n/n8n-nodes-langchain.openAi
OpenAI Chat Model
@n8n/n8n-nodes-langchain.lmChatOpenAi
Structured Output Parser
@n8n/n8n-nodes-langchain.outputParserStructured