{
  "id": "AVm0iA9r3wE4g7ny",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "SEO Keyword & Content Gap Analysis Workflow (Loveable UI)",
  "tags": [],
  "nodes": [
    {
      "id": "667f9b9f-9a96-4d73-8aa0-fb7f0cfda8b2",
      "name": "LLM Engine for Market Intelligence Analysis",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        384,
        96
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o",
          "cachedResultName": "gpt-4o"
        },
        "options": {},
        "responsesApiEnabled": false
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "ecfbcb1b-ec88-49df-a19e-983fc6d0f6e2",
      "name": "Parse Market Analysis Output JSON",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        608,
        96
      ],
      "parameters": {
        "jsonSchemaExample": "{\n  \"keyword\": \"AI automation for ecommerce\",\n  \"country\": \"India\",\n\n  \"seo_summary\": {\n    \"search_intent\": \"Informational + Commercial\",\n    \"competition_level\": \"High\",\n    \"serp_features\": [\"Videos\", \"Authority Blogs\", \"Reddit\"]\n  },\n\n  \"content_gaps\": [\n    \"Very few step-by-step ecommerce automation workflows\",\n    \"Lack of real implementation case studies\",\n    \"Most content is tool-list based and generic\"\n  ],\n\n  \"content_opportunities\": [\n    {\n      \"title\": \"How to Build AI Automation Workflows for Shopify Stores\",\n      \"angle\": \"Practical implementation\",\n      \"difficulty\": \"Medium\"\n    },\n    {\n      \"title\": \"Real Ecommerce AI Automation Case Studies (2025)\",\n      \"angle\": \"Experience-based\",\n      \"difficulty\": \"Medium\"\n    },\n    {\n      \"title\": \"Free vs Paid AI Automation Tools for Ecommerce\",\n      \"angle\": \"Comparison\",\n      \"difficulty\": \"Low\"\n    }\n  ],\n\n  \"recommended_content_types\": [\n    \"Long-form blog\",\n    \"YouTube explainer\",\n    \"Workflow playbook\"\n  ],\n\n  \"confidence_score\": \"High\"\n}\n"
      },
      "typeVersion": 1.3
    },
    {
      "id": "fbc0d971-e377-4ee8-85f7-4cb2e1b6e040",
      "name": "Error Handler Trigger",
      "type": "n8n-nodes-base.errorTrigger",
      "position": [
        -496,
        624
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "778714d3-e3a4-4a66-873e-219642cc429e",
      "name": "Slack: Send Error Alert",
      "type": "n8n-nodes-base.slack",
      "position": [
        -128,
        624
      ],
      "parameters": {
        "text": "=\u274c *Error in API Error Catalog Workflow* *Node:* {{ $json.node.name }} *Message:* {{ $json.error.message }} *Time:* {{ $json.timestamp }}",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "list",
          "value": "C09GNB90TED",
          "cachedResultName": "general-information"
        },
        "otherOptions": {}
      },
      "credentials": {
        "slackApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "ab98112e-a67a-4519-9b22-9331fb6d03e3",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -592,
        464
      ],
      "parameters": {
        "color": 7,
        "width": 672,
        "height": 336,
        "content": "## \ud83d\udea8 Error Handling \n\n \nCatches any workflow failure and posts an alert to Slack.  \nIncludes node name, error message, and timestamp for quick debugging.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "27c67566-d2b0-46ac-a276-8ed5359149c9",
      "name": "Extract Keyword from Request Payload",
      "type": "n8n-nodes-base.set",
      "position": [
        -448,
        -144
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "520ab8b7-b3ba-4f51-9568-6871888a79f0",
              "name": "body.keyword",
              "type": "string",
              "value": "={{ $json.body.keyword }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "b5fe5a52-0412-4811-a2a8-c2142a3677ab",
      "name": "Run Google SERP Search for Keyword (India)",
      "type": "n8n-nodes-serpapi.serpApi",
      "position": [
        -144,
        -144
      ],
      "parameters": {
        "q": "={{ $json.body.keyword }}",
        "requestOptions": {},
        "additionalFields": {
          "num": "10",
          "uule": "India"
        }
      },
      "credentials": {
        "serpApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "05153e8d-efce-47bf-b91f-b0affd8e2b19",
      "name": "Normalize SERP Results into SEO Dataset",
      "type": "n8n-nodes-base.code",
      "position": [
        128,
        -144
      ],
      "parameters": {
        "jsCode": "const data = $input.first().json;\n\nreturn [\n  {\n    json: {\n      keyword: data.search_parameters?.q || \"\",\n      country: data.search_parameters?.uule || \"\",\n      total_results: data.search_information?.total_results || null,\n\n      organic_results: (data.organic_results || []).map(r => ({\n        position: r.position,\n        title: r.title,\n        snippet: r.snippet,\n        link: r.link,\n        source: r.source || null,\n        date: r.date || null\n      })),\n\n      videos: (data.inline_videos || []).map(v => ({\n        title: v.title,\n        platform: v.platform,\n        duration: v.duration,\n        link: v.link\n      })),\n\n      related_searches: (data.related_searches || []).map(rs => rs.query)\n    }\n  }\n];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "d28b0e9c-fb98-40cd-96da-24e6a866854d",
      "name": "Analyze Keyword SEO Opportunities (AI)",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        400,
        -144
      ],
      "parameters": {
        "text": "=Keyword: {{ $json.keyword }}\nCountry: {{ $json.country }}\nTotal Results: {{ $json.total_results }}\n\nTop Organic Results:\n{{ JSON.stringify($json.organic_results, null, 2) }}\n\nRelated Searches:\n{{ JSON.stringify($json.related_searches, null, 2) }}\n\nVideos Present:\n{{ JSON.stringify($json.videos, null, 2) }}\n\nReturn the output in this JSON format:\n{\n  \"search_intent\": \"\",\n  \"competition_level\": \"\",\n  \"content_gaps\": [],\n  \"top_opportunities\": [],\n  \"recommended_content_types\": []\n}\n",
        "options": {
          "systemMessage": "=You are an SEO strategist working for an SEO agency.\n\nYour job is to analyze Google search results and identify:\n- Search intent\n- Competition level\n- Content gaps\n- High-impact content opportunities\n\nFocus on gaps and opportunities, not summaries.\nBe practical and concise.\n"
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 2
    },
    {
      "id": "2ff3fef3-67ff-4a1a-9869-80bc137eacdb",
      "name": "Receive SEO Keyword Analysis Request",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -672,
        -144
      ],
      "parameters": {
        "path": "c8996569-9459-4976-bbdd-b800179b3dc7",
        "options": {},
        "httpMethod": "POST"
      },
      "typeVersion": 2.1
    },
    {
      "id": "f9a62170-9da2-494a-8465-d2adee785f01",
      "name": "Flatten AI Output for Downstream Use",
      "type": "n8n-nodes-base.code",
      "position": [
        784,
        -144
      ],
      "parameters": {
        "jsCode": "return [\n  {\n    json: {\n      ...$json.output\n    }\n  }\n];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "083b65e8-f773-41c6-800b-3a11aaf3db4a",
      "name": "Map SEO Fields for UI & Reporting",
      "type": "n8n-nodes-base.code",
      "position": [
        1040,
        -144
      ],
      "parameters": {
        "jsCode": "return [\n  {\n    json: {\n      // Core identifiers\n      keyword: $json.keyword,\n      country: $json.country,\n\n      // Fields UI is clearly expecting\n      search_intent: $json.seo_summary?.search_intent || \"\",\n      competition: $json.seo_summary?.competition_level || \"\",\n      serp_features: $json.seo_summary?.serp_features || [],\n\n      // Main sections\n      content_gaps: $json.content_gaps || [],\n      content_opportunities: $json.content_opportunities || [],\n      recommended_content_types: $json.recommended_content_types || [],\n\n      // CRITICAL: UI confidence binding\n      confidence: $json.confidence_score || \"Not determined\"\n    }\n  }\n];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "e1f82952-7f6a-4ad2-b11f-eece2be80f42",
      "name": "Generate Client-Ready SEO Insights Email (AI)",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1344,
        -144
      ],
      "parameters": {
        "text": "=Create a professional SEO Content Opportunity email summary using the following data.\n\nInclude these sections:\n1. Keyword & Country\n2. Search Intent (short paragraph)\n3. Competition Level (clear and direct)\n4. Key Content Gaps (bullet list)\n5. Top Content Opportunities (title + short description + difficulty)\n6. Recommended Content Formats\n7. Overall Confidence Score\n\nFormat the output as clean HTML with headings, bullet points, and spacing suitable for email.\n\nSEO Analysis Data:\n{{ JSON.stringify($json, null, 2) }}\n",
        "options": {
          "systemMessage": "=You are a senior SEO consultant writing professional client-ready email reports.\n\nYour task:\n- Summarize the provided SEO analysis clearly and concisely\n- Use a clean, visually structured HTML format\n- Keep the tone professional, clear, and business-friendly\n- Do NOT include raw JSON\n- Do NOT mention AI, prompts, or internal processes\n\nThe output must be valid HTML suitable for email.\n"
        },
        "promptType": "define"
      },
      "typeVersion": 2
    },
    {
      "id": "26b1d7e3-8802-420f-9ba2-e3c44f2ebc80",
      "name": "LLM Engine for Insight Formatting",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        1328,
        64
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o",
          "cachedResultName": "gpt-4o"
        },
        "options": {},
        "responsesApiEnabled": false
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "efb57a55-2f4e-4dca-bbca-928419c5c8ad",
      "name": "Send SEO Opportunity Report via Email",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1760,
        -144
      ],
      "parameters": {
        "toList": [
          "user@example.com"
        ],
        "message": "=SEO Content Opportunity Analyzer",
        "subject": "=SEO Content Opportunity Analyzer",
        "resource": "message",
        "htmlMessage": "={{ $json.output }}",
        "includeHtml": true,
        "additionalFields": {
          "ccList": []
        }
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "f2837049-ecb2-4cc3-81ae-3a98abedbbb0",
      "name": "Log SEO Analysis Result to Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1744,
        -384
      ],
      "parameters": {
        "columns": {
          "value": {
            "Country": "={{ $json.country }}",
            "Keyword": "={{ $json.keyword }}",
            "Timestamp": "={{$now}}",
            "Confidence": "={{ $json.confidence }}",
            "Competition": "={{ $json.competition }}",
            "Content Gaps": "={{ $json.content_gaps }}",
            "Opportunities": "={{ $json.content_opportunities }}",
            "Search Intent": "={{ $json.search_intent }}"
          },
          "schema": [
            {
              "id": "Timestamp",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Timestamp",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Keyword",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Keyword",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Country",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Country",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Search Intent",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Search Intent",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Competition",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Competition",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Confidence",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Confidence",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Content Gaps",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Content Gaps",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Opportunities",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Opportunities",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Trigger Source",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "Trigger Source",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 843782431,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/17rcNd_ZpUQLm0uWEVbD-NY6GyFUkrD4BglvawlyBygM/edit#gid=843782431",
          "cachedResultName": "SEO Content Opportunity log"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "17rcNd_ZpUQLm0uWEVbD-NY6GyFUkrD4BglvawlyBygM",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/17rcNd_ZpUQLm0uWEVbD-NY6GyFUkrD4BglvawlyBygM/edit?usp=drivesdk",
          "cachedResultName": "sample_leads_50"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "5547e9eb-519e-4499-af7b-c0a8b065189a",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1552,
        -864
      ],
      "parameters": {
        "width": 704,
        "height": 416,
        "content": "## \ud83d\udd0d SEO Keyword & Content Gap Analysis Workflow (Loveable UI)\nThis workflow automates keyword-level SEO research and content opportunity\nanalysis using live Google SERP data and AI-driven insights.\n\nThe workflow starts by receiving a keyword via webhook \u2192 performs a\nGoogle SERP search focused on India \u2192 normalizes raw SERP results into a\nclean SEO dataset \u2192 uses GPT-4o to analyze search intent, competition level,\ncontent gaps, and high-impact content opportunities.\n\nThe analyzed output is then reshaped for UI consumption, logged into\nGoogle Sheets for tracking and audits, converted into a client-ready\nHTML email report, and delivered via Gmail.\n\nThis system eliminates manual SEO research, ensures consistent analysis,\nand produces actionable, presentation-ready insights for marketers,\ncontent teams, and clients.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "bdc51543-d43a-45b1-9503-c7de2b6d489e",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -720,
        -384
      ],
      "parameters": {
        "color": 7,
        "width": 432,
        "height": 480,
        "content": "## \ud83d\udce5 SEO Keyword Intake\nReceives and prepares the keyword for analysis.\n\n\u2022 Receive SEO Keyword Analysis Request  \n  Accepts a POST webhook containing the target keyword.\n\n\u2022 Extract Keyword from Request Payload  \n  Cleans and isolates the keyword field for SERP analysis.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "e327e722-9785-4fe8-8aa2-9939c5693766",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -224,
        -464
      ],
      "parameters": {
        "color": 7,
        "height": 544,
        "content": "## \ud83c\udf10 Google SERP Data Collection (India)\nFetches real-time search engine results.\n\n\u2022 Run Google SERP Search for Keyword (India)  \n  Executes a Google search via SerpAPI, returning organic results,\n  related searches, and video signals.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "d0a13704-7729-4fd5-9793-7d4fb590d133",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        64,
        -512
      ],
      "parameters": {
        "color": 7,
        "height": 576,
        "content": "## \ud83e\uddf9 SERP Normalization & SEO Dataset Creation\nTransforms raw SERP data into an analysis-ready format.\n\n\u2022 Normalize SERP Results into SEO Dataset  \n  Extracts organic rankings, snippets, sources, videos, and\n  related searches into a structured SEO dataset.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "8b7fd4af-1dc2-4fc6-b430-9e77f714ff62",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        320,
        -544
      ],
      "parameters": {
        "color": 7,
        "width": 400,
        "height": 832,
        "content": "## \ud83e\udde0 AI SEO Opportunity & Gap Analysis\nAnalyzes keyword competitiveness and content gaps.\n\n\u2022 Analyze Keyword SEO Opportunities (AI)  \n  Uses GPT-4o to determine:\n  - Search intent\n  - Competition level\n  - Content gaps\n  - High-impact content opportunities\n  - Recommended content formats\n\n\u2022 Parse Market Analysis Output JSON  \n  Validates and enforces structured AI output schema.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "7d0a33c2-60cf-4ec3-90b5-41e7b1ec1f8e",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        752,
        -432
      ],
      "parameters": {
        "color": 7,
        "width": 464,
        "height": 544,
        "content": "## \ud83d\udd04 Output Preparation for UI & Reporting\nPrepares AI results for downstream systems.\n\n\u2022 Flatten AI Output for Downstream Use  \n  Removes nested structures from AI output.\n\n\u2022 Map SEO Fields for UI & Reporting  \n  Aligns SEO fields to UI-friendly keys and reporting requirements,\n  including confidence scoring.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "70f53cc9-5fc7-4afd-86bf-550d78e73d65",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1264,
        -592
      ],
      "parameters": {
        "color": 7,
        "width": 336,
        "height": 816,
        "content": "## \ud83d\udce7 Client-Ready SEO Insight Report\nCreates professional, presentation-ready summaries.\n\n\u2022 Generate Client-Ready SEO Insights Email (AI)  \n  Converts SEO insights into a clean HTML email with:\n  - Search intent\n  - Competition\n  - Content gaps\n  - Opportunities\n  - Recommended formats\n\n\u2022 LLM Engine for Insight Formatting  \n  Provides GPT-4o for professional email-quality output.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "b1fc1e6f-3de1-48fb-a61e-22e2355a64c2",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1648,
        -736
      ],
      "parameters": {
        "color": 7,
        "width": 320,
        "height": 848,
        "content": "## \ud83d\udce4 Distribution & Audit Logging\nDelivers and stores SEO insights.\n\n\u2022 Send SEO Opportunity Report via Email  \n  Sends the final SEO opportunity report to the configured recipient.\n\n\u2022 Log SEO Analysis Result to Google Sheets  \n  Stores keyword, intent, competition, confidence, and opportunities\n  for tracking, audits, and historical analysis.\n"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "e3252b06-0159-40c4-a9e9-035abbd29f59",
  "connections": {
    "Error Handler Trigger": {
      "main": [
        [
          {
            "node": "Slack: Send Error Alert",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "LLM Engine for Insight Formatting": {
      "ai_languageModel": [
        [
          {
            "node": "Generate Client-Ready SEO Insights Email (AI)",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Map SEO Fields for UI & Reporting": {
      "main": [
        [
          {
            "node": "Generate Client-Ready SEO Insights Email (AI)",
            "type": "main",
            "index": 0
          },
          {
            "node": "Log SEO Analysis Result to Google Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse Market Analysis Output JSON": {
      "ai_outputParser": [
        [
          {
            "node": "Analyze Keyword SEO Opportunities (AI)",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Extract Keyword from Request Payload": {
      "main": [
        [
          {
            "node": "Run Google SERP Search for Keyword (India)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Flatten AI Output for Downstream Use": {
      "main": [
        [
          {
            "node": "Map SEO Fields for UI & Reporting",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Receive SEO Keyword Analysis Request": {
      "main": [
        [
          {
            "node": "Extract Keyword from Request Payload",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Analyze Keyword SEO Opportunities (AI)": {
      "main": [
        [
          {
            "node": "Flatten AI Output for Downstream Use",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Normalize SERP Results into SEO Dataset": {
      "main": [
        [
          {
            "node": "Analyze Keyword SEO Opportunities (AI)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Run Google SERP Search for Keyword (India)": {
      "main": [
        [
          {
            "node": "Normalize SERP Results into SEO Dataset",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "LLM Engine for Market Intelligence Analysis": {
      "ai_languageModel": [
        [
          {
            "node": "Analyze Keyword SEO Opportunities (AI)",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Generate Client-Ready SEO Insights Email (AI)": {
      "main": [
        [
          {
            "node": "Send SEO Opportunity Report via Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}