{
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "6df0fc87-64cd-4ed2-8c13-94a26e54f0f4",
      "name": "On form submission",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        0,
        0
      ],
      "parameters": {
        "options": {},
        "formTitle": "Competitor Keyword Analysis",
        "formFields": {
          "values": [
            {
              "fieldLabel": "website",
              "requiredField": true
            },
            {
              "fieldLabel": "country",
              "placeholder": "in",
              "requiredField": true
            }
          ]
        },
        "formDescription": "Competitor Keyword Analysis"
      },
      "typeVersion": 2.2
    },
    {
      "id": "1a919bd5-3046-4e85-abda-603cd9e46a1a",
      "name": "Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        800,
        0
      ],
      "parameters": {
        "columns": {
          "value": {},
          "schema": [
            {
              "id": "competition",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "competition",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "cpc",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "cpc",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "keyword",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "keyword",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "numberOfResults",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "numberOfResults",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "position",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "position",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "positionDifference",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "positionDifference",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "previousPosition",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "previousPosition",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "searchVolume",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "searchVolume",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "trafficPercent",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "trafficPercent",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "trafficCostPercent",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "trafficCostPercent",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "trends",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "trends",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "keywordDifficulty",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "keywordDifficulty",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "autoMapInputData",
          "matchingColumns": [
            "row_number"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "url",
          "value": ""
        },
        "authentication": "serviceAccount"
      },
      "credentials": {
        "googleApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "e66cb1b0-82db-4c3e-9d88-7c8d3d164822",
      "name": "Competitor Keyword Analysis",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        260,
        0
      ],
      "parameters": {
        "url": "https://competitor-keyword-analysis.p.rapidapi.com/web-keyoword-tool.php",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "contentType": "multipart-form-data",
        "sendHeaders": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "website",
              "value": "={{ $json.website }}"
            },
            {
              "name": "country",
              "value": "={{ $json.country }}"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "x-rapidapi-host",
              "value": "competitor-keyword-analysis.p.rapidapi.com"
            },
            {
              "name": "x-rapidapi-key",
              "value": "your key"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "53499d16-8b32-49ce-97e5-96260568234a",
      "name": "Reformat Code",
      "type": "n8n-nodes-base.code",
      "position": [
        540,
        0
      ],
      "parameters": {
        "jsCode": "return $input.first().json.data.semrushAPI.domainOrganicSearchKeywords;"
      },
      "typeVersion": 2
    },
    {
      "id": "d3f84fa1-a176-442c-a761-6c1c1f446362",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -80,
        -200
      ],
      "parameters": {
        "height": 400,
        "content": " **\ud83d\udcdd On form submission (`formTrigger`)**  \n   Captures user input (`website` and `country`) when the form is submitted to initiate the workflow.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "28e57f59-de22-4202-93ff-1e016a959fb5",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1220,
        -400
      ],
      "parameters": {
        "width": 1000,
        "height": 1160,
        "content": "# \ud83d\udd0d Competitor Keyword Analysis & Reporting Workflow\n\n## \ud83d\udcc4 Description\nThis workflow automates competitor keyword analysis by capturing user input via a form, querying a keyword analysis API, transforming the returned data, and saving it to Google Sheets for future SEO tracking and decision-making.\n\n---\n\n## \ud83e\udde9 Node-by-Node Breakdown\n\n1. **\ud83d\udcdd On form submission (`formTrigger`)**  \n   Captures user input (`website` and `country`) when the form is submitted to initiate the workflow.\n\n2. **\ud83c\udf10 Competitor Keyword Analysis (`httpRequest`)**  \n   Sends a POST request to the Competitor Keyword Analysis API using the submitted website and country to fetch SEO keyword data.\n\n3. **\ud83d\udd04 Reformat Code (`code`)**  \n   Extracts the relevant `domainOrganicSearchKeywords` data from the API response for easier processing and storage.\n\n4. **\ud83d\udcca Google Sheets (`googleSheets`)**  \n   Appends the formatted keyword data into a specified Google Sheet for tracking, reporting, and analysis.\n\n---\n\n## \ud83d\udccc Key Features\n\n- User-friendly form-based data input  \n- Seamless API integration via RapidAPI  \n- Data transformation using JavaScript  \n- Google Sheets logging for long-term analysis  \n\n---\n\n## \ud83d\udcc1 Output Example (Google Sheets)\n\n| keyword       | searchVolume | cpc | competition | position | ... |\n|---------------|--------------|-----|-------------|----------|-----|\n| example term  | 9900         | 2.3 | 0.87        | 5        | ... |\n\n---\n\n## \u2705 Use Case\nIdeal for marketers, SEO analysts, and agencies who want to track competitor keyword data efficiently and in real time without manual data entry.\n\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "ab39b34c-4e33-4325-9641-1e9221936eed",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        200,
        -200
      ],
      "parameters": {
        "height": 400,
        "content": "**\ud83c\udf10 Competitor Keyword Analysis (`httpRequest`)**  \n   Sends a POST request to the Competitor Keyword Analysis API using the submitted website and country to fetch SEO keyword data.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "3b80d196-f33a-4df3-ab7c-e0a78cae876d",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        460,
        -200
      ],
      "parameters": {
        "height": 400,
        "content": "**\ud83d\udd04 Reformat Code (`code`)**  \n   Extracts the relevant `domainOrganicSearchKeywords` data from the API response for easier processing and storage.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "d6127aac-de48-4427-8881-4d493c61b156",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        720,
        -200
      ],
      "parameters": {
        "height": 400,
        "content": "**\ud83d\udcca Google Sheets (`googleSheets`)**  \n   Appends the formatted keyword data into a specified Google Sheet for tracking, reporting, and analysis.\n"
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "Reformat Code": {
      "main": [
        [
          {
            "node": "Google Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "On form submission": {
      "main": [
        [
          {
            "node": "Competitor Keyword Analysis",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Competitor Keyword Analysis": {
      "main": [
        [
          {
            "node": "Reformat Code",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}