Mindket

Facebook Ad Library spy with AI ad ideas

Newversion 1 · updated

Overview

An n8n workflow that studies the Facebook ads for a search word and country. Apify scrapes the Ad Library, Gemini and OpenAI describe each video, image and text ad, and GPT-4.1 writes a summary and new ad ideas into Google Sheets.

Facebook Ad Library spy with AI ad ideas is an n8n workflow in the Marketing & SEO category, listed by Mindket. It is free. This is version 1, last updated on . Download it on this page or copy its JSON, then import it into an n8n canvas. Nothing runs until you activate it in n8n.

At a glance

Runs in
  • n8n Cloud: import the file into a new workflow there
  • Your own n8n server: the same file and steps
  • Google Sheets: one row per ad, with its type, summary, Ad Library link and ideas, ready to sort or share
  • Google Drive: every video ad is kept in the folder you choose

Platform

Connects 5 apps

How it works

Trigger

Ad search form

It starts when someone sends the Details form with:

  • query: the word to search the Ad Library for
  • Country: where the ads run
  • About Your Product: a few lines on what you sell

Actions

  1. Apify scrapes up to 200 active ads from the Facebook Ad Library for that word and country
  2. A filter keeps ads from pages that have likes, and a switch sorts them into video, image and text
  3. Each video is saved to Google Drive and described by Gemini, and each image is described by GPT-4o
  4. GPT-4.1 writes a summary of each ad and up to five new ideas for your product
  5. Each ad read gets a row in Google Sheets, and the loops come set to read the first ad of each type

Result

Rows in Google Sheets with each ad’s type, a summary, its Ad Library link and new ad ideas for your product

Integrations

What you need before you start.

Apify

Ad scraping

Runs an actor through one HTTP Request node and returns the active ads for the word and country, with their details.

NeedsApify API token

OpenAI

Language and image models

Runs GPT-4o to describe each image ad and GPT-4.1 to summarize every ad and write its ideas.

NeedsOpenAI API key

Google Gemini

Video analysis

Takes each uploaded video through its Files API and describes it in detail with the Flash model named in Video Analyse2.

NeedsGemini API key, in three request nodes

Google Drive

File storage

Keeps each video ad and supplies the file size that the Gemini upload needs, then hands the file back.

NeedsGoogle account with Drive access, and a folder

Google Sheets

Spreadsheet

Adds a row per ad with its type, summary, Ad Library link and ideas.

NeedsGoogle account with Sheets access, and a sheet with four columns

Workflow check

Checked by Mindket on 13 Nov 2026

Steps
26 steps, starting on a form
AI
4 steps call an AI model: Video Ad Ideas, Analyze Image1, Image Ad Ideas and Text Ad Ideas
Sign-ins
Signs in to: Google Drive, Google Sheets, OpenAI and Apify
API keys
No API key is left in the file; 2 blanks in it for your own key
Step types
Mindket’s checker reads all 10 of its step types

Read from the workflow’s file, not from a run.

About

What it is

This n8n workflow reads the Facebook ads your rivals run and writes new ad ideas from them. You send a form with a search word, a country and a few lines about your product. Apify scrapes the matching active ads from the Facebook Ad Library, and a filter keeps those from pages that have likes. The ads then split by type. Video ads are saved to Google Drive and described by Gemini, image ads are described by GPT-4o, and text ads go straight on. GPT-4.1 writes a summary of each ad and up to five fresh ideas for your product, and each ad gets a row in Google Sheets. The three loop nodes come with Execute Once switched on, so until you turn it off a run reads only the first ad of each type.

Who it suits

Media buyers, small advertisers and agencies that study what rivals run before they plan their own creative. It suits someone happy to read a long sheet, since with the loops running in full one search can fill 200 rows. Skip it for a quick look at one rival: an Apify token, a Gemini key and two Google credentials take longer to set up than a search in the Ad Library does.

Who uses it, and how
IndustryWho uses itHow they use itExample
Online retailStore ownersSearch the product word and read the ideas beside each rival adA shop that sells backpacks searches backpack and sees which ad styles keep repeating.
Performance marketingMedia buyersRun the same search each week and compare the rowsA buyer runs one search every Monday and sorts the sheet by Type.
AgenciesCreative strategistsSend a client’s niche through the form before a pitchA strategist brings a sheet of rival summaries and ideas to a pitch.
Software and appsProduct marketersDescribe the product in the form so the ideas fit itAn app team describes its product and gets ideas written for it, not for the rival.
Courses and coachingCourse creatorsSearch a topic in one country to see how others pitch itA course creator looks at how rival courses are pitched in Canada.

