{
  "id": "hPyvVcjqZq43Pc2C",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Score content virality with AI before publishing and notify team via Slack",
  "tags": [],
  "nodes": [
    {
      "id": "62870687-589e-41c1-a3bf-2a965c2210d2",
      "name": "Sticky Note - Overview",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -480,
        -304
      ],
      "parameters": {
        "width": 980,
        "height": 960,
        "content": "## Score content virality with AI before publishing and notify team via Slack\n\nThis workflow scores content (0\u2013100) for virality potential before publishing, using historical performance patterns, real-time trend signals, and AI analysis.\n\n### Who's it for\n\u2022 Social media managers publishing 5+ pieces/week\n\u2022 Content marketing teams wanting data-driven decisions\n\u2022 Creators optimizing for reach and engagement\n\n### How it works\n1. Accepts new content via webhook or manual trigger\n2. Validates the content input\n3. Fetches historical post performance data\n4. Retrieves current trending topics & audience signals\n5. AI analyses trend alignment & predicts engagement\n6. Calculates a weighted virality score (0\u2013100)\n7. Routes content based on score tier\n8. Sends recommendations and logs to Google Sheets\n\n### Score Tiers\n\u2022 75\u2013100 \u2192 \ud83d\udfe2 HIGH VIRALITY \u2014 Publish immediately\n\u2022 40\u201374  \u2192 \ud83d\udfe1 MODERATE \u2014 Optional tweaks suggested\n\u2022 0\u201339   \u2192 \ud83d\udd34 LOW \u2014 Revision recommendations sent\n\n### Requirements\n\u2022 Webhook or schedule trigger\n\u2022 Google Sheets (historical data + log)\n\u2022 OpenAI / Anthropic API key\n\u2022 Trends data source (e.g., SerpAPI, Exploding Topics)\n\u2022 Notification service (Slack / SendGrid / Email)\n\n### Setup Steps\n1. Import this workflow\n2. Configure credentials for OpenAI, Google Sheets, and your trends API\n3. Populate your Google Sheet with past post performance data\n4. Set your platform, niche, and audience profile in the 'Config' node\n5. Activate"
      },
      "typeVersion": 1
    },
    {
      "id": "d0574e4f-5758-497f-88fd-9722f43f5b43",
      "name": "Sticky Note - Phase 1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        624,
        -64
      ],
      "parameters": {
        "color": 4,
        "width": 780,
        "height": 520,
        "content": "## Phase 1: Trigger & Validate"
      },
      "typeVersion": 1
    },
    {
      "id": "1135d38f-1fa1-4e69-ab76-3746c6c0e25e",
      "name": "Sticky Note - Phase 2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1440,
        -144
      ],
      "parameters": {
        "color": 3,
        "width": 1028,
        "height": 816,
        "content": "## Phase 2: Data Collection"
      },
      "typeVersion": 1
    },
    {
      "id": "511e0f12-3272-4982-bbac-4059718dbc58",
      "name": "Sticky Note - Phase 3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2512,
        -144
      ],
      "parameters": {
        "color": 5,
        "width": 1012,
        "height": 928,
        "content": "## Phase 3: AI Scoring"
      },
      "typeVersion": 1
    },
    {
      "id": "be03d301-2631-41b1-a5fe-e93ea0460dcf",
      "name": "Sticky Note - Phase 4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3696,
        16
      ],
      "parameters": {
        "color": 6,
        "width": 508,
        "height": 476,
        "content": "## Phase 4: Route & Act"
      },
      "typeVersion": 1
    },
    {
      "id": "ffce1f14-ad12-47a6-885f-d00caa4fe351",
      "name": "Webhook - Content Submitted",
      "type": "n8n-nodes-base.webhook",
      "notes": "Receives new content payload. Expected fields: title, body, platform, content_type, target_audience, proposed_publish_time, media_urls (optional).",
      "position": [
        784,
        80
      ],
      "parameters": {
        "path": "virality-check",
        "options": {},
        "httpMethod": "POST",
        "responseMode": "responseNode"
      },
      "typeVersion": 1.1
    },
    {
      "id": "408b4c0c-66ba-43fc-a231-4a73e7c286cf",
      "name": "Schedule - Daily Content Queue",
      "type": "n8n-nodes-base.scheduleTrigger",
      "notes": "Alternative trigger: polls a content queue spreadsheet every weekday at 9am.",
      "position": [
        784,
        288
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "cronExpression",
              "expression": "0 9 * * 1-5"
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "d78d787d-85ee-43f0-8f35-b50bcc1538d6",
      "name": "Normalize Content Input",
      "type": "n8n-nodes-base.set",
      "notes": "Standardizes fields from both the webhook and schedule trigger into a single schema.",
      "position": [
        1024,
        176
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "name": "title",
              "type": "string",
              "value": "={{ $json.title || $json.body?.title || '' }}"
            },
            {
              "name": "body",
              "type": "string",
              "value": "={{ $json.body_text || $json.body?.body_text || $json.content || '' }}"
            },
            {
              "name": "platform",
              "type": "string",
              "value": "={{ $json.platform || $json.body?.platform || 'twitter' }}"
            },
            {
              "name": "content_type",
              "type": "string",
              "value": "={{ $json.content_type || $json.body?.content_type || 'text' }}"
            },
            {
              "name": "target_audience",
              "type": "string",
              "value": "={{ $json.target_audience || $json.body?.target_audience || 'general' }}"
            },
            {
              "name": "proposed_publish_time",
              "type": "string",
              "value": "={{ $json.proposed_publish_time || new Date().toISOString() }}"
            },
            {
              "name": "media_urls",
              "type": "array",
              "value": "={{ $json.media_urls || [] }}"
            },
            {
              "name": "submission_id",
              "type": "string",
              "value": "={{ $json.submission_id || 'sub_' + Date.now() }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "7d13bb1f-373f-412b-950d-b5f0348bfa69",
      "name": "Python - Validate Content Input",
      "type": "n8n-nodes-base.code",
      "notes": "Validates required fields, checks minimum content length, detects empty/null inputs. Sets is_valid flag and validation_errors list.",
      "position": [
        1248,
        176
      ],
      "parameters": {
        "mode": "runOnceForEachItem",
        "language": "python"
      },
      "typeVersion": 2
    },
    {
      "id": "c5514fd0-3246-4647-a388-0efc04b1a124",
      "name": "Filter - Valid Content Only",
      "type": "n8n-nodes-base.filter",
      "notes": "Drops invalid submissions. Invalid items can be routed to an error notification branch.",
      "position": [
        1472,
        176
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "conditions": [
            {
              "operator": {
                "type": "boolean",
                "operation": "true"
              },
              "leftValue": "={{ $json.is_valid }}"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "f4d291ff-5c41-474c-a4d6-d30ab5780a80",
      "name": "Load Platform Config",
      "type": "n8n-nodes-base.set",
      "notes": "Loads platform-specific benchmarks and scoring weight configuration. Customize weights here to match your niche.",
      "position": [
        1680,
        176
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "name": "platform_config",
              "type": "object",
              "value": "={{ { 'twitter': { 'optimal_length': 240, 'best_hours': [9,12,17], 'engagement_weight': 0.4 }, 'instagram': { 'optimal_length': 300, 'best_hours': [8,11,19], 'engagement_weight': 0.45 }, 'linkedin': { 'optimal_length': 600, 'best_hours': [8,10,17], 'engagement_weight': 0.35 }, 'facebook': { 'optimal_length': 400, 'best_hours': [13,15,20], 'engagement_weight': 0.3 }, 'tiktok': { 'optimal_length': 150, 'best_hours': [7,11,19], 'engagement_weight': 0.5 }, 'youtube': { 'optimal_length': 500, 'best_hours': [15,17,20], 'engagement_weight': 0.45 }, 'blog': { 'optimal_length': 1500, 'best_hours': [9,10,11], 'engagement_weight': 0.25 } }[$json.platform.toLowerCase()] }}"
            },
            {
              "name": "scoring_weights",
              "type": "object",
              "value": "={{ { 'trend_alignment': 0.30, 'engagement_prediction': 0.25, 'timing_score': 0.20, 'historical_similarity': 0.15, 'media_bonus': 0.10 } }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "03b8acbd-f588-42ca-b729-37bc5dde5c3a",
      "name": "Fetch Historical Performance Data",
      "type": "n8n-nodes-base.httpRequest",
      "notes": "Fetches past post data from Google Sheets. Columns: date, title, platform, content_type, views, likes, shares, comments, saves, engagement_rate. Replace YOUR_SHEET_ID and YOUR_API_KEY.",
      "position": [
        1872,
        -32
      ],
      "parameters": {
        "url": "=https://sheets.googleapis.com/v4/spreadsheets/YOUR_SHEET_ID/values/HistoricalData!A1:J200?key=YOUR_API_KEY",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "1adcceab-cc70-4eb5-87b3-e9f9bbee848e",
      "name": "Fetch Trending Topics & Signals",
      "type": "n8n-nodes-base.httpRequest",
      "notes": "Calls SerpAPI Google Trends to get current trend index for the content topic. Replace YOUR_SERPAPI_KEY. Alternative: use Exploding Topics API or Brandwatch.",
      "position": [
        1872,
        176
      ],
      "parameters": {
        "url": "=https://api.serpapi.com/search.json?engine=google_trends&q={{ encodeURIComponent($json.title) }}&date=now+7-d&api_key=YOUR_SERPAPI_KEY",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "84d33db1-7b7c-4e30-813f-af86b08667f6",
      "name": "Fetch Audience Behavior Signals",
      "type": "n8n-nodes-base.httpRequest",
      "notes": "Fetches last 7 days of audience activity: peak active hours, top content formats, sentiment index, avg session time. Replace with your analytics platform (GA4, Sprout Social, Hootsuite Insights, etc.).",
      "position": [
        1872,
        400
      ],
      "parameters": {
        "url": "=https://api.your-analytics-platform.com/v1/audience-signals?platform={{ $json.platform }}&period=7d",
        "options": {},
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer YOUR_ANALYTICS_API_TOKEN"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "890111be-1566-4608-92b5-9359bbcbaaca",
      "name": "Python - Merge & Normalize Signals",
      "type": "n8n-nodes-base.code",
      "notes": "Merges historical data, trends, and audience signals into a unified context object. Handles missing data gracefully by substituting safe defaults.",
      "position": [
        2080,
        176
      ],
      "parameters": {
        "mode": "runOnceForEachItem",
        "language": "python"
      },
      "typeVersion": 2
    },
    {
      "id": "86a5149f-5b47-4fbe-9c31-87564b28124c",
      "name": "Wait - Rate Limit Buffer",
      "type": "n8n-nodes-base.wait",
      "notes": "1-second pause to respect API rate limits before the AI analysis call.",
      "position": [
        2320,
        176
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "0cb7d7ce-0be2-4b13-9937-89dcfcbe9c57",
      "name": "AI - Virality Score & Analysis",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "notes": "Core AI node. Sends all collected signals to the LLM and returns a structured virality prediction JSON.",
      "position": [
        2560,
        176
      ],
      "parameters": {
        "text": "=You are an expert social media strategist and data analyst specializing in viral content prediction.\n\nAnalyze the following content submission and data signals, then return a structured JSON virality assessment.\n\n---\nCONTENT SUBMISSION:\nTitle: {{ $json.title }}\nBody: {{ $json.body }}\nPlatform: {{ $json.platform }}\nContent Type: {{ $json.content_type }}\nTarget Audience: {{ $json.target_audience }}\nHas Media: {{ $json.has_media }}\nWord Count: {{ $json.word_count }}\nProposed Publish Time: {{ $json.proposed_publish_time }}\n\n---\nHISTORICAL CONTEXT:\nTotal past posts analysed: {{ $json.historical_posts_count }}\nAverage engagement rate: {{ $json.avg_historical_engagement }}\nTop performing posts (sample): {{ JSON.stringify($json.top_posts.slice(0,3)) }}\n\n---\nCURRENT SIGNALS:\nTrend Index (0\u2013100, higher=more trending): {{ $json.trend_index }}\nAudience Peak Hours: {{ JSON.stringify($json.peak_hours) }}\nAudience Sentiment Index (0\u20131): {{ $json.sentiment_index }}\nTop Performing Formats Right Now: {{ JSON.stringify($json.top_formats) }}\n\n---\nPLATFORM CONFIG:\n{{ JSON.stringify($json.platform_config) }}\n\nSCORING WEIGHTS:\n{{ JSON.stringify($json.scoring_weights) }}\n\n---\nReturn ONLY a valid JSON object (no markdown, no explanation outside the JSON) with this exact structure:\n{\n  \"virality_score\": <integer 0-100>,\n  \"score_tier\": <\"HIGH\" | \"MODERATE\" | \"LOW\">,\n  \"component_scores\": {\n    \"trend_alignment\": <0-100>,\n    \"engagement_prediction\": <0-100>,\n    \"timing_score\": <0-100>,\n    \"historical_similarity\": <0-100>,\n    \"media_bonus\": <0-100>\n  },\n  \"key_drivers\": [<list of 3-5 top factors driving the score, strings>],\n  \"pattern_matches\": [<list of 2-3 historical patterns this content matches, strings>],\n  \"weaknesses\": [<list of 1-3 things lowering the score, strings>],\n  \"recommendations\": [<list of 2-4 specific actionable improvements, strings>],\n  \"best_publish_time\": <ISO 8601 datetime string for optimal posting>,\n  \"predicted_engagement_range\": { \"low\": <float>, \"high\": <float> },\n  \"confidence\": <\"HIGH\" | \"MEDIUM\" | \"LOW\">\n}",
        "options": {},
        "promptType": "define"
      },
      "typeVersion": 1.6
    },
    {
      "id": "7200c681-b4a8-4375-88b7-e7118efad661",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "notes": "Using GPT-4.1-mini for cost efficiency. Swap to gpt-4o for highest accuracy.",
      "position": [
        2624,
        432
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "options": {},
        "builtInTools": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "9d4f2b02-3d10-45d4-973b-b1572f3884d3",
      "name": "JS - Parse & Enrich Score",
      "type": "n8n-nodes-base.code",
      "notes": "Parses AI JSON response safely. Applies fallback defaults if parsing fails. Enforces score_tier boundaries.",
      "position": [
        3072,
        176
      ],
      "parameters": {
        "mode": "runOnceForEachItem",
        "jsCode": "const item = $input.item.json;\nlet parsed = {};\n\ntry {\n  const raw = item.output || item.response || item.text || '{}';\n  const cleaned = raw.replace(/```json|```/g, '').trim();\n  parsed = JSON.parse(cleaned);\n} catch (e) {\n  // Fallback defaults if AI response parse fails\n  parsed = {\n    virality_score: 50,\n    score_tier: 'MODERATE',\n    component_scores: { trend_alignment: 50, engagement_prediction: 50, timing_score: 50, historical_similarity: 50, media_bonus: 50 },\n    key_drivers: ['Unable to parse AI response \u2014 using defaults'],\n    pattern_matches: [],\n    weaknesses: ['AI response parse error'],\n    recommendations: ['Re-run analysis or check AI node output'],\n    best_publish_time: new Date().toISOString(),\n    predicted_engagement_range: { low: 0.01, high: 0.03 },\n    confidence: 'LOW'\n  };\n}\n\nconst score = parsed.virality_score ?? 50;\nconst tier = score >= 75 ? 'HIGH' : score >= 40 ? 'MODERATE' : 'LOW';\n\nreturn {\n  json: {\n    ...item,\n    ...parsed,\n    virality_score: score,\n    score_tier: tier,\n    analysis_timestamp: new Date().toISOString(),\n    scored_submission_id: item.submission_id\n  }\n};"
      },
      "typeVersion": 2
    },
    {
      "id": "c36836f3-ea6b-4165-aa05-b22d8473c634",
      "name": "Slack - Notify High Virality",
      "type": "n8n-nodes-base.httpRequest",
      "notes": "Sends an urgent Slack alert for high-virality content. Replace YOUR_SLACK_WEBHOOK_PATH.",
      "position": [
        3328,
        48
      ],
      "parameters": {
        "url": "https://hooks.slack.com/services/YOUR_SLACK_WEBHOOK_PATH",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"text\": \"\ud83d\udfe2 *HIGH VIRALITY CONTENT DETECTED* \u2014 Score: {{ $json.virality_score }}/100\",\n  \"blocks\": [\n    {\n      \"type\": \"section\",\n      \"text\": {\n        \"type\": \"mrkdwn\",\n        \"text\": \"\ud83d\udfe2 *HIGH VIRALITY* \u2014 Score: *{{ $json.virality_score }}/100*\\n*Title:* {{ $json.title }}\\n*Platform:* {{ $json.platform }}\\n*Best Publish Time:* {{ $json.best_publish_time }}\\n\\n*Key Drivers:*\\n{{ $json.key_drivers.map(d => '\u2022 ' + d).join('\\n') }}\"\n      }\n    }\n  ]\n}",
        "sendBody": true,
        "specifyBody": "json"
      },
      "typeVersion": 4.2
    },
    {
      "id": "f1b1a276-9297-43f6-92ff-e6cdbf6a5c21",
      "name": "Slack - Notify Moderate Virality",
      "type": "n8n-nodes-base.httpRequest",
      "notes": "Sends a moderate-priority Slack notice with optional improvement tips.",
      "position": [
        3344,
        224
      ],
      "parameters": {
        "url": "https://hooks.slack.com/services/YOUR_SLACK_WEBHOOK_PATH",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"text\": \"\ud83d\udfe1 *Moderate Virality Content* \u2014 Score: {{ $json.virality_score }}/100\",\n  \"blocks\": [\n    {\n      \"type\": \"section\",\n      \"text\": {\n        \"type\": \"mrkdwn\",\n        \"text\": \"\ud83d\udfe1 *Moderate Virality* \u2014 Score: *{{ $json.virality_score }}/100*\\n*Title:* {{ $json.title }}\\n*Platform:* {{ $json.platform }}\\n\\n*Optional improvements:*\\n{{ $json.recommendations.slice(0,2).map(r => '\u2022 ' + r).join('\\n') }}\"\n      }\n    }\n  ]\n}",
        "sendBody": true,
        "specifyBody": "json"
      },
      "typeVersion": 4.2
    },
    {
      "id": "b5466ac8-2240-4411-a741-893ae1e20fc4",
      "name": "Email - Low Virality Revision Alert",
      "type": "n8n-nodes-base.httpRequest",
      "notes": "Sends a detailed revision email for low-virality content. Update recipient email and SendGrid API credentials.",
      "position": [
        3344,
        448
      ],
      "parameters": {
        "url": "https://api.sendgrid.com/v3/mail/send",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"personalizations\": [{\"to\": [{\"email\": \"content-team@yourcompany.com\"}]}],\n  \"from\": {\"email\": \"virality-bot@yourcompany.com\", \"name\": \"Virality Predictor\"},\n  \"subject\": \"\ud83d\udd34 Low Virality Alert \u2014 Revision Needed: {{ $json.title }}\",\n  \"content\": [{\n    \"type\": \"text/html\",\n    \"value\": \"<h2>Low Virality Score: {{ $json.virality_score }}/100</h2><p><strong>Title:</strong> {{ $json.title }}</p><p><strong>Platform:</strong> {{ $json.platform }}</p><h3>Weaknesses Identified:</h3><ul>{{ $json.weaknesses.map(w => '<li>' + w + '</li>').join('') }}</ul><h3>Recommended Improvements:</h3><ul>{{ $json.recommendations.map(r => '<li>' + r + '</li>').join('') }}</ul>\"\n  }]\n}",
        "sendBody": true,
        "specifyBody": "json"
      },
      "typeVersion": 4.2
    },
    {
      "id": "56ab4313-d63f-4731-8191-38c525ae9923",
      "name": "Log to Google Sheets",
      "type": "n8n-nodes-base.httpRequest",
      "notes": "Appends full scoring record to VirailtyLog tab for continuous pattern refinement. Replace YOUR_SHEET_ID. Columns: timestamp, submission_id, title, platform, content_type, score, tier, component_scores x5, key_drivers, weaknesses, recommendations, best_publish_time, engagement_low, engagement_high, confidence.",
      "position": [
        3792,
        176
      ],
      "parameters": {
        "url": "https://sheets.googleapis.com/v4/spreadsheets/YOUR_SHEET_ID/values/VirailtyLog!A1:append?valueInputOption=USER_ENTERED",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"values\": [[\n    \"{{ $json.analysis_timestamp }}\",\n    \"{{ $json.scored_submission_id }}\",\n    \"{{ $json.title }}\",\n    \"{{ $json.platform }}\",\n    \"{{ $json.content_type }}\",\n    {{ $json.virality_score }},\n    \"{{ $json.score_tier }}\",\n    {{ $json.component_scores.trend_alignment }},\n    {{ $json.component_scores.engagement_prediction }},\n    {{ $json.component_scores.timing_score }},\n    {{ $json.component_scores.historical_similarity }},\n    {{ $json.component_scores.media_bonus }},\n    \"{{ $json.key_drivers.join(' | ') }}\",\n    \"{{ $json.weaknesses.join(' | ') }}\",\n    \"{{ $json.recommendations.join(' | ') }}\",\n    \"{{ $json.best_publish_time }}\",\n    {{ $json.predicted_engagement_range.low }},\n    {{ $json.predicted_engagement_range.high }},\n    \"{{ $json.confidence }}\"\n  ]]\n}",
        "sendBody": true,
        "specifyBody": "json"
      },
      "typeVersion": 4.2
    },
    {
      "id": "cfe2dfc6-0ae1-40ae-989e-4f19f36d274f",
      "name": "Webhook Response - Return Score",
      "type": "n8n-nodes-base.respondToWebhook",
      "notes": "Returns the full virality prediction payload to the caller when triggered via webhook.",
      "position": [
        4016,
        176
      ],
      "parameters": {
        "options": {},
        "respondWith": "json",
        "responseBody": "={\n  \"submission_id\": \"{{ $json.scored_submission_id }}\",\n  \"virality_score\": {{ $json.virality_score }},\n  \"score_tier\": \"{{ $json.score_tier }}\",\n  \"component_scores\": {{ JSON.stringify($json.component_scores) }},\n  \"key_drivers\": {{ JSON.stringify($json.key_drivers) }},\n  \"pattern_matches\": {{ JSON.stringify($json.pattern_matches) }},\n  \"weaknesses\": {{ JSON.stringify($json.weaknesses) }},\n  \"recommendations\": {{ JSON.stringify($json.recommendations) }},\n  \"best_publish_time\": \"{{ $json.best_publish_time }}\",\n  \"predicted_engagement_range\": {{ JSON.stringify($json.predicted_engagement_range) }},\n  \"confidence\": \"{{ $json.confidence }}\",\n  \"analysis_timestamp\": \"{{ $json.analysis_timestamp }}\"\n}"
      },
      "typeVersion": 1.1
    },
    {
      "id": "05927d21-1e63-4e9c-af84-a5009931061e",
      "name": "Wait For Result From Ai",
      "type": "n8n-nodes-base.wait",
      "position": [
        2864,
        176
      ],
      "parameters": {},
      "typeVersion": 1.1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "ae14de4b-d4f8-4ade-a828-67e4a9690eaa",
  "connections": {
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI - Virality Score & Analysis",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Load Platform Config": {
      "main": [
        [
          {
            "node": "Fetch Historical Performance Data",
            "type": "main",
            "index": 0
          },
          {
            "node": "Fetch Trending Topics & Signals",
            "type": "main",
            "index": 0
          },
          {
            "node": "Fetch Audience Behavior Signals",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Log to Google Sheets": {
      "main": [
        [
          {
            "node": "Webhook Response - Return Score",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Normalize Content Input": {
      "main": [
        [
          {
            "node": "Python - Validate Content Input",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait For Result From Ai": {
      "main": [
        [
          {
            "node": "JS - Parse & Enrich Score",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait - Rate Limit Buffer": {
      "main": [
        [
          {
            "node": "AI - Virality Score & Analysis",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "JS - Parse & Enrich Score": {
      "main": [
        [
          {
            "node": "Slack - Notify High Virality",
            "type": "main",
            "index": 0
          },
          {
            "node": "Slack - Notify Moderate Virality",
            "type": "main",
            "index": 0
          },
          {
            "node": "Email - Low Virality Revision Alert",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter - Valid Content Only": {
      "main": [
        [
          {
            "node": "Load Platform Config",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook - Content Submitted": {
      "main": [
        [
          {
            "node": "Normalize Content Input",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Slack - Notify High Virality": {
      "main": [
        [
          {
            "node": "Log to Google Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI - Virality Score & Analysis": {
      "main": [
        [
          {
            "node": "Wait For Result From Ai",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule - Daily Content Queue": {
      "main": [
        [
          {
            "node": "Normalize Content Input",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Audience Behavior Signals": {
      "main": [
        [
          {
            "node": "Python - Merge & Normalize Signals",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Trending Topics & Signals": {
      "main": [
        [
          {
            "node": "Python - Merge & Normalize Signals",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Python - Validate Content Input": {
      "main": [
        [
          {
            "node": "Filter - Valid Content Only",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Slack - Notify Moderate Virality": {
      "main": [
        [
          {
            "node": "Log to Google Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Historical Performance Data": {
      "main": [
        [
          {
            "node": "Python - Merge & Normalize Signals",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Python - Merge & Normalize Signals": {
      "main": [
        [
          {
            "node": "Wait - Rate Limit Buffer",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Email - Low Virality Revision Alert": {
      "main": [
        [
          {
            "node": "Log to Google Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}