📚 AI Automation Learning Series — Article #18 of 20 | Tools: n8n + Python + Airtable + Google Data Studio | Difficulty: Advanced | Read time: ~16 min
AI Data Pipeline with n8n + Python + Airtable: Build a Business Intelligence System That Updates Itself
Data is only valuable when it’s clean, current, and accessible. Most businesses drown in disconnected spreadsheets, outdated reports, and manual data exports. In Article #18 of our AI Automation Series, we’ll build a fully automated data pipeline that scrapes data from multiple sources, uses AI to clean and transform it, stores it in Airtable, and feeds a live Google Looker Studio dashboard — updated daily without any human intervention.
🌍 Real-World Scenario: SaaS Business Dashboard
A SaaS company’s CEO wants a single dashboard showing: MRR from Stripe, new signups from their app database, support ticket volume from Zendesk, ad spend from Google/Meta Ads, website traffic from Google Analytics, competitor pricing (scraped weekly), NPS scores from Typeform surveys, and team velocity from Linear. Currently, the ops manager spends 8 hours/week manually compiling this into a spreadsheet. We’ll automate all of it.
🏗️ Pipeline Architecture
- Data Extraction — n8n pulls from 8+ APIs daily at 6 AM
- Data Cleaning & Transformation — Python code nodes normalize formats, handle nulls, calculate derived metrics
- AI Enrichment — GPT-4 adds context, flags anomalies, generates insights
- Storage — Cleaned data loaded to Airtable (source of truth)
- Visualization — Google Looker Studio connects to Airtable for live dashboard
- Alerting — If metrics deviate from baseline by >10%, send Slack alert
⚙️ Step 1: Extract Data from Each Source
Stripe — Revenue Data
Add an HTTP Request node: GET https://api.stripe.com/v1/charges?created[gte]={{yesterday_timestamp}} with your Stripe API key. Extract: total charges, refunds, new subscriptions, churned subscriptions, MRR, ARR. Use a Code node to calculate these metrics from the raw Stripe response.
Google Analytics 4 — Traffic Data
Use the Google Analytics Data API via HTTP Request. Fetch: sessions, new users, bounce rate, top landing pages, conversion rate by traffic source. The GA4 API requires OAuth2 authentication — use n8n’s built-in Google OAuth2 credential.
Zendesk — Support Metrics
Use the Zendesk node in n8n. Fetch yesterday’s tickets: total volume, average first response time, CSAT scores, top issue categories. This helps correlate support load with product releases or marketing campaigns.
⚙️ Step 2: Python Data Transformation
Use n8n’s Code node (Python) to clean and normalize all data. Key transformations:
import json
from datetime import datetime
# Normalize all timestamps to UTC ISO 8601
def normalize_date(date_str):
if not date_str:
return None
try:
return datetime.fromisoformat(date_str.replace('Z', '+00:00')).isoformat()
except:
return date_str
# Calculate derived metrics
def calculate_metrics(stripe_data, ga_data):
return {
'date': datetime.utcnow().date().isoformat(),
'mrr': stripe_data.get('mrr', 0),
'new_customers': stripe_data.get('new_subscriptions', 0),
'churn_rate': round(stripe_data.get('churned', 0) / max(stripe_data.get('total_customers', 1), 1) * 100, 2),
'sessions': ga_data.get('sessions', 0),
'conversion_rate': round(stripe_data.get('new_subscriptions', 0) / max(ga_data.get('sessions', 1), 1) * 100, 4),
'ltv_estimate': stripe_data.get('mrr', 0) / max(stripe_data.get('new_subscriptions', 1), 1) * 24
}
result = calculate_metrics(items[0]['json']['stripe'], items[0]['json']['analytics'])
return [{'json': result}]
⚙️ Step 3: AI Anomaly Detection & Insights
Add an OpenAI node. Pass today’s metrics + the last 30 days of historical data (fetched from Airtable). Prompt: “You are a business analyst. Compare today’s metrics to the 30-day baseline. Flag any anomalies (>10% deviation). Identify the top 3 trends. Write a 3-sentence executive summary that a CEO would find valuable. Format: JSON {anomalies: [], trends: [], summary: string, health_score: 1-10}”.
⚙️ Step 4: Load to Airtable
Add an Airtable node → Create Record. Map all metrics to your Airtable base columns. Use a linked records setup in Airtable to connect: daily_metrics table → weekly_rollups table → monthly_summary table. Airtable’s formula fields automatically calculate week-over-week and month-over-month changes.
⚙️ Step 5: Google Looker Studio Dashboard
Connect Google Looker Studio (free) directly to your Airtable base using the Airtable connector. Build a dashboard with: MRR trend line, new vs. churned subscribers, traffic vs. conversions, support volume heat map, and the AI-generated daily insight. Share the dashboard URL with the leadership team — it updates automatically every morning.
🚀 What’s Next: Article #19
In Article #19, we cover selling automation as a service — how to package your n8n and Make.com skills into a profitable automation agency or freelance business, including pricing models, client acquisition, and recurring revenue strategies.