Where to use it

Any n8n that can reach Apify, Google and OpenAI will run it. The form is the front door, so you share its address with whoever does the searching.

  • n8n Cloud: import the file into a new workflow there
  • Your own n8n server: the same file and steps
  • Google Sheets: one row per ad, with its type, summary, Ad Library link and ideas, ready to sort or share
  • Google Drive: every video ad is kept in the folder you choose
  • A chat or a board: add a node after a Collect data node to send each row on

Setup

Get it saves a zip with workflow.json and Mindket’s setup notes in your downloads folder. Its author puts setup at about 21 minutes.

What you need first
NeedDetail
n8nOn n8n Cloud or on a server of your own
ApifyAn account and its API token
GeminiAn API key from Google AI Studio
OpenAIAn API key that can use GPT-4.1 and GPT-4o
GoogleAn account for Drive and Sheets credentials
A spreadsheetA tab named Sheet1 with Type, summary, ad_url and ad_Ideas in row 1
A Drive folderWhere the video ads are kept
  1. In n8n, create a workflow, open its menu, choose Import from File and pick workflow.json.
  2. Copy the spreadsheet’s ID from its address, between /d/ and /edit. Add a Google Sheets OAuth2 credential. In Collect data, Collect data1 and Collect data2, select it and replace YOUR_SHEET_ID with the ID.
  3. Add a Google Drive OAuth2 credential and select it in Upload video and Download Video1. In Upload video, replace YOUR_FOLDER_ID with your folder’s ID.
  4. In Video Analyse, Video Analyse1 and Video Analyse2, replace <YOUR_GEMINI_API_KEY> in the key query field with your Gemini key. The brackets go too.
  5. In the address of Video Analyse2, change gemini-2.0-flash to a current model such as gemini-3.6-flash.
  6. In Ads Scraping, replace <YOUR_APIFY_TOKEN> in the Authorization header with your token, so the header reads Bearer, a space and the token.
  7. Add an OpenAI credential and select it in Analyze Image1, Video Ad Ideas, Image Ad Ideas and Text Ad Ideas.
  8. Save, send the form once from its test address, then press Publish.

How to use it

Open the form from On form submission and fill in all three fields. query is the word to search for, Country is the country and About Your Product is a few lines on what you sell. The form confirms at once. The run goes on behind it. As the file comes, a run adds up to three rows, one each for the first video, image and text ad. Once the loops run in full, rows keep arriving as each ad is finished.

What to change for a different result
To changeWhere
How many adscount in the body of Ads Scraping, set to 200
How far backperiod, set to last7d, and the fixed start_date[min] in the address inside that body
Which pagesThe likes condition in Filter Ads, which keeps pages with more than zero
The ideasThe prompt in the three Ad Ideas nodes, which asks for at most 5 ideas in a set style
Every ad, not one of eachExecute Once in the settings of Video Ads, Image Ads and Text Ads, switched on in the file
ColumnsThe mapping in the three Google Sheets nodes

Example

A form entry from a shop that sells bike gear:

query: backpack
Country: US
About Your Product: Waterproof commuter backpacks for cyclists

Apify returns the active ads that match. For each one, the idea node answers in this shape, with every idea in one cell of the sheet:

{
  "summary": "…",
  "adIdeas": "1. <title>: <concept>\n   Execution: <execution>\n\n2. …"
}

The row for a video ad holds the type Video, that summary, the ad’s Ad Library link and the ideas.

For newcomers and experts

If you are new. n8n draws a workflow as boxes joined by lines, and each box, a node, does one job. A credential is a key n8n keeps for you and hands to the node you pick it in. Several keys here sit in node fields instead, which is why the setup lists each node by name. Test with a small count first. Each node then shows what it received and sent, which is where a wrong key or a missing column turns up.

For experts. Three ad types take three routes, and three models share the reading.

The model behind each step
StepModelWhat to know
Video Analyse2gemini-2.0-flash in the file. Google’s deprecations page, read on 2 November 2026, lists it as shut down on 1 June 2026Reads the video that Video Analyse and Video Analyse1 uploaded, through the Gemini API directly, and retries when the call fails
Analyze Image1gpt-4oDescribes each image ad in detail
Video Ad Ideas, Image Ad Ideas, Text Ad Ideasgpt-4.1, temperature 0.7One prompt in all three. The ad’s scraped data goes in as JSON, plus the video or image description

The Drive round trip for a video supplies the file size that Gemini’s upload asks for. Upload video gives the size, Video Analyse opens a resumable upload with it, Download Video1 fetches the file back and Video Analyse1 sends the bytes. Each route is a Loop Over Items node that takes one ad, writes its row and comes back after a one-second Wait. With Execute Once on, that node lets in only the first ad, so its second pass ends the loop.

