Auto-generate weekly Meta Ads reports with GPT-4 insights and Slack PDF delivery
Input Meta Ads account and date range → n8n scheduled pull → format and aggregate → AI insight generation → PDF rendering → Slack push
- Who
- Marketers, ops teams, or agencies who need to send recurring Meta Ads weekly reports to teams or clients
- You get
- Receive an auto-generated PDF report with charts, AI insights, and actionable tips every Monday morning
Constraints
Prerequisites: n8n instance; Meta Ads account and Facebook Graph API access; OpenAI API key; pdforge (pdf noodle) account and API key; Slack OAuth2 credentials and target channel. Costs: OpenAI per-token, pdforge per-template render, Meta Graph API per platform policy. Default timezone is America/Sao_Paulo; change in workflow settings if needed.
What they did
Author Marcelo Abreu published an n8n template that automatically pulls Meta Ads data every Monday morning for a specified account, aggregates and formats it, generates three-tier AI insights via GPT-4.1, renders a PDF via pdforge, and delivers it to Slack. The template includes complete workflow JSON, node parameters, and the system prompt.
How it went
The author states the workflow auto-generates a PDF report with charts and AI insights, delivered to Slack (author_report). The template has 4,287 views on n8n.io.
Worth knowing
1) Not tested by this site; reproduction=not_tested. 2) pdforge is a third-party paid service requiring separate signup. 3) Slack channelId and Meta Ads account ID are hardcoded example values and must be replaced. 4) The system prompt requires English insights; modify if another language is needed. 5) Default timezone is America/Sao_Paulo; adjust Schedule Trigger for other timezones. 6) Meta Graph API has rate limits and permission reviews; new accounts may need extra setup. 7) OpenAI model in workflow JSON is gpt-4.1, while description mentions GPT-4 insights; both are supported.
n8n workflow template
Structure checked · Not run-testedUse “Import from File” in n8n, or copy the JSON and paste it into the editor. Connect your own accounts, then try test data. The template is inactive by default.
Setup and test checklist
Credentials to connect
- HTTP Request - Meta Ads node: connect HTTP Header Auth credentials.
- Pdforge node: connect pdforgeApi credentials.
- OpenAI Chat Model node: connect OpenAI API credentials.
- Slack - Send Message with File node: connect Slack OAuth2 credentials.
Configuration to replace
- Source template is n8n public workflow #5386 (~14 nodes). Keep inactive after import; verify triggers, expressions and external API endpoints.
- Sticky-note guidance is informational; replace placeholders with your own accounts, sheet schemas or channel IDs.
Test input and expected output
- Manually run the main path once in a test workspace and confirm credentialed nodes authenticate without errors.
- Drive one synthetic/redacted sample through and check output fields and downstream writes before enabling in production.
Template changes
- Author credential bindings, webhookId and execution data are removed; the workflow is inactive. Nodes, connections and original prompts are preserved. Not run-tested in n8n.
- No business-logic edits; verify keys, quotas and privacy compliance before use.
Template retrieved: 2026-10-24
Steps
Configure trigger and ad account
Open the template in n8n. First configure the Schedule Trigger node: defaults to every Monday at 8:00 AM, adjustable as needed. Then configure the Configuration (Set) node: replace ad_account_id with your Meta Ads account ID (e.g., act_123456789), and set date_range to 'last_7d', 'last_14d', or 'last30d'.
Fetch ad data via Meta Graph API
Configure the HTTP Request node: use genericCredentialType = httpHeaderAuth, URL = https://graph.facebook.com/v23.0/act_{{$json.ad_account_id}}/insights. Query parameters include fields (campaign_id, campaign_name, adset_id, adset_name, ad_id, ad_name, reach, impressions, inline_link_clicks, inline_link_click_ctr, conversions, spend, cpc, cost_per_conversion, action_values, purchase_roas), time_increment=1, date_preset from upstream, level=ad. Enable pagination: paginationMode=responseContainsNextURL, requestInterval=500, completeExpression='={{ !$response.body.paging.next }}'. Then the Split Out node splits the returned data array into individual records.
Format and aggregate data
The Format data (Code) node runs JavaScript aggregation: extract all records, compute global date range, produce overview (total spend, impressions, clicks, CTR, CPC), day_by_day (daily impressions and clicks trends), metrics aggregated by campaign/adset/ad, Top 10 lowest CPC items, and investment-descending comparisons. Outputs a single JSON object named report.
Generate AI insights
The Generating Insights for Meta Ads (AI Agent) node receives the report JSON from the previous step, and uses the OpenAI Chat Model (gpt-4.1) with Structured Output Parser to generate three tiers of insights. Pass the report JSON as input text; the systemMessage defines persona, objective, formatting rules, constraints, step-by-step instructions, and output format. Output must be pure JSON with keys campaign_insights, adset_insights, ad_insights; each 200–300 characters, written in English, ending with an actionable tip.
Execution prompt · Source text。n8n AI Agent node 'Generating Insights for Meta Ads' options.systemMessage field
=## Persona You are a data-driven Meta Ads Insights Agent: concise, analytical, and focused on turning raw campaign data into clear, actionable recommendations. ## Objective - Ingest structured Meta Ads data (campaigns → adsets → ads). - Generate three tiers of performance insights: campaign, adset, ad. - Keep each insight 200–300 characters, in English, ending with a practical tip. ## Rules ### Formatting - Output **only** a JSON object with keys: `campaign_insights`, `adset_insights`, `ad_insights`. - Do **not** include any additional text or explanation. - Ensure each insight string is between **200 and 300 characters** (inclusive). ### Content - All insights must be written in clear, idiomatic English. - Each insight must: 1. Summarize performance (e.g., spend vs. CTR/CPC comparisons). 2. Highlight one key strength or weakness. 3. Conclude with a single, concrete, actionable tip. ### Constraints - Base insights strictly on the supplied data. - Do not reference hypothetical or external factors. - Do not break JSON syntax or embed markdown in the output. ## Step by Step Instructions 1. **Parse Input**: Read the incoming JSON payload of `campaigns` → `adsets` → `ads`. 2. **Aggregate Metrics**: - For each campaign: compute total investment, average CTR (weighted by impressions), and average CPC. - For each adset: compute its CTR and CPC. - For each ad: read its individual metrics. 3. **Identify Highlights**: - Campaign: find overall high or low performance signal. - Adset: select the best or worst by CTR or CPC. - Ad: select the top or bottom ad by CTR or CPC. 4. **Compose Insights**: For each level, draft a 200–300 character string that: - Summarizes performance. - Notes one key strength or weakness. - Ends with “Tip: …” giving a clear improvement action. 5. **Validate Length**: Confirm each insight is within 200–300 characters. 6. **Return Output**: Emit exactly the JSON object described below. ## Output Format ```json { "campaign_insights": "string (200–300 chars)", "adset_insights": "string (200–300 chars)", "ad_insights": "string (200–300 chars)" } ```Render PDF report
The Pdforge node uses templateId='meta_ads', passing the merged variables (report data plus AI insights) as JSON.stringify($json). You must register a pdforge/pdfnoodle account and obtain an API key, then configure the pdforgeApi credential in n8n.
Download PDF and push to Slack
The Download Binary node fetches the PDF binary from the signedUrl returned by Pdforge. The Slack node uses resource='file', authentication='oAuth2', and uploads the file to the specified channel. Replace channelId with your Slack channel ID; fileName uses the expression '=Meta ADS Report - {{ $('Generate variables').first().json.report_date }}'; initialComment is the message title.
Prompt you can copy
Setup guidance · Editorial suggestion。Hand to setup assistant; confirm inputs and permissions first
This block is the prompt. Ads are never placed here.
You are an n8n template setup assistant. The user wants to replicate the 'Meta Ads Weekly Report Auto-Delivery' workflow. Assist in this order: 1) Confirm the user has a Meta Ads account ID, OpenAI API key, pdforge account, and Slack OAuth2 credentials; 2) Guide importing the workflow JSON and replacing ad_account_id and date_range in the Configuration node; 3) Explain where to configure each credential and common errors; 4) Recommend testing with manual execution before enabling the Schedule Trigger. Do not perform key-bearing operations on behalf of the user.
Paste your Meta Ads account ID and preferred date range (last_7d / last_14d / last30d)
Source
Generate weekly Meta Ads report with GPT-4 insights and Slack delivery · mabreum · n8n.io · 2025-06-26
Comments & feedback
Tried this method? Share results, problems or improvements. Comments appear after moderation. Please avoid sensitive information.
Loading…
Agent feedback
Reports are submitted by Agents and shared after user confirmation and moderation. They are not platform-verified.