Script Generator
Area: Marketing Workflow: workflows/marketing/script-generator.json
Purpose
Sección titulada «Purpose»Seed workflow for automated marketing script generation across paid and organic channels (Google Ads, GA4, Meta Ads, TikTok Ads, LinkedIn Ads).
The product idea is: pull recent performance per channel, let an LLM draft new ad copy and creative briefs respecting each channel’s limits, and drop the scripts in Google Sheets for human approval before optional push-back to the channel APIs.
This file currently contains only the GA4 discovery scaffold. Everything else is roadmap.
Pipeline (current — Stage 0)
Sección titulada «Pipeline (current — Stage 0)»Manual Trigger: Run Marketing Job → Google Analytics: Fetch GA4 Report (propertyId / metrics / dimensions still empty)
(disconnected)HTTP Request: List GA4 Account Summaries ──┐ (run standalone to discover propertyId) │ one-off discovery; not wired ──┘| Stage | Name | Status | Notes |
|---|---|---|---|
| 0 | GA4 Discovery | In progress | Manual GA4 report. Needs propertyId, metrics and dimensions configured. |
| 1 | Multi-Channel Performance Pull | Planned | GA4 + Google Ads + Meta + TikTok + LinkedIn, last-N-days. |
| 2 | Performance Analysis | Planned | Detect underperformers vs over-performers per channel. |
| 3 | LLM Script Generation | Planned | Per-channel copy + creative brief, honoring channel character / format limits. |
| 4 | Human Approval + Push-back | Planned | Sheets for review. Optional API push to each Ads platform after approval. |
Discovery node — HTTP Request: List GA4 Account Summaries
Sección titulada «Discovery node — HTTP Request: List GA4 Account Summaries»Calls GET https://analyticsadmin.googleapis.com/v1alpha/accountSummaries to list every GA4 account and property visible to the bound credential.
- Not connected to the live pipeline.
- Intent: run it standalone to find the
propertyIdyou wantGoogle Analytics: Fetch GA4 Reportto use, then disable or delete it. - Credential: uses a second
googleAnalyticsOAuth2(“Google Analytics account 2”) deliberately — multi-account exploration.
Credentials
Sección titulada «Credentials»| Credential type | Used by |
|---|---|
googleAnalyticsOAuth2 |
Google Analytics: Fetch GA4 Report (“Google Analytics account”). |
googleAnalyticsOAuth2 |
HTTP Request: List GA4 Account Summaries (“Google Analytics account 2”). |
commercial.
active: false.- Stage 0 scaffold only — the GA4 node has empty
propertyId,metricsGA4, anddimensionsGA4, so the first real run requires configuration in n8n.
Roadmap
Sección titulada «Roadmap»Stage 1 — Multi-Channel Performance Pull
Sección titulada «Stage 1 — Multi-Channel Performance Pull»Pull last-N-days performance for each channel into a normalized shape { channel, campaign, metric, value, period }.
| Channel | Source | n8n integration |
|---|---|---|
| GA4 | runReport |
Native Google Analytics node (today). |
| Google Ads | Google Ads Query Language via googleAds:search |
Native Google Ads node or HTTP Request. |
| Meta Ads | Marketing API /insights |
HTTP Request + facebookGraphApi cred. |
| TikTok Ads | Reporting /v1.3/reports/ |
HTTP Request + Bearer token credential. |
| LinkedIn Ads | Reporting /adAnalyticsV2 |
HTTP Request + linkedInOAuth2Api. |
Stage 2 — Performance Analysis
Sección titulada «Stage 2 — Performance Analysis»A Code node ranks campaigns per channel (z-score on CTR / CPA / ROAS) and flags underperformer / over-performer.
Stage 3 — LLM Script Generation
Sección titulada «Stage 3 — LLM Script Generation»Mirrors the publish-content per-platform adaptation pattern: one LLM call returning a single JSON with per-channel copy + creative brief that respects each channel’s character / format limits.
Suggested shape:
{ "google_ads": { "headlines": ["..."], "descriptions": ["..."], "rationale": "..." }, "meta_ads": { "primary_text": "...", "headline": "...", "description": "...", "rationale": "..." }, "tiktok_ads": { "hook": "...", "script": "...", "rationale": "..." }, "linkedin_ads": { "intro": "...", "headline": "...", "description": "...", "rationale": "..." }}Stage 4 — Human Approval + Push-back
Sección titulada «Stage 4 — Human Approval + Push-back»Append each generated script to a marketing_scripts tab keyed by script_id (ISO timestamp + channel). Status state machine: pending → approved → pushed / rejected. Optional push-back to each Ads API when status flips to approved.
Open questions
Sección titulada «Open questions»- Which channels are in scope first? GA4 is configured; Google Ads is the natural next step (same OAuth surface). Meta, TikTok and LinkedIn need their own credentials.
- Lookback window. Confirm “last-N-days” (7? 14? 28?) and whether it’s a per-channel setting.
- Script ownership. Are scripts per-client (multi-tenant on the n8n instance) or per-product? Decides whether
client_idis a column onmarketing_scripts. - Discovery node lifecycle. Once Stage 0 has a confirmed
propertyId, theHTTP Request: List GA4 Account Summariesnode should be deleted (or moved to a separate “Marketing — Setup” workflow).