Ir al contenido

Script Generator

Area: Marketing Workflow: workflows/marketing/script-generator.json

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.

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 propertyId you want Google Analytics: Fetch GA4 Report to use, then disable or delete it.
  • Credential: uses a second googleAnalyticsOAuth2 (“Google Analytics account 2”) deliberately — multi-account exploration.
Credential type Used by
googleAnalyticsOAuth2 Google Analytics: Fetch GA4 Report (“Google Analytics account”).
googleAnalyticsOAuth2 HTTP Request: List GA4 Account Summaries (“Google Analytics account 2”).

See credentials/README.md.

commercial.

  • active: false.
  • Stage 0 scaffold only — the GA4 node has empty propertyId, metricsGA4, and dimensionsGA4, so the first real run requires configuration in n8n.

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.

A Code node ranks campaigns per channel (z-score on CTR / CPA / ROAS) and flags underperformer / over-performer.

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": "..." }
}

Append each generated script to a marketing_scripts tab keyed by script_id (ISO timestamp + channel). Status state machine: pendingapprovedpushed / rejected. Optional push-back to each Ads API when status flips to approved.

  • 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_id is a column on marketing_scripts.
  • Discovery node lifecycle. Once Stage 0 has a confirmed propertyId, the HTTP Request: List GA4 Account Summaries node should be deleted (or moved to a separate “Marketing — Setup” workflow).