Good to know

A big search costs real money, and a few details of the file need a test with your own searches.

  • Billing: Apify bills the actor run for every ad it returns, even while the loops read three. OpenAI bills the model calls and Gemini the video reads, so lower count before you let the loops run in full
  • Country: the form’s entry goes straight into country= in the Ad Library address, and its example is a name. The Library’s own addresses use a two-letter code such as US there, so try the code if a search finds nothing
  • Fixed date: the address also holds start_date[min]=2025-06-12, so older ads may be left out
  • The video test: Switch1 checks the second card for a video address and the first card for an image address, and Download Video reads the first card. Try a few real ads before you trust the split
  • Drive: every video is saved as Example File and none is deleted
  • Keys: the Gemini key sits in three request nodes and the Apify token in a header, so both travel with any export of the workflow
  • Open form: once the workflow is published, anyone with the form’s address can start a run on your keys, so turn on the form trigger’s authentication or keep the address private
  • Terms: the ads come from Facebook’s public Ad Library through an Apify actor, so read the Library’s terms and the actor’s page before you reuse the results
  • Where data goes: ad text and images go to OpenAI, and videos go to Google Drive and Gemini
  • A repair: the original copy had lost the backslashes of the line breaks in the example answer of the three idea prompts. This one has them back
  • Credentials: the JSON holds none, and nothing from its author’s account

README and files

README

Facebook Ad Library spy with AI ad ideas

An n8n workflow. Send its form a search word, a country and a few lines about your product. It scrapes the matching
ads from the Facebook Ad Library, has AI describe each video, image and text ad, and writes a summary and new ad ideas
for each ad it reads into Google Sheets.

What is inside

  • workflow.json: the workflow as n8n exports it, 30 nodes, four of them sticky notes. It holds no credential. The
    Apify token, the Gemini key, the Drive folder and the spreadsheet are left as placeholders.
  • README.md: these notes.

Before you start

  • An n8n instance, on n8n Cloud or your own server.
  • An Apify account and its API token.
  • A Gemini API key from Google AI Studio.
  • An OpenAI API key that can use GPT-4.1 and GPT-4o.
  • A Google account for Drive and Sheets.
  • A spreadsheet with a tab named Sheet1 and these column names in row 1: Type, summary, ad_url and ad_Ideas.
  • A Google Drive folder for the downloaded videos.

Set it up

  1. In n8n, create a workflow, open its menu and choose Import from File. Pick workflow.json.
  2. Copy the spreadsheet's ID, the long part of its address between /d/ and /edit. Add a Google Sheets OAuth2
    credential. In Collect data, Collect data1 and Collect data2, select it and replace YOUR_SHEET_ID with the ID.
    Each node finds its tab by the name Sheet1.
  3. Copy the Drive folder's ID, the last part of its address. Add a Google Drive OAuth2 credential and select it in
    Upload video and Download Video1. In Upload video, replace YOUR_FOLDER_ID with the folder's ID.
  4. In Video Analyse, Video Analyse1 and Video Analyse2, replace <YOUR_GEMINI_API_KEY> in the key query field
    with your Gemini key. The brackets go too. In the address of Video Analyse2, also change gemini-2.0-flash to a
    current model such as gemini-3.6-flash. Google's deprecations page, read on 2 November 2026, lists 2.0 Flash as
    shut down on 1 June 2026.
  5. In Ads Scraping, replace <YOUR_APIFY_TOKEN> in the Authorization header with your token. The header then reads
    Bearer, a space and the token.
  6. Add an OpenAI credential and select it in Analyze Image1, Video Ad Ideas, Image Ad Ideas and Text Ad Ideas.
  7. Save, send the form once from its test address, then press Publish at the top of the canvas (or Shift+P).

How a run goes

  • The form On form submission asks for query, Country and About Your Product. Code turns the search word into
    a URL-safe string, and Ads Scraping asks an Apify actor for the active ads that match, up to 200 of them.
  • Filter Ads keeps the ads whose advertiser page has more than zero likes. Switch1 sends each one down the Video,
    Image or Text path.
  • Each path starts at a loop node, Video Ads, Image Ads or Text Ads, which hands on one ad at a time. As the
    file comes, those three have Execute Once on, so only the first ad of each type goes through (see Good to know).
    A video is downloaded, saved to Drive as Example File, uploaded to Gemini through Video Analyse and
    Video Analyse1, and described by Video Analyse2 after a 15-second wait. An image is downloaded and described by
    Analyze Image1. A text ad skips this step.
  • Video Ad Ideas, Image Ad Ideas and Text Ad Ideas send the ad and its description to GPT-4.1, which returns a
    summary and adIdeas as JSON. Then Collect data, Collect data1 and Collect data2 append a row each. A Wait
    node of one second leads back to the loop node for the next ad.

