Library / Content Writing & Generation
Content Writing & Generation
Predict SEO traffic impact scenarios with Postgres and OpenAI GPT-4.1
When an API call/webhook arrives, it writes content with OpenAI / ChatGPT using Postgres.
What it does
## 🔮 SEO What-If Simulator — n8n Backend API POST a *scenario* (merge pages / add new pages / remove pages) and get back a predicted traffic impact — before touching the live site. SEO DATA -> Current Website -> Simulation Engine |-> Merge Pages \ |-> New Pages >-> Predicted Impact |-> Remove Pages / ### How it works 1. Webhook receives POST /seo-what-if-simulate (header-auth protected) 2. Set - Config centralizes limits (max actions, max horizon, SERP-feature factor) 3. Code - Validate Request Schema — Zod-style validator; collects every violation, checks that a URL isn't merged/removed twice, returns a typed 400 4. Postgres - Fetch Current SEO Data loads the latest snapshot of per-page metrics 5. Code - Build Baseline Model builds the "current website" model: totals, clusters, existing cannibalization, CTR curve calibrated to the site's own CTR, and a site authority score. If no data exists -> typed 404 6. Three parallel simulation branches: Merge / New / Remove — each returns per-action deltas with an immediate part, a ramped part, uncertainty and risk flags 7. Merge - Simulation Results joins the three branches 8. Code - Predicted Impact builds the forecast: month-by-month timeline with low/expected/high band, per-action breakdown, risk score, verdict and confidence 9. LLM Chain - Strategy Narrative turns the numbers into an executive summary, recommendations, rollout order and watch-outs (uses ONLY the computed numbers) 10. Code - Validate Narrative — second independent validation boundary; falls back to a deterministic summary if the model output is malformed 11. Postgres - Log Simulation Run stores every run for audit / comparison, then Respond - Success (200) ### Request body json { "tenantId": "acme", "siteId": "acme-main", "scenarioName": "Q4 consolidation", "horizonMonths": 6, "actions": [ { "type": "merge", "targetUrl": "/blog/seo-guide", "sourceUrls": ["/blog/seo-tips", "/blog/seo-basics"], "redirect": true }, { "type": "new", "targetKeyword": "technical seo checklist", "searchVolume": 4400, "keywordDifficulty": 42, "contentQuality": 0.8, "clusterId": "seo" }, { "type": "remove", "url": "/blog/old-news", "strategy": "redirect", "redirectTo": "/blog" } ] }
The steps
- Webhook - SEO Simulation Request
- Set - Config
- Code - Validate Request Schema
- IF - Validation Passed
- Respond - Validation Error (400)
- Postgres - Fetch Current SEO Data
- Code - Build Baseline Model
- IF - Baseline Data Found
- Respond - No SEO Data (404)
- Code - Simulate Merge Pages
- Code - Simulate New Pages
- Code - Simulate Remove Pages
- Merge - Simulation Results
- Code - Predicted Impact
19 steps in total.
Similar automations
RAG & Knowledge BasesReport Weather Impact on Farms with Claude RAG10 stepsEmail AutomationPredict and route late payment reminders with Google Sheets, OpenAI, Gmail and Slack35 stepsContent Writing & GenerationTurn Ideas into Instagram Reel Scripts via Telegram with GPT-4o12 stepsCode, Git & Developer ToolsRoute API traffic with Stripe RBAC and Redis rate limiting17 steps