Apify to Gmail, competitor Facebook ad reports
Competitor ad research sounds simple until you’re juggling tabs, screenshots, and “where did I save that?” folders. Then you still have to turn it into something a client (or your boss) will actually read.
Paid media managers feel it first. Agency strategists and in-house growth marketers get dragged into it too. This Apify Gmail reports automation pulls the latest Facebook ads, removes duplicates, and emails a clean creative report without the usual scramble.
You’ll see how the workflow fetches ads, picks the best ones, runs AI analysis on images and videos, and sends a client-ready summary to Gmail.
How This Automation Works
Here’s the complete workflow you’ll be setting up:
n8n Workflow Template: Apify to Gmail, competitor Facebook ad reports
flowchart LR
subgraph sg0["On form submission Flow"]
direction LR
n0["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/httprequest.dark.svg' width='40' height='40' /></div><br/>Scrape ads"]
n1["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/merge.svg' width='40' height='40' /></div><br/>Merge Media Result"]
n2@{ icon: "mdi:brain", form: "rounded", label: "OpenAI Chat Model", pos: "b", h: 48 }
n3@{ icon: "mdi:robot", form: "rounded", label: "Auto-fixing Output Parser", pos: "b", h: 48 }
n4@{ icon: "mdi:robot", form: "rounded", label: "Structured Output Parser", pos: "b", h: 48 }
n5@{ icon: "mdi:cog", form: "rounded", label: "Aggregate", pos: "b", h: 48 }
n6@{ icon: "mdi:robot", form: "rounded", label: "AI Agent", pos: "b", h: 48 }
n7@{ icon: "mdi:message-outline", form: "rounded", label: "Email the top job recommenda..", pos: "b", h: 48 }
n8@{ icon: "mdi:swap-vertical", form: "rounded", label: "Select Image Fields", pos: "b", h: 48 }
n9@{ icon: "mdi:swap-horizontal", form: "rounded", label: "Split Image Ads & Video Ads", pos: "b", h: 48 }
n10@{ icon: "mdi:swap-vertical", form: "rounded", label: "Select Video Fields", pos: "b", h: 48 }
n11["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/httprequest.dark.svg' width='40' height='40' /></div><br/>Download video"]
n12["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/httprequest.dark.svg' width='40' height='40' /></div><br/>Upload video Gemini"]
n13["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/httprequest.dark.svg' width='40' height='40' /></div><br/>Analyze video Gemini"]
n14@{ icon: "mdi:cog", form: "rounded", label: "Wait", pos: "b", h: 48 }
n15@{ icon: "mdi:robot", form: "rounded", label: "Analyze Image", pos: "b", h: 48 }
n16@{ icon: "mdi:swap-vertical", form: "rounded", label: "Combine all Ads information ..", pos: "b", h: 48 }
n17@{ icon: "mdi:swap-vertical", form: "rounded", label: "Image duplicate key", pos: "b", h: 48 }
n18@{ icon: "mdi:swap-vertical", form: "rounded", label: "Image Duplicate Key", pos: "b", h: 48 }
n19@{ icon: "mdi:cog", form: "rounded", label: "Image Remove Duplicates", pos: "b", h: 48 }
n20@{ icon: "mdi:cog", form: "rounded", label: "Video Remove Duplicates", pos: "b", h: 48 }
n21@{ icon: "mdi:cog", form: "rounded", label: "Image Limit 5", pos: "b", h: 48 }
n22@{ icon: "mdi:cog", form: "rounded", label: "Video Limit 5", pos: "b", h: 48 }
n23["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/form.svg' width='40' height='40' /></div><br/>On form submission"]
n14 --> n13
n6 --> n7
n5 --> n16
n0 --> n9
n15 --> n8
n21 --> n15
n22 --> n11
n11 --> n12
n2 -.-> n3
n2 -.-> n6
n1 --> n5
n23 --> n0
n18 --> n20
n17 --> n19
n8 --> n1
n10 --> n1
n12 --> n14
n13 --> n10
n19 --> n21
n20 --> n22
n4 -.-> n3
n3 -.-> n6
n9 --> n17
n9 --> n18
n16 --> n6
end
%% Styling
classDef trigger fill:#e8f5e9,stroke:#388e3c,stroke-width:2px
classDef ai fill:#e3f2fd,stroke:#1976d2,stroke-width:2px
classDef aiModel fill:#e8eaf6,stroke:#3f51b5,stroke-width:2px
classDef decision fill:#fff8e1,stroke:#f9a825,stroke-width:2px
classDef database fill:#fce4ec,stroke:#c2185b,stroke-width:2px
classDef api fill:#fff3e0,stroke:#e65100,stroke-width:2px
classDef code fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px
classDef disabled stroke-dasharray: 5 5,opacity: 0.5
class n23 trigger
class n3,n4,n6,n15 ai
class n2 aiModel
class n9 decision
class n0,n11,n12,n13 api
classDef customIcon fill:none,stroke:none
class n0,n1,n11,n12,n13,n23 customIcon
Why This Matters: Competitor Ad Research That Actually Gets Used
If you’ve ever done “quick” competitor research, you know how it goes. You start by checking the Facebook Ads Library, then you copy links into a doc, then you grab a few screenshots “just in case.” Before long you’re sorting ad formats (image vs video), trying to spot repeats, and guessing which creatives are worth talking about. The worst part is the end: packaging it into a report that looks intentional, not improvised. It’s mental load, not just time, and it steals attention from the work that moves results.
It adds up fast. Here’s where it breaks down.
- Pulling “the latest ads” becomes a weekly rabbit hole because you have no consistent capture process.
- Duplicates sneak in when the same creative runs in multiple placements or slightly different formats.
- Video ads rarely get reviewed deeply because downloading and scrubbing them takes forever.
- Even when you find good examples, you still have to explain what makes them good, which slows handoffs to clients and teammates.
What You’ll Build: Automated Competitor Creative Email Reports
This workflow starts with a simple intake: a user submits their email plus a competitor Facebook Page URL through a form trigger. n8n then calls Apify (via HTTP Request) to scrape the most recent ads from that page, including both images and videos. From there, the workflow routes each ad by media type, builds a unique “key” per creative, and removes duplicates so you’re not analyzing the same concept twice. It caps the final set to the top 5 image ads and top 5 video ads, then runs AI analysis on each. Image ads go through OpenAI Vision (GPT-4) for creative review, while video ads are retrieved, sent to Gemini for analysis, and delayed briefly so processing completes cleanly. Finally, everything is aggregated into a structured report and delivered by Gmail with previews and clear takeaways.
The workflow begins at the form intake, so you can hand it to a teammate or even a client without exposing your backend. In the middle, it cleans and standardizes the ad data, then uses AI to generate consistent evaluations. The end result is a polished email report that reads like a strategist wrote it, not like a spreadsheet got forwarded.
What You’re Building
| What Gets Automated | What You’ll Achieve |
|---|---|
|
|
Expected Results
Say you review one competitor page each week and you typically collect 20 ads. Manually, you might spend about 3 minutes opening each ad, sorting image vs video, and saving references, which is roughly an hour already. Add another hour to remove duplicates, write notes, and format something presentable for email. With this workflow, the “pull + clean + analyze” happens automatically after form submission, and you’re mostly spending about 15 minutes scanning the report and adding your own POV before forwarding it.
Before You Start
- n8n instance (try n8n Cloud free)
- Self-hosting option if you prefer (Hostinger works well)
- Apify to scrape competitor Facebook ad data.
- Gmail to send the finished email report.
- OpenAI API key (get it from your OpenAI dashboard).
Skill level: Intermediate. You’ll be connecting credentials, adding API keys as environment variables, and adjusting prompts safely.
Want someone to build this for you? Talk to an automation expert (free 15-minute consultation).
Step by Step
A form submission kicks it off. Someone enters a Facebook Page URL and the email address that should receive the report. That Form Intake Trigger becomes your clean handoff point.
Ads get pulled and sorted. n8n calls Apify through HTTP Request (“Fetch Ad Library”), then splits results into image vs video (“Route Media Types”) so each one follows the right processing path.
Duplicates are removed and the list is capped. The workflow generates a unique key for each creative (Build Image Key / Build Video Key), prunes repeats, and limits the final batch to the top 5 images and top 5 videos. Frankly, this is where most manual workflows fall apart.
AI produces consistent creative insights, then Gmail delivers. Images are analyzed with OpenAI Vision, videos are fetched and analyzed with Gemini after a short wait, and the results are aggregated into a structured summary that’s emailed out via Gmail.
You can easily modify the prompts and scoring criteria to match your brand standards based on your needs. See the full implementation guide below for customization options.
Step-by-Step Implementation Guide
Step 1: Configure the Form Trigger
Start the workflow with a form submission that captures the ad library request details.
- Add the Form Intake Trigger node as the workflow trigger.
- Open Form Intake Trigger and configure the form fields you want to collect (e.g., ad library ID, brand name, campaign dates).
- Copy the generated form URL and test a sample submission to ensure the trigger fires.
Step 2: Connect Ad Library Retrieval and Routing
Fetch ad assets and route them into image or video processing paths.
- Connect Form Intake Trigger to Fetch Ad Library.
- Configure Fetch Ad Library with your ad library endpoint and required headers.
- Connect Fetch Ad Library to Route Media Types to split by asset type.
- Set rules in Route Media Types so image assets go to Build Image Key and video assets go to Build Video Key.
Credential Required: Connect your HTTP Request credentials in Fetch Ad Library if the ad library requires authentication.
Step 3: Set Up Image Processing and Analysis
Deduplicate, cap results, and analyze image creatives before mapping their fields.
- From Build Image Key, pass data to Prune Image Duplicates to remove repeats.
- Connect Prune Image Duplicates to Cap Image Results and limit the number of images processed.
- Connect Cap Image Results to Inspect Image Content for AI-based image analysis.
- Send the analysis output to Map Image Fields to normalize fields before merging.
Credential Required: Connect your OpenAI credentials in Inspect Image Content.
Step 4: Set Up Video Processing and Analysis
Retrieve, analyze, and normalize video creatives using Gemini review steps.
- From Build Video Key, pass data to Prune Video Duplicates.
- Connect Prune Video Duplicates to Cap Video Results to limit the number of videos processed.
- Send the output to Retrieve Video File, then to Send Video to Gemini.
- After Send Video to Gemini, insert Delay Processing, then connect to Review Video with Gemini.
- Map the reviewed output in Map Video Fields before merging.
Credential Required: Connect your HTTP Request credentials in Retrieve Video File, Send Video to Gemini, and Review Video with Gemini if these endpoints require authentication.
⚠️ Common Pitfall: If Gemini responses are delayed, increase the wait time in Delay Processing to avoid empty analysis results.
Step 5: Merge, Aggregate, and Summarize Ad Data
Combine image and video outputs, aggregate media data, and assemble a unified ad summary.
- Connect Map Image Fields and Map Video Fields into Combine Media Outputs.
- Send merged results to Aggregate Media Data.
- Connect Aggregate Media Data to Assemble Ad Summary to finalize the structured payload.
⚠️ Common Pitfall: The workflow uses multiple set nodes (e.g., Map Image Fields, Map Video Fields, Build Image Key, Build Video Key, Assemble Ad Summary). Ensure each mapping preserves any fields required downstream.
Step 6: Configure AI Insight Generation
Use the AI agent to generate insights and prepare the report content.
- Connect Assemble Ad Summary to Insight Agent.
- Ensure OpenAI Chat Engine is connected as the language model for Insight Agent.
- Keep Structured Parse and Auto-Correct Parser connected to Insight Agent for structured output handling.
Credential Required: Connect your OpenAI credentials in OpenAI Chat Engine. Auto-Correct Parser and Structured Parse are AI sub-nodes, so credentials must be added to OpenAI Chat Engine, not those sub-nodes.
Step 7: Configure the Email Report Output
Send the final AI-generated summary to stakeholders via email.
- Connect Insight Agent to Send Email Report.
- In Send Email Report, set the recipient address, subject, and message body using data from Insight Agent.
Credential Required: Connect your Gmail credentials in Send Email Report.
Step 8: Test and Activate Your Workflow
Validate end-to-end execution before turning on the workflow.
- Use Form Intake Trigger to submit a test request and run the workflow manually.
- Confirm that Inspect Image Content and Review Video with Gemini return analysis outputs, and that Assemble Ad Summary builds the final payload.
- Verify that Send Email Report sends the report successfully.
- Once confirmed, toggle the workflow to Active for production use.
Troubleshooting Tips
- Apify credentials can expire or lack access to the actor you’re using. If things break, check your Apify token and actor permissions in your Apify console first.
- If you’re using Wait nodes or external rendering, processing times vary. Bump up the wait duration if downstream nodes fail on empty responses.
- OpenAI (and Gemini) prompts that ship “generic” will give generic analysis. Add your brand voice and what you consider a “winning ad” early, or you will be editing outputs forever.
Quick Answers
About 10–15 minutes if your accounts and API keys are ready.
No. You’ll mainly connect services, paste API keys, and tweak prompts.
Yes. n8n has a free self-hosted option and a free trial on n8n Cloud. Cloud plans start at $20/month for higher volume. You’ll also need to factor in OpenAI API costs (often a few cents per report, depending on how many ads you analyze).
Two options: n8n Cloud (managed, easiest setup) or self-hosting on a VPS. For self-hosting, Hostinger VPS is affordable and handles n8n well. Self-hosting gives you unlimited executions but requires basic server management.
Yes, and you should. Most customizations are in the AI analysis steps (Inspect Image Content, Send Video to Gemini, and Review Video with Gemini) plus the final formatting step (Assemble Ad Summary). Common tweaks include changing what “good creative” means for your niche, adding extra fields from the Apify pull, and adjusting the cap from top 5/top 5 to something like top 3/top 3 for faster reads.
Usually it’s an expired or incorrect Apify API token. Update the credential in n8n and confirm the actor or endpoint you’re calling is accessible for that token. If it fails only sometimes, it can be rate limiting or temporary failures from the source, so add retries and consider a slightly longer Delay Processing wait for the video path.
Plenty for weekly competitor reviews.
Often, yes, because this workflow has branching (image vs video), deduplication, and multi-step AI processing that’s awkward and expensive in simpler tools. n8n also lets you self-host, which matters when you want unlimited runs or tighter control. Zapier or Make can still be fine for a lightweight “send me alerts” version, but they’re not as comfortable once you’re aggregating data and generating structured reports. If you’re sending these reports to clients, consistency matters, and n8n makes that easier to maintain. Talk to an automation expert if you want help choosing.
Once this is running, competitor creative research stops being a calendar burden and becomes a repeatable system. The workflow handles the repetitive stuff, so you can focus on decisions and testing.
Need Help Setting This Up?
Our automation experts can build and customize this workflow for your specific needs. Free 15-minute consultation—no commitment required.