🔬 Send weekly Facebook Ads PDF reports with OpenAI, Orshot and Gmail

⚡ 0 views · 🔬 Document Extraction & Analysis

💡 Pro Tip — If you’ve run into Facebook’s Graph API permission restrictions, ScraperNode is a community node that scrapes pages, groups, posts, and comments directly — no app review needed.

View All Scrapers

Description

Quick overview

This workflow runs every Monday, pulls each active client’s weekly Meta Ads performance via the Facebook Graph API, uses OpenAI to write a short summary and next steps, renders a branded PDF report with Orshot, emails it via Gmail, and logs the outcome to Google Sheets.

How it works

  1. Runs every Monday at 8am.
  2. Reads a client list from Google Sheets and keeps only rows marked as active.
  3. Queries the Facebook Graph API (Meta Ads insights) for the last 7 days by campaign and the prior 7-day period at account level for comparison.
  4. Calculates key KPIs (spend, impressions, clicks, CTR, results, cost per result, and ROAS), skips clients with no spend, and prepares template variables for the report.
  5. Sends the KPI data to OpenAI to generate a short narrative summary and three concrete recommendations.
  6. Renders a two-page branded PDF in Orshot using the generated text and KPI/template variables, then downloads the PDF.
  7. Emails the PDF to each client via Gmail and appends a row to a Google Sheets report log with the PDF link, status, and any errors.

Setup

  1. Connect credentials for Google Sheets, Facebook Graph API (Meta Ads access token with ads_read), OpenAI, Orshot, and Gmail.
  2. Create a Google Sheets file with a Clients tab (Client name, Ad account ID, Email, Currency, Result type, Active) and a Reports tab, then select the correct document and sheet names in both Google Sheets steps.
  3. Add the report template to your Orshot workspace (See example template) and pick it in Render report PDF. You can change colors, fonts and add your logo in the Orshot editor.
  4. Update the agency name and footer text constants in the report-building code step to match your branding.
  5. Verify each client row has a valid ad account ID (with or without the act_ prefix), currency code, result type (e.g. purchase/lead/complete_registration), and recipient email address.

Requirements

Customization

Additional info

What the PDF looks like: sample report. How Orshot turns templates into PDFs from any app or API: PDF Generation API

🔗 Nodes Used

Google Sheets, HTTP Request, Facebook Graph API, Gmail, Schedule Trigger, Filter

📥 Import

Download workflow.json and import into n8n: Workflow menu → Import from File

📖 Importing guide · 🔑 Credential setup