Change the look

  • How many ads: count in the body of Ads Scraping, set to 200.
  • How far back: period, set to last7d, and the fixed start_date[min]=2025-06-12 in the address inside the same
    body.
  • Which pages: the likes condition in Filter Ads.
  • The ideas: the prompt in the three Ad Ideas nodes. It asks for at most 5 ideas and sets a style. temperature is
    0.7.
  • Models: gpt-4.1 in the three idea nodes, gpt-4o in Analyze Image1, and the Gemini model in the address of
    Video Analyse2 (step 4).
  • Every ad: switch off Execute Once in the Settings tab of Video Ads, Image Ads and Text Ads.
  • Columns: the mapping in the three Google Sheets nodes.

Good to know

  • As it comes, a run reads at most one video, one image and one text ad and writes at most three rows, because the
    three loop nodes have Execute Once on. Apify still returns every ad that matches. Switch the setting off once your
    test rows look right.
  • With the loops running in full, a run can be large: each ad costs a model call or two, with a download, a Drive
    upload and a Gemini upload for videos. Lower count first. Apify, OpenAI and Gemini each bill their own part.
  • Ads Scraping waits for the actor in a single request, so a big search may time out. A smaller count helps.
  • Country is typed straight into country= in the Ad Library address, and the form's example shows a name. Facebook's
    own Ad Library addresses use a two-letter code there, such as US, so try the code if a search finds nothing.
  • The address also holds a fixed start date, start_date[min]=2025-06-12, so older ads may be left out. Change the date
    or remove that part.
  • Switch1 looks at the second card (cards[1]) for a video address and at the first card for an image address, while
    Download Video reads the first card. Try a few real ads, and change the paths if a single-card video lands in
    the wrong branch.
  • The four Wait nodes store an amount and no unit. This node version's default unit is seconds, so they pause 1 second
    each and Wait7 pauses 15 seconds. Raise Wait7 if Gemini has not finished reading the video by then.
  • Every video is saved to Drive as Example File and none is deleted afterwards. Clear the folder from time to time.
  • The Gemini key sits in three request nodes as a query field and the Apify token in a header, so both travel with any
    export of the workflow. Take them out before you share the file.
  • Once the workflow is published, anyone with the form's address can start a run on your keys. The form trigger can ask
    for a username and password.
  • The ads come from Facebook's public Ad Library through an Apify actor. Check the Library's terms and the actor's
    page before you reuse what it returns.
  • The ad text and images go to OpenAI, and the videos go to Google Drive and to Gemini.
  • The original copy had lost the backslashes of the line breaks in the example answer of the three Ad Ideas
    prompts, where it showed <concept>n Execution. This one has them back.
Files
README.md  6 KB
workflow.json  34 KB

2 files, 41 KB, downloaded as a zip.

What’s new

  • Version 1 · 2026-11-03

Reviews

No ratings yet

Write a review

No reviews yet.

More from Mindket

See all from Mindket

Huashu Design

alchaincyf · Skill

Turns a one-line request in your AI agent into a finished design: a launch animation, a clickable app prototype, an editable slide deck, an infographic or a se…

New29.4k

Guizang PPT Skill

op7418 · Skill

Skill that makes single-file HTML slide decks, slide illustrations and platform covers in two visual styles, with a presenter mode for rehearsal. For speakers…

New29.8k

Claude Code Skills & Plugins

alirezarezvani · Skill

Adds 411 ready-made skills for Claude Code and other coding agents, grouped by role from engineering and product to marketing, finance and compliance. Installs…

New29.8k

Similar in Marketing & SEO

See all in Marketing & SEO

Pixel Art XL

nerijs · Kit

A pixel art style add-on for Stable Diffusion XL that turns text prompts into pixel-style images, with an optional LCM LoRA for faster runs. For game makers, d…

New

Licon MSR for LTX-2.5

LiconStudio · Kit

Keeps characters, clothing, objects and backgrounds consistent in generated video by feeding the model up to five reference images. A LoRA for LTX-2.5 in Comfy…

New

Flux.2-Klein-9B-MatchingPose

nhathoangfoto · Kit

A LoRA for FLUX.2 Klein 9B that puts a character into the pose shown by a mannequin reference while keeping the character's face and style. For artists and des…

New