Skip to main content

Send weekly Facebook and Instagram PDF performance reports with Gemini and Gmail

Workflow preview

Workflow preview
100%
Send weekly Facebook and Instagram PDF performance reports with Gemini and Gmail preview
Open on n8n.io

1. Workflow Overview

Quick Overview This workflow runs every Monday morning, pulls last week’s Facebook Page and Instagram Business metrics from the Meta Graph API, generates chart images, asks Google Gemini to write a...

Best for

  • Market Research automation workflows
  • AI Summarization automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.scheduletrigger, n8n-nodes-base.set, n8n-nodes-base.code, n8n-nodes-base.httprequest, @n8n/n8n-nodes-langchain.openai, @n8n/n8n-nodes-langchain.googlegemini, n8n-nodes-base.gmail, n8n-nodes-base.merge

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by SPCTEK AI.

Original n8n.io source

1.1 Workflow description

Title
Send weekly Facebook and Instagram PDF performance reports with Gemini and Gmail
Workflow name
Send weekly Facebook and Instagram PDF performance reports with Gemini and Gmail

Quick Overview

This workflow runs every Monday morning, pulls last week’s Facebook Page and Instagram Business metrics from the Meta Graph API, generates chart images, asks Google Gemini to write a narrative analysis, converts a branded HTML report to PDF via PDFShift, and emails it using Gmail.

How it works

  1. Runs on a weekly schedule (Mondays at 8:00) and sets the Facebook/Instagram IDs, access tokens, and report recipient email.
  2. Calculates the last full week date range (Monday–Sunday) and uses it to query the Meta Graph API.
  3. Fetches Facebook Page feed posts plus daily page views, post engagements, and organic media views, then aggregates totals and a structured post list.
  4. Fetches Instagram media posts and daily insights (reach, profile views, accounts engaged, interactions, and follows/unfollows) plus an organic views breakdown, then summarizes the week.
  5. Merges Facebook and Instagram results and generates chart image URLs using QuickChart for key daily metrics.
  6. Sends the combined stats to Google Gemini to produce a five-section weekly analysis, then builds a branded HTML report including charts, post previews, and next steps.
  7. Converts the HTML to a PDF with PDFShift and emails the PDF report to the configured recipient via Gmail.

Setup

  1. Create Meta Graph API access tokens and update the workflow with your Facebook Page ID, Instagram Business Account ID, a long-lived Meta access token, and a Facebook Page access token.
  2. Add your Google Gemini (PaLM) API credential and select an available model (the template uses gemini-3-flash-preview).
  3. Add a PDFShift HTTP Basic Auth credential (API key) for https://api.pdfshift.io/v3/convert/pdf.
  4. Connect a Gmail OAuth2 credential and confirm the recipient email address used for the report.
  5. Review the schedule trigger time zone and timing so it runs at your intended Monday 08:00 slot.

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Weekly Trigger

Type / Role
n8n-nodes-base.scheduleTrigger - scheduleTrigger
Config choices
Version 1.2

Block 2 - Config: Credentials & IDs

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 3 - Calculate Dates and Wrap Data

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 4 - Get Facebook Feed

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 5 - Get Facebook Page Insights

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 6 - Get Facebook Content Views

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 7 - Organize Facebook Data

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 8 - Get Instagram Activity

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 1

Block 9 - Views

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.3

Block 10 - Get Instagram Insights

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 11 - Get Instagram Follows and Unfollows

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 12 - Organize Instagram Data

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 13 - Merge All Data & Build Charts

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 14 - Prepare AI Prompt

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 15 - AI Analysis Agent

Type / Role
@n8n/n8n-nodes-langchain.openAi - openAi
Config choices
Version 1.7

Block 16 - Build HTML Report

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 17 - Convert HTML to PDF

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 18 - Message a model

Type / Role
@n8n/n8n-nodes-langchain.googleGemini - googleGemini
Config choices
Version 1.2

Block 19 - Send a message

Type / Role
n8n-nodes-base.gmail - gmail
Config choices
Version 2.2

Block 20 - Merge

Type / Role
n8n-nodes-base.merge - merge
Config choices
Version 3.2

Block 21 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 22 - Sticky Note1

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 23 - Sticky Note2

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 24 - Sticky Note3

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Showing the first 24 of 26 workflow blocks. Download the JSON for the full node graph.

3. Summary Table

Workflow Send weekly Facebook and Instagram PDF performance reports with Gemini and Gmail
Complexity advanced
Nodes 26
Categories Market Research, AI Summarization
Author SPCTEK AI
Published 09 Jun 2026

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/16217/16217.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Send weekly Facebook and Instagram PDF performance reports with Gemini and Gmail do?

Quick Overview This workflow runs every Monday morning, pulls last week’s Facebook Page and Instagram Business metrics from the Meta Graph API, generates chart images, asks Google Gemini to write a...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Market Research, AI Summarization use case.