Gmail + Slack, AI social reports ready to share
You know the drill. X metrics in one tab, Facebook numbers in another, and then 30 minutes of copy-paste before you even start writing “insights.” It’s easy to miss a spike, grab the wrong date range, or ship a report that feels… fuzzy.
This hits social media managers hardest, but marketing leads and agency operators feel it too. With this Slack report automation, you get a consistent weekly report that’s actually ready to forward, without rebuilding it from scratch every time.
Below, you’ll see how the workflow pulls X and Facebook data, validates it, uses GPT-4o to write an HTML summary, and then delivers the finished report through Gmail and Slack.
How This Automation Works
The full n8n workflow, from trigger to final output:
n8n Workflow Template: Gmail + Slack, AI social reports ready to share
flowchart LR
subgraph sg0["When clicking ‘Execute workflow’ Flow"]
direction LR
n0@{ icon: "mdi:play-circle", form: "rounded", label: "When clicking ‘Execute workf..", pos: "b", h: 48 }
n1@{ icon: "mdi:brain", form: "rounded", label: "Configure GPT-4o Model", pos: "b", h: 48 }
n2@{ icon: "mdi:message-outline", form: "rounded", label: " Send Email Summary to Marke..", pos: "b", h: 48 }
n3["<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/>Fetch Recent Tweets"]
n4["<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/facebook.svg' width='40' height='40' /></div><br/> Fetch Recent Facebook Posts "]
n5["<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/code.svg' width='40' height='40' /></div><br/>Format Facebook Post Data"]
n6["<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/code.svg' width='40' height='40' /></div><br/>Format Twitter Post Data"]
n7["<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 Platform Datasets"]
n8@{ icon: "mdi:swap-horizontal", form: "rounded", label: " Validate API Response Integ..", pos: "b", h: 48 }
n9@{ icon: "mdi:database", form: "rounded", label: "Log Errors in Google Sheets", pos: "b", h: 48 }
n10["<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/code.svg' width='40' height='40' /></div><br/>Consolidate Social Data Summ.."]
n11@{ icon: "mdi:robot", form: "rounded", label: " Generate HTML Social Perfor..", pos: "b", h: 48 }
n3 --> n6
n1 -.-> n11
n7 --> n8
n6 --> n7
n5 --> n7
n4 --> n5
n8 --> n10
n8 --> n9
n10 --> n11
n0 --> n3
n0 --> n4
n11 --> n2
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 n0 trigger
class n11 ai
class n1 aiModel
class n8 decision
class n9 database
class n3,n4 api
class n5,n6,n10 code
classDef customIcon fill:none,stroke:none
class n3,n4,n5,n6,n7,n10 customIcon
The Problem: Weekly social reporting turns into busywork
Weekly reporting should be quick. In reality, it’s a mini project. You pull fresh X numbers, then Facebook Page metrics, then you try to line them up so they tell one story. And the moment anything changes (an API field name, a missing response, a new handle, a teammate asking for “just one more metric”), you’re back in spreadsheet cleanup mode. The worst part is the mental load: you spend your best attention formatting tables and rewriting the same takeaways, instead of noticing what actually changed this week.
The friction compounds. Here’s where it usually breaks down.
- You end up hunting through two dashboards and multiple exports just to get one “clean” snapshot.
- A missing field or empty API response can quietly corrupt the report unless you check everything line by line.
- Insights get rushed because formatting and screenshotting ate the hour you meant to spend analyzing.
- Reports vary week to week, so comparisons feel subjective instead of repeatable.
The Solution: An AI-generated X + Facebook report sent to Gmail and Slack
This n8n workflow replaces the weekly “numbers scramble” with a reliable pipeline. You start it manually (or schedule it later), and it fetches the latest metrics from X and Facebook using their APIs. Next, it normalizes both datasets with lightweight JavaScript so the numbers match a consistent structure every run. Before it generates anything, it validates the payload; if something is missing, it logs the problem to Google Sheets so you have a simple paper trail instead of a mystery failure. Then GPT-4o generates a clean HTML performance summary that reads like a real report. Finally, n8n delivers the HTML report via Gmail and posts a short highlights message to Slack to keep everyone aligned.
The workflow begins when you launch it in n8n. It pulls live X and Facebook metrics, merges and checks them, then uses GPT-4o to turn that cleaned data into a shareable HTML report. Gmail delivers the “full version,” Slack gets the key takeaways.
What You Get: Automation vs. Results
| What This Workflow Automates | Results You’ll Get |
|---|---|
|
|
Example: What This Looks Like
Say you publish a weekly update for two platforms (X and Facebook) and send it to two places (Gmail for the full report, Slack for the recap). Manually, you might spend about 30 minutes pulling X metrics, 30 minutes pulling Facebook metrics, and another 45 minutes turning it into something presentable, so roughly 2 hours per week. With this workflow, it’s more like 5 minutes to launch it (or zero if scheduled) and then you wait while it fetches data and generates the HTML. The output shows up ready to forward.
What You’ll Need
- n8n instance (try n8n Cloud free)
- Self-hosting option if you prefer (Hostinger works well)
- X (Twitter) API for pulling engagement and post metrics.
- Facebook Graph API to retrieve Page and post performance data.
- Azure OpenAI key (GPT-4o) (get it from the Azure OpenAI portal).
- Gmail to email the HTML report to recipients.
- Slack to post the summarized highlights to a channel.
- Google Sheets to log errors when validation fails.
Skill level: Intermediate. You’ll connect accounts, paste API keys, and lightly adjust a few mapping fields (handles, page IDs, and prompt tone).
Don’t want to set this up yourself? Talk to an automation expert (free 15-minute consultation).
How It Works
Manual launch (or schedule later). You run the workflow in n8n to kick off a weekly reporting cycle. Many teams keep it manual at first while they confirm the numbers match their dashboards.
Data collection from X and Facebook. n8n calls the X API and the Facebook Graph API to retrieve the latest performance data. Two normalization steps (JavaScript code nodes) reshape each response into consistent fields so comparisons don’t get weird.
Validation and cleanup. The workflow merges both streams, checks that required fields exist, and routes failures to a Google Sheets error log. Frankly, this is what makes the automation trustworthy over time.
AI report + delivery. GPT-4o generates a visual HTML performance summary, then n8n emails the full report via Gmail and posts a short, high-signal recap to Slack.
You can easily modify the report tone and the exact metrics included to match your stakeholders. See the full implementation guide below for customization options.
Step-by-Step Implementation Guide
Step 1: Configure the Manual Trigger
Set up the workflow trigger that kicks off the data collection from Twitter and Facebook.
- Add the Manual Launch Trigger node as your workflow trigger.
- Confirm that Manual Launch Trigger has no parameters to configure.
- Connect Manual Launch Trigger to both Retrieve Latest Tweets and Retrieve Latest Facebook Posts.
- Note that Manual Launch Trigger outputs to both Retrieve Latest Tweets and Retrieve Latest Facebook Posts in parallel.
Step 2: Connect Twitter and Facebook Data Sources
Configure the platform connectors to pull the latest posts from each social network.
- Open Retrieve Latest Tweets and set URL to
https://api.x.com/2/users/[YOUR_ID]/tweets?max_results=20&tweet.fields=created_at,public_metrics,attachments,entities,source&expansions=attachments.media_keys&media.fields=media_key,type,url,preview_image_url. - Set Authentication to
predefinedCredentialTypeand Credential Type totwitterOAuth2Api. - Credential Required: Connect your
twitterOAuth2Apicredentials in Retrieve Latest Tweets. - Open Retrieve Latest Facebook Posts, set Edge to
posts, Node to[YOUR_ID], and Graph API Version tov23.0. - Credential Required: Connect your
facebookGraphApicredentials in Retrieve Latest Facebook Posts.
[YOUR_ID] in both Twitter and Facebook nodes with your actual account or page ID to avoid empty results.Step 3: Normalize and Merge Platform Records
Clean and standardize platform data so it can be merged and validated downstream.
- In Normalize Twitter Records, keep the JavaScript code as provided to map tweets into a normalized structure.
- In Normalize Facebook Records, keep the JavaScript code as provided to map Facebook posts into a normalized structure.
- Connect Normalize Twitter Records and Normalize Facebook Records into Combine Platform Streams (Twitter to input 0, Facebook to input 1).
- Verify Combine Platform Streams connects to Validate Response Payloads for quality checks.
Step 4: Validate Records and Aggregate Summary
Route valid items forward and log errors to a Google Sheet for tracking.
- In Validate Response Payloads, ensure the condition checks leftValue with
{{ $json.id }}using the notEmpty operator. - Connect the true output of Validate Response Payloads to Aggregate Social Summary.
- Connect the false output of Validate Response Payloads to Append Errors to Sheets for error logging.
- In Aggregate Social Summary, keep the JavaScript code as provided to build a single combined JSON payload with
summary,twitter_data, andfacebook_data.
{{ $json.id }} is missing due to API errors, all items will be routed to Append Errors to Sheets and no report will be created.Step 5: Configure Error Logging to Google Sheets
Capture invalid items in a Google Sheet to help with debugging and monitoring.
- Open Append Errors to Sheets and set Operation to
append. - Set Document to
[YOUR_ID]and Sheet Name to[YOUR_ID](as listed under the sheet selector). - Confirm the columns include error_id and error in the schema mapping.
- Credential Required: Connect your
googleSheetsOAuth2Apicredentials in Append Errors to Sheets.
Step 6: Set Up AI Report Generation
Use Azure OpenAI to generate the HTML performance report based on the aggregated data.
- In Azure GPT Model Setup, set Model to
gpt-4o. - Credential Required: Connect your
azureOpenAiApicredentials in Azure GPT Model Setup. - Open Create HTML Performance Report and set Text to the provided prompt that includes
{{JSON.stringify($json)}}. - Ensure Azure GPT Model Setup is connected as the language model for Create HTML Performance Report (credentials must be added to Azure GPT Model Setup, not the agent node).
max_results=20 in Retrieve Latest Tweets.Step 7: Configure Email Delivery
Send the generated HTML report to your inbox.
- Open Dispatch Email Report and set To to
=[YOUR_EMAIL]. - Set Subject to
=📊 Weekly Social Media Performance Report — Twitter & Facebook Overview. - Set Message to
{{ $json.output }}to send the AI-generated HTML. - Credential Required: Connect your
gmailOAuth2credentials in Dispatch Email Report.
Step 8: Test and Activate Your Workflow
Run a manual test to confirm data collection, report generation, and email delivery.
- Click Execute Workflow and trigger Manual Launch Trigger to start the workflow.
- Verify that Retrieve Latest Tweets and Retrieve Latest Facebook Posts both execute successfully in parallel.
- Confirm Create HTML Performance Report outputs HTML and Dispatch Email Report sends the email to
[YOUR_EMAIL]. - Check the Google Sheet defined in Append Errors to Sheets if any items fail validation.
- Once verified, toggle the workflow to Active to use it in production.
Common Gotchas
- X (Twitter) API credentials can expire or lack the right access tier. If things break, check your developer portal permissions and token status first.
- If you’re using Wait nodes or external processing, timings vary. Bump up the wait duration if downstream nodes fail on empty responses.
- Default prompts in AI nodes are generic. Add your brand voice early or you’ll be editing outputs forever.
Frequently Asked Questions
About an hour if your API keys and accounts are ready.
No. You’ll mostly connect accounts and paste credentials. You might tweak a JavaScript mapping block if your API fields differ.
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 Azure OpenAI usage costs, which vary based on how long your report prompt and HTML output are.
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, but you’ll swap the output step. Keep the same data pull, normalization, merge, and validation, then replace the “Create HTML Performance Report” AI agent output with a Google Docs creation step or a PDF generator. Common customizations include changing the GPT prompt tone, adding extra metrics (like clicks or video views), and sending different Slack messages for different channels.
Usually it’s OAuth permissions or an expired token. Reconnect your Gmail credential in n8n and confirm the account is allowed to send as the From address you set in the “Dispatch Email Report” node. Also check that your recipient list environment variable (like GMAIL_MARKETING_RECIPIENTS) is populated, because an empty “To” field can look like a connection issue.
A typical setup can comfortably handle a weekly report per brand (and several brands) as long as your APIs allow it and your n8n plan has enough executions.
Often, yes. This workflow leans on validation, merging streams, and code-based normalization, and that’s where n8n tends to feel more flexible (and less “pay per step”). Zapier or Make can still work if you only need a simple pull-and-send, but adding guardrails and an HTML report generator usually gets clunky. Another practical point: self-hosting n8n removes execution caps, which matters when you scale reporting across clients. If you’re unsure, Talk to an automation expert and you’ll get a straight recommendation based on volume and complexity.
Once this is running, weekly reporting becomes a button (or a schedule), not a recurring headache. The workflow handles the repeatable parts so you can spend your time on decisions.
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.