{
  "nodes": [
    {
      "id": "1e66a65c-e05b-4386-a573-88e7a5ec762e",
      "name": "SEO Keyword Input Form",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -624,
        256
      ],
      "parameters": {
        "options": {
          "buttonLabel": "\u5206\u6790\u3092\u958b\u59cb",
          "appendAttribution": false
        },
        "formTitle": "SEO SERP Analyzer - \u7af6\u5408\u5206\u6790\u30c4\u30fc\u30eb",
        "formFields": {
          "values": [
            {
              "fieldLabel": "\u5bfe\u7b56\u30ad\u30fc\u30ef\u30fc\u30c9",
              "requiredField": true
            },
            {
              "fieldLabel": "\u30bf\u30fc\u30b2\u30c3\u30c8\u8aad\u8005\u5c64\uff08\u4efb\u610f\uff09"
            }
          ]
        },
        "formDescription": "\u691c\u7d22\u30ad\u30fc\u30ef\u30fc\u30c9\u3092\u5165\u529b\u3059\u308b\u3068\u3001\u4e0a\u4f4d10\u8a18\u4e8b\u3092\u5206\u6790\u3057\u3066\u6700\u9069\u306a\u8a18\u4e8b\u69cb\u6210\u6848\u3092\u751f\u6210\u3057\u307e\u3059"
      },
      "typeVersion": 2.3
    },
    {
      "id": "c9be0d8f-d286-43dd-bdd7-cb5496ade6cb",
      "name": "Workflow Configuration",
      "type": "n8n-nodes-base.set",
      "position": [
        -400,
        160
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "id-1",
              "name": "maxResults",
              "type": "number",
              "value": 10
            },
            {
              "id": "id-2",
              "name": "countryCode",
              "type": "string",
              "value": "jp"
            }
          ]
        },
        "includeOtherFields": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "17df7ac1-c3d4-482b-b2b2-27d45b1540de",
      "name": "Google Search SERP",
      "type": "@apify/n8n-nodes-apify.apify",
      "position": [
        -176,
        160
      ],
      "parameters": {
        "actorId": {
          "__rl": true,
          "mode": "id",
          "value": "apify/google-search-scraper"
        },
        "customBody": "={\n  \"queries\": {{ $json.target_keyword }},\n  \"maxItems\": {{ $('Workflow Configuration').first().json.maxResults }},\n  \"countryCode\": {{ $('Workflow Configuration').first().json.countryCode }},\n  \"resultsType\": \"search\"\n}"
      },
      "typeVersion": 1
    },
    {
      "id": "ee58af1c-0777-4cc9-b6f3-7f5c51bfa30c",
      "name": "Filter Non-Article URLs",
      "type": "n8n-nodes-base.filter",
      "position": [
        48,
        160
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "leftValue": "",
            "caseSensitive": false,
            "typeValidation": "loose"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "id-1",
              "operator": {
                "type": "string",
                "operation": "notContains"
              },
              "leftValue": "={{ $json.url }}",
              "rightValue": ".pdf"
            },
            {
              "id": "id-2",
              "operator": {
                "type": "string",
                "operation": "notContains"
              },
              "leftValue": "={{ $json.url }}",
              "rightValue": "amazon.co.jp"
            },
            {
              "id": "id-3",
              "operator": {
                "type": "string",
                "operation": "notContains"
              },
              "leftValue": "={{ $json.url }}",
              "rightValue": "youtube.com"
            },
            {
              "id": "id-4",
              "operator": {
                "type": "string",
                "operation": "notContains"
              },
              "leftValue": "={{ $json.url }}",
              "rightValue": "youtu.be"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "e50d7940-c0f9-41a2-9dab-a3fb2611ba78",
      "name": "Scrape Article Headings",
      "type": "@apify/n8n-nodes-apify.apify",
      "position": [
        272,
        160
      ],
      "parameters": {
        "actorId": {
          "__rl": true,
          "mode": "id",
          "value": "apify/cheerio-scraper"
        },
        "customBody": "={\n  \"startUrls\": {{ [{ url: $json.url }] }},\n  \"pageFunction\": \"async function pageFunction(context) {\\n    const { $ } = context;\\n    return {\\n        title: $('title').text().trim(),\\n        description: $('meta[name=\\\"description\\\"]').attr('content') || '',\\n        h1: $('h1').first().text().trim(),\\n        h2: $('h2').map((i, el) => $(el).text().trim()).get(),\\n        h3: $('h3').map((i, el) => $(el).text().trim()).get(),\\n        url: context.request.url\\n    };\\n}\"\n}"
      },
      "typeVersion": 1
    },
    {
      "id": "cca493d5-1456-447d-b757-2eaf702ab4e0",
      "name": "Aggregate Competitor Data",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        496,
        160
      ],
      "parameters": {
        "options": {},
        "aggregate": "aggregateAllItemData"
      },
      "typeVersion": 1
    },
    {
      "id": "e9ec34d4-ff71-4c10-8be8-401592788e11",
      "name": "AI Content Structure Analysis",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        720,
        160
      ],
      "parameters": {
        "operation": "message"
      },
      "typeVersion": 2
    },
    {
      "id": "244d7c4a-e22b-4e6e-bfd4-1b6266dd56d2",
      "name": "Create Google Doc",
      "type": "n8n-nodes-base.googleDocs",
      "position": [
        1072,
        160
      ],
      "parameters": {
        "title": "={{ '\u69cb\u6210\u6848: ' + $('SEO Keyword Input Form').first().json.target_keyword }}"
      },
      "typeVersion": 2
    },
    {
      "id": "292c38c9-85bd-4bda-9857-0116e9e774d8",
      "name": "Store Form Responses",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -400,
        352
      ],
      "parameters": {
        "columns": {
          "value": null,
          "schema": [],
          "mappingMode": "autoMapInputData",
          "matchingColumns": [
            "target_keyword"
          ]
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "name",
          "value": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "<__PLACEHOLDER_VALUE__Google Sheets Document ID__>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "4103f32c-5831-4d05-8186-5d39df2db84f",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1264,
        32
      ],
      "parameters": {
        "width": 480,
        "height": 416,
        "content": "## Overview\nDrastically reduce the time spent on SEO research and content briefing. This workflow analyzes the current top-ranking pages for a specific keyword and uses AI to generate a comprehensive article outline (content brief) based on what is already working.\n\nIt scrapes the Search Engine Results Page (SERP), extracts headings (H1, H2, H3) from competitor articles, and uses OpenAI to structure a superior content plan, saving the result directly to a Google Doc.\n\n## Who is this for?\n- **Content Marketers:** To quickly create data-backed content briefs.\n- **SEO Specialists:** To analyze competitor content structures at scale.\n- **Bloggers/Writers:** To overcome writer's block and ensure topic coverage."
      },
      "typeVersion": 1
    },
    {
      "id": "e7638d33-47f7-4b40-93a5-eb427e6dd5b4",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -688,
        160
      ],
      "parameters": {
        "color": 3,
        "width": 224,
        "height": 256,
        "content": "1.  **Input:** Takes a target keyword and target audience via a built-in **n8n Form**."
      },
      "typeVersion": 1
    },
    {
      "id": "dbb5b76e-85bf-456b-95f7-71bd30f2da46",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -240,
        64
      ],
      "parameters": {
        "color": 2,
        "width": 224,
        "height": 256,
        "content": "2.  **SERP Analysis:** Uses **Apify** (Google Search Scraper) to find the top 10 results for that keyword."
      },
      "typeVersion": 1
    },
    {
      "id": "43441013-a562-4d05-9489-c155b61cc0fe",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        0
      ],
      "parameters": {
        "color": 4,
        "width": 192,
        "height": 320,
        "content": "3.  **Filtering:** Automatically removes non-article URLs (like Amazon product pages, YouTube videos, and PDFs) to focus on content competitors."
      },
      "typeVersion": 1
    },
    {
      "id": "1001119c-9283-44fc-8d35-66bc39d8bd68",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        208,
        0
      ],
      "parameters": {
        "color": 6,
        "width": 224,
        "height": 320,
        "content": "4.  **Deep Scraping:** Visits each competitor's URL to extract their article structure (Title, Description, H1-H3 tags) using **Apify** (Cheerio Scraper)."
      },
      "typeVersion": 1
    },
    {
      "id": "7a89c544-e53d-431f-a231-38df3620f7a3",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        448,
        64
      ],
      "parameters": {
        "color": 5,
        "width": 512,
        "height": 288,
        "content": "5.  **AI Generation:** Aggregates the research data and sends it to **OpenAI**, which generates an optimized article outline."
      },
      "typeVersion": 1
    },
    {
      "id": "84cd0f11-4732-492d-83f7-a18598e94c2e",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1008,
        0
      ],
      "parameters": {
        "color": 3,
        "height": 320,
        "content": "6.  **Output:**\n    - Creates a new **Google Doc** with the generated outline.\n    - Logs the request in **Google Sheets** for tracking."
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "Google Search SERP": {
      "main": [
        [
          {
            "node": "Filter Non-Article URLs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "SEO Keyword Input Form": {
      "main": [
        [
          {
            "node": "Workflow Configuration",
            "type": "main",
            "index": 0
          },
          {
            "node": "Store Form Responses",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Workflow Configuration": {
      "main": [
        [
          {
            "node": "Google Search SERP",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter Non-Article URLs": {
      "main": [
        [
          {
            "node": "Scrape Article Headings",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Scrape Article Headings": {
      "main": [
        [
          {
            "node": "Aggregate Competitor Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Aggregate Competitor Data": {
      "main": [
        [
          {
            "node": "AI Content Structure Analysis",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Content Structure Analysis": {
      "main": [
        [
          {
            "node": "Create Google Doc",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}