{
  "id": "7kL3YKtw4dawLDTp",
  "name": "SEO Marketing Content Generator for AI and Engineering Education Services",
  "tags": [],
  "nodes": [
    {
      "id": "7560bb6b-c461-4465-a27d-cd737ccde35e",
      "name": "When clicking 'Test workflow'",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -224,
        1632
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "343bbc5f-6068-4ed1-8265-e9de73fc1156",
      "name": "Workflow Configuration",
      "type": "n8n-nodes-base.set",
      "position": [
        0,
        1632
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "id-1",
              "name": "serviceType",
              "type": "string",
              "value": "teaching"
            },
            {
              "id": "id-2",
              "name": "targetAudience",
              "type": "string",
              "value": "students"
            },
            {
              "id": "id-3",
              "name": "industry",
              "type": "string",
              "value": "AI and Engineering"
            },
            {
              "id": "id-4",
              "name": "contentType",
              "type": "string",
              "value": "landing page"
            },
            {
              "id": "id-5",
              "name": "tone",
              "type": "string",
              "value": "professional yet approachable"
            },
            {
              "id": "id-6",
              "name": "wordCount",
              "type": "number",
              "value": 800
            },
            {
              "id": "id-7",
              "name": "redditSubreddits",
              "type": "string",
              "value": "artificial,MachineLearning,engineering,learnprogramming"
            },
            {
              "id": "id-8",
              "name": "youtubeSearchQuery",
              "type": "string",
              "value": "AI engineering education"
            },
            {
              "id": "id-9",
              "name": "newsApiUrl",
              "type": "string",
              "value": "https://newsapi.org/v2/everything"
            },
            {
              "id": "id-10",
              "name": "newsApiQuery",
              "type": "string",
              "value": "AI engineering education training"
            }
          ]
        },
        "includeOtherFields": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "4cae4e73-329d-4d7f-bec0-9bf9f8191a43",
      "name": "SEO Content Generator Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "disabled": true,
      "position": [
        1024,
        1536
      ],
      "parameters": {
        "text": "=Service: {{ $json.serviceType }}\nAudience: {{ $json.targetAudience }}\nIndustry: {{ $json.industry }}\nContent Type: {{ $json.contentType }}\n\nResearch Insights Summary:\n{{ $json.insights.summary }}\n\nKey Trends: {{ $json.insights.keyTrends.join(\", \") }}\n\nTop Questions from Audience:\n{{ $json.insights.commonQuestions.slice(0, 5).join(\"\\n\") }}",
        "options": {
          "systemMessage": "You are an expert SEO content writer and digital marketing specialist with deep expertise in AI and engineering education services.\n\nYou have access to comprehensive research data from multiple sources:\n- Reddit discussions showing real user questions and pain points\n- YouTube video trends and popular content themes\n- Industry news and current developments\n- Wikipedia for authoritative background information\n- Google Search for SEO trends and competitor analysis\n\nYour task is to create highly optimized, compelling marketing content that:\n1. Leverages insights from all research sources to understand audience needs\n2. Identifies high-value keywords and search intent based on real data\n3. Addresses actual questions and concerns from the target audience\n4. Incorporates trending topics and current industry developments\n5. Generates engaging, conversion-focused content that ranks well\n6. Maintains a professional yet approachable tone throughout\n7. Targets approximately 800 words for the main content\n8. Focuses on benefits, outcomes, and value propositions\n9. Includes clear calls-to-action\n\nContent should be:\n- Data-driven and informed by real audience insights\n- SEO-optimized with natural keyword integration\n- Audience-specific and benefit-driven\n- Professionally written with clear structure\n- Conversion-oriented with strong CTAs\n- Current and relevant to industry trends\n\nReturn all content in the structured format defined by the output parser."
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 3.1
    },
    {
      "id": "43e0a565-0266-4221-8a4f-b55ec90daf16",
      "name": "OpenAI GPT-4",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        832,
        1776
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "id",
          "value": "gpt-4o"
        },
        "options": {
          "temperature": 0.7
        },
        "builtInTools": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "6f8ea561-48a1-4f6d-bb5f-1e6cc59874eb",
      "name": "Google Search for SEO Research",
      "type": "@n8n/n8n-nodes-langchain.toolSerpApi",
      "position": [
        992,
        1840
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "fa096b56-9f84-43b2-ae4b-082e88da285b",
      "name": "Structured Content Output",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        1296,
        1840
      ],
      "parameters": {
        "schemaType": "manual",
        "inputSchema": "{\n  \"type\": \"object\",\n  \"properties\": {\n    \"headline\": {\n      \"type\": \"string\"\n    },\n    \"subheadline\": {\n      \"type\": \"string\"\n    },\n    \"metaTitle\": {\n      \"type\": \"string\"\n    },\n    \"metaDescription\": {\n      \"type\": \"string\"\n    },\n    \"keywords\": {\n      \"type\": \"array\",\n      \"items\": {\n        \"type\": \"string\"\n      }\n    },\n    \"mainContent\": {\n      \"type\": \"string\",\n      \"description\": \"Main content in markdown format\"\n    },\n    \"callToAction\": {\n      \"type\": \"string\"\n    },\n    \"targetKeywords\": {\n      \"type\": \"array\",\n      \"items\": {\n        \"type\": \"string\"\n      }\n    }\n  }\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "13871073-5e4a-462b-acd6-ca7a713761f6",
      "name": "Convert to HTML",
      "type": "n8n-nodes-base.markdown",
      "position": [
        1472,
        1712
      ],
      "parameters": {
        "mode": "markdownToHtml",
        "options": {},
        "markdown": "={{ $json.mainContent }}"
      },
      "typeVersion": 1
    },
    {
      "id": "edf17bc6-4936-480e-90cf-6219a81ba54e",
      "name": "Fetch Reddit Discussions",
      "type": "n8n-nodes-base.reddit",
      "position": [
        240,
        1536
      ],
      "parameters": {
        "limit": 20,
        "keyword": "={{ $json.industry }} {{ $json.serviceType }}",
        "operation": "search",
        "subreddit": "={{ $json.redditSubreddits }}",
        "additionalFields": {}
      },
      "typeVersion": 1
    },
    {
      "id": "be0a7632-4e87-4b17-8a0c-d032911501b6",
      "name": "Fetch YouTube Videos",
      "type": "n8n-nodes-base.youTube",
      "position": [
        240,
        1728
      ],
      "parameters": {
        "limit": 20,
        "filters": {
          "q": "={{ $json.youtubeSearchQuery }}"
        },
        "options": {},
        "resource": "video"
      },
      "typeVersion": 1
    },
    {
      "id": "84ffa01b-911d-4a2e-8be6-909083b1b7c4",
      "name": "Fetch Industry News API",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        240,
        1920
      ],
      "parameters": {
        "url": "={{ $json.newsApiUrl }}",
        "options": {},
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "q",
              "value": "={{ $json.newsApiQuery }}"
            },
            {
              "name": "apiKey",
              "value": "<__PLACEHOLDER_VALUE__NewsAPI Key__>"
            },
            {
              "name": "pageSize",
              "value": "20"
            },
            {
              "name": "sortBy",
              "value": "relevancy"
            }
          ]
        }
      },
      "typeVersion": 4.3
    },
    {
      "id": "1177f0ba-3962-464f-8cbc-7fb2dce4be71",
      "name": "Wikipedia Research",
      "type": "@n8n/n8n-nodes-langchain.toolWikipedia",
      "position": [
        1152,
        1760
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "1617a2ec-e090-4077-a446-f9e2e9f9e9a7",
      "name": "Combine Research Data",
      "type": "n8n-nodes-base.merge",
      "position": [
        448,
        1552
      ],
      "parameters": {
        "mode": "combine",
        "options": {},
        "combineBy": "combineAll"
      },
      "typeVersion": 3.2
    },
    {
      "id": "562f8f74-c7b1-476c-91ab-79d777b54fb9",
      "name": "Aggregate Insights",
      "type": "n8n-nodes-base.code",
      "position": [
        704,
        1536
      ],
      "parameters": {
        "jsCode": "// Aggregate and summarize insights from Reddit, YouTube, and news sources\n// Input: Combined data from multiple research sources\n// Output: Structured insights with trends, topics, questions, and sentiment\n\nconst items = $input.all();\n\n// Initialize aggregation structure\nconst insights = {\n  keyTrends: [],\n  popularTopics: {},\n  commonQuestions: [],\n  sentimentAnalysis: {\n    positive: 0,\n    neutral: 0,\n    negative: 0\n  },\n  sourceBreakdown: {\n    reddit: 0,\n    youtube: 0,\n    news: 0\n  },\n  topKeywords: {},\n  summary: ''\n};\n\n// Process each item from the combined research data\nfor (const item of items) {\n  const data = item.json;\n  \n  // Identify source type\n  let sourceType = 'unknown';\n  if (data.subreddit || data.reddit_url) {\n    sourceType = 'reddit';\n    insights.sourceBreakdown.reddit++;\n  } else if (data.videoId || data.youtube_url || data.channelTitle) {\n    sourceType = 'youtube';\n    insights.sourceBreakdown.youtube++;\n  } else if (data.article || data.news_url || data.publishedAt) {\n    sourceType = 'news';\n    insights.sourceBreakdown.news++;\n  }\n  \n  // Extract text content based on source\n  let content = '';\n  let title = '';\n  \n  if (sourceType === 'reddit') {\n    title = data.title || '';\n    content = (data.selftext || data.body || '') + ' ' + title;\n  } else if (sourceType === 'youtube') {\n    title = data.title || data.snippet?.title || '';\n    content = (data.description || data.snippet?.description || '') + ' ' + title;\n  } else if (sourceType === 'news') {\n    title = data.title || '';\n    content = (data.description || data.content || '') + ' ' + title;\n  }\n  \n  // Extract keywords and topics\n  const words = content.toLowerCase()\n    .replace(/[^a-z0-9\\s]/g, ' ')\n    .split(/\\s+/)\n    .filter(word => word.length > 4); // Filter out short words\n  \n  words.forEach(word => {\n    insights.topKeywords[word] = (insights.topKeywords[word] || 0) + 1;\n  });\n  \n  // Detect questions\n  if (content.includes('?') || /\\b(how|what|why|when|where|who)\\b/i.test(content)) {\n    const questionMatch = content.match(/[^.!?]*\\?[^.!?]*/g);\n    if (questionMatch) {\n      insights.commonQuestions.push(...questionMatch.map(q => q.trim()).filter(q => q.length > 10));\n    }\n  }\n  \n  // Simple sentiment analysis based on keywords\n  const positiveWords = ['great', 'excellent', 'amazing', 'love', 'best', 'good', 'helpful', 'useful', 'recommend'];\n  const negativeWords = ['bad', 'terrible', 'worst', 'hate', 'poor', 'difficult', 'problem', 'issue', 'fail'];\n  \n  const lowerContent = content.toLowerCase();\n  const positiveCount = positiveWords.filter(word => lowerContent.includes(word)).length;\n  const negativeCount = negativeWords.filter(word => lowerContent.includes(word)).length;\n  \n  if (positiveCount > negativeCount) {\n    insights.sentimentAnalysis.positive++;\n  } else if (negativeCount > positiveCount) {\n    insights.sentimentAnalysis.negative++;\n  } else {\n    insights.sentimentAnalysis.neutral++;\n  }\n  \n  // Add to popular topics if title exists\n  if (title) {\n    insights.popularTopics[title] = (insights.popularTopics[title] || 0) + 1;\n  }\n}\n\n// Sort and limit top keywords\nconst sortedKeywords = Object.entries(insights.topKeywords)\n  .sort((a, b) => b[1] - a[1])\n  .slice(0, 20)\n  .map(([word, count]) => ({ keyword: word, frequency: count }));\n\n// Sort and limit popular topics\nconst sortedTopics = Object.entries(insights.popularTopics)\n  .sort((a, b) => b[1] - a[1])\n  .slice(0, 10)\n  .map(([topic, count]) => ({ topic, mentions: count }));\n\n// Limit common questions\nconst uniqueQuestions = [...new Set(insights.commonQuestions)].slice(0, 15);\n\n// Extract key trends from top keywords\ninsights.keyTrends = sortedKeywords.slice(0, 5).map(k => k.keyword);\n\n// Generate summary\nconst totalItems = items.length;\nconst sentimentTotal = insights.sentimentAnalysis.positive + insights.sentimentAnalysis.neutral + insights.sentimentAnalysis.negative;\nconst positivePercent = sentimentTotal > 0 ? Math.round((insights.sentimentAnalysis.positive / sentimentTotal) * 100) : 0;\n\ninsights.summary = `Analyzed ${totalItems} items from ${insights.sourceBreakdown.reddit} Reddit posts, ${insights.sourceBreakdown.youtube} YouTube videos, and ${insights.sourceBreakdown.news} news articles. Overall sentiment is ${positivePercent}% positive. Top trending topics include: ${insights.keyTrends.join(', ')}.`;\n\n// Return structured output\nreturn [{\n  json: {\n    insights: {\n      keyTrends: insights.keyTrends,\n      popularTopics: sortedTopics,\n      commonQuestions: uniqueQuestions,\n      sentimentAnalysis: insights.sentimentAnalysis,\n      sourceBreakdown: insights.sourceBreakdown,\n      topKeywords: sortedKeywords,\n      summary: insights.summary\n    },\n    totalItemsAnalyzed: totalItems,\n    timestamp: new Date().toISOString()\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "f7a11bbf-90c9-454f-b1b2-19909eac59a1",
      "name": "Save to Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1712,
        1696
      ],
      "parameters": {
        "columns": {
          "value": null,
          "mappingMode": "autoMapInputData"
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "name",
          "value": "SEO Content"
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "<__PLACEHOLDER_VALUE__Google Sheets Document ID__>"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "4168bbfb-ef28-49e1-930c-b74f12fe3eb1",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        832,
        1088
      ],
      "parameters": {
        "color": 4,
        "width": 592,
        "height": 304,
        "content": "## Prerequisites\nReddit API access, YouTube Data API key, industry news API\n## Use Cases\nBlog content automation, competitive content analysis, trending topic research\n## Customization\nModify research sources, adjust AI prompts for brand voice, customize SEO parameters\n## Benefits\n10x faster content production, multi-platform research coverage"
      },
      "typeVersion": 1
    },
    {
      "id": "a2eaa9b3-1e58-4d7d-bb60-0660e85d35e3",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        464,
        1216
      ],
      "parameters": {
        "width": 336,
        "height": 176,
        "content": "## Setup Steps\n1. Configure Reddit, YouTube, and industry news API credentials in fetch nodes\n2. Add OpenAI API key for GPT-4 agent and Google API key for search analysis\n3. Connect Google Sheets with write permissions for content storage"
      },
      "typeVersion": 1
    },
    {
      "id": "62eb56c0-127f-4ee6-a683-22a0492a321e",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -256,
        1168
      ],
      "parameters": {
        "width": 688,
        "height": 224,
        "content": "## How It Works\nThis workflow automates SEO content creation by aggregating multi-source research and generating optimized articles. Designed for content marketers, SEO specialists, and digital agencies, it solves the time-consuming challenge of researching trending topics and crafting search-optimized content at scale. The system pulls discussions from Reddit, videos from YouTube, and industry news via APIs, then combines this data into comprehensive insights. An AI agent analyzes aggregated research, performs Google Search SEO analysis, consults Wikipedia for accuracy, and generates structured, SEO-optimized HTML content. The final output saves automatically to Google Sheets for easy management and publishing workflows."
      },
      "typeVersion": 1
    },
    {
      "id": "3785ba8d-673f-46a3-a7a2-ff1fb2cf6850",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1440,
        1408
      ],
      "parameters": {
        "color": 7,
        "width": 464,
        "height": 608,
        "content": "## Response Coordination & Notifications\n\n**What:**\nAutomatically schedules maintenance or inspection teams and sends tailored email \n\n**Why:**\nFast, coordinated action reduces secondary damage.  "
      },
      "typeVersion": 1
    },
    {
      "id": "04752c37-26c1-40c9-8b08-49f541929857",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        656,
        1408
      ],
      "parameters": {
        "color": 7,
        "width": 768,
        "height": 608,
        "content": "## AI-Driven SEO Content Creation\n\n**What:** AI agent processes research, runs Google Search SEO analysis \n\n**Why:** AI automation delivers SEO-optimized "
      },
      "typeVersion": 1
    },
    {
      "id": "b9833ef3-109c-4970-a5ac-d2154d2f943c",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -256,
        1408
      ],
      "parameters": {
        "color": 7,
        "width": 880,
        "height": 688,
        "content": "## Multi-Source Research Collection\n\n**What:** Fetches Reddit discussions, YouTube videos, and industry news API data, then combines all research  \n\n**Why:** Single-source content lacks depth and misses trending angles.  "
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "availableInMCP": false,
    "executionOrder": "v1"
  },
  "versionId": "760fc10b-94c0-49d7-ab99-cff56d8f6f18",
  "connections": {
    "OpenAI GPT-4": {
      "ai_languageModel": [
        [
          {
            "node": "SEO Content Generator Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Convert to HTML": {
      "main": [
        [
          {
            "node": "Save to Google Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Aggregate Insights": {
      "main": [
        [
          {
            "node": "SEO Content Generator Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wikipedia Research": {
      "ai_tool": [
        [
          {
            "node": "SEO Content Generator Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Fetch YouTube Videos": {
      "main": [
        [
          {
            "node": "Combine Research Data",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Combine Research Data": {
      "main": [
        [
          {
            "node": "Aggregate Insights",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Workflow Configuration": {
      "main": [
        [
          {
            "node": "Fetch Reddit Discussions",
            "type": "main",
            "index": 0
          },
          {
            "node": "Fetch YouTube Videos",
            "type": "main",
            "index": 0
          },
          {
            "node": "Fetch Industry News API",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Reddit Discussions": {
      "main": [
        [
          {
            "node": "Combine Research Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Content Output": {
      "ai_outputParser": [
        [
          {
            "node": "SEO Content Generator Agent",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "SEO Content Generator Agent": {
      "main": [
        [
          {
            "node": "Convert to HTML",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking 'Test workflow'": {
      "main": [
        [
          {
            "node": "Workflow Configuration",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Search for SEO Research": {
      "ai_tool": [
        [
          {
            "node": "SEO Content Generator Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  }
}