Client reporting was eating 5+ hours of my week. Every Monday: pull data from 4 platforms, compile into branded templates, write insights, send to clients. Repeat for each client.
Now it takes 12 minutes. Here's how I built it.
The Architecture
Google Analytics API ─┐
Social Media APIs ─┤
CRM (HubSpot) API ─┼─→ Data Aggregator ─→ Claude Analysis ─→ PDF Generator ─→ Auto-Email
Email Campaign Data ─┘
Step 1: Data Collection (Automated)
import requests
from google.analytics.data_v1beta import BetaAnalyticsDataClient
from datetime import datetime, timedelta
def collect_client_data(client_config):
data = {}
# Google Analytics
ga_client = BetaAnalyticsDataClient()
request = {
"property": f"properties/{client_config['ga_property']}",
"date_ranges": [{"start_date": "7daysAgo", "end_date": "today"}],
"metrics": [
{"name": "sessions"},
{"name": "conversions"},
{"name": "totalRevenue"}
]
}
data['analytics'] = ga_client.run_report(request)
# Social metrics (simplified)
for platform in client_config['social_platforms']:
data[platform] = fetch_social_metrics(platform, client_config)
# CRM data
data['crm'] = fetch_hubspot_deals(client_config['hubspot_id'])
return data
Step 2: AI Analysis
import anthropic
def generate_insights(data, client_context):
client = anthropic.Anthropic()
prompt = f"""Analyze this weekly performance data for {client_context['name']}:
{format_data(data)}
Previous week's data:
{format_data(client_context['last_week'])}
Generate:
1. Executive summary (3 sentences)
2. Top 3 wins this week
3. Top 3 areas needing attention
4. Specific recommendations (actionable)
5. Week-over-week trends
Tone: Professional, direct, data-driven.
Format: Markdown with tables where appropriate.
"""
response = client.messages.create(
model="claude-sonnet-4-20250514",
max_tokens=2000,
messages=[{"role": "user", "content": prompt}]
)
return response.content[0].text
Step 3: PDF Generation
I use reportlab to generate branded PDFs with the client's logo, colors, and formatting:
from reportlab.lib.pagesizes import letter
from reportlab.platypus import SimpleDocTemplate, Paragraph, Table
def generate_report_pdf(insights, data, client_config):
doc = SimpleDocTemplate(
f"reports/{client_config['name']}_weekly.pdf",
pagesize=letter
)
# Build the PDF with branded template
elements = build_branded_template(insights, data, client_config)
doc.build(elements)
Step 4: Auto-Email
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.application import MIMEApplication
def send_report(client_config, pdf_path):
msg = MIMEMultipart()
msg['Subject'] = f"Weekly Performance Report - {datetime.now().strftime('%B %d')}"
msg['From'] = "reports@yourdomain.com"
msg['To'] = client_config['email']
with open(pdf_path, 'rb') as f:
attachment = MIMEApplication(f.read(), _subtype='pdf')
attachment.add_header('Content-Disposition', 'attachment',
filename=f"weekly_report.pdf")
msg.attach(attachment)
# Send via SMTP
with smtplib.SMTP_SSL('smtp.gmail.com', 465) as server:
server.login(EMAIL, PASSWORD)
server.send_message(msg)
The Results
| Metric | Before | After |
|---|---|---|
| Time per report | 45 min | 2 min (automated) |
| Reports per week | 7 | 15 |
| Client satisfaction | Good | Excellent |
| Insights depth | Surface | Deep (AI catches patterns I missed) |
| Monthly time saved | 21 hrs | → 12 min total |
What Clients Say
The AI-generated insights actually caught things I was missing manually. Week-over-week trend analysis, anomaly detection, and cross-platform correlation are things that take humans hours but AI does in seconds.
Full implementation guide with all templates and code: AI Automation Playbook
What's your most time-consuming client deliverable? Drop a comment — I'll sketch an automation approach.
Top comments (0)