{
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "55979fca-6abb-43f2-af9a-59f2cacaeb51",
      "name": "On form submission",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        0,
        0
      ],
      "parameters": {
        "options": {},
        "formTitle": "Keyword  Analysis ",
        "formFields": {
          "values": [
            {
              "fieldLabel": "country",
              "requiredField": true
            },
            {
              "fieldLabel": "keyword",
              "requiredField": true
            }
          ]
        },
        "formDescription": "Keyword  Analysis "
      },
      "typeVersion": 2.2
    },
    {
      "id": "00963262-4328-4998-a996-b12d98f1badb",
      "name": "Re format output",
      "type": "n8n-nodes-base.code",
      "position": [
        520,
        0
      ],
      "parameters": {
        "jsCode": "return $input.first().json.data.semrushAPI.broadMatchKeywords;"
      },
      "typeVersion": 2
    },
    {
      "id": "47be20f6-5340-4d42-af21-bff7faf046ec",
      "name": "Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        840,
        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": "keywordsSerpFeatures",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "keywordsSerpFeatures",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "numberOfResults",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "numberOfResults",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "searchVolume",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "searchVolume",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "trends",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "trends",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "keywordDifficultyIndex",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "keywordDifficultyIndex",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "intent",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "intent",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "autoMapInputData",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 150500408,
          "cachedResultUrl": "",
          "cachedResultName": "keyword"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "",
          "cachedResultUrl": "",
          "cachedResultName": "Seo n8n"
        },
        "authentication": "serviceAccount"
      },
      "credentials": {
        "googleApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "2ec4b6b3-d8e0-4afd-8230-05604e85a258",
      "name": "Keyword Analysis",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        300,
        0
      ],
      "parameters": {
        "url": "https://keyword-research-tool3.p.rapidapi.com/keyword-tool.php",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "contentType": "multipart-form-data",
        "sendHeaders": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "country",
              "value": "={{ $json.country }}"
            },
            {
              "name": "keyword",
              "value": "={{ $json.keyword }}"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "x-rapidapi-host",
              "value": "keyword-research-tool3.p.rapidapi.com"
            },
            {
              "name": "x-rapidapi-key",
              "value": "your key"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "eaa1c076-3d65-41a6-934f-b7114f86de70",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -820,
        -520
      ],
      "parameters": {
        "width": 640,
        "height": 980,
        "content": "  \n## **\"Automated Keyword Analysis and Google Sheets Logging with n8n\"**\n\n**Description:**  \n\"Automate keyword research with n8n and log essential SEO data like search volume, trends, competition, and keyword difficulty directly into Google Sheets. Simplify your SEO efforts with real-time insights.\"\n\n## Node-by-Node Explanation\n\n### 1. **On form submission (Trigger)**\n- **Purpose:** This node triggers the workflow when the user submits the form with \"country\" and \"keyword\" as inputs.\n- **Explanation:** It initiates the process by accepting user input from the form and passing it to the next node for analysis.\n\n### 2. **Keyword Analysis (HTTP Request)**\n- **Purpose:** Sends a request to an external SEO API to analyze the provided keyword, fetching data like search volume, trends, and competition.\n- **Explanation:** It calls the keyword analysis API with the form input (country and keyword) and retrieves relevant keyword data.\n\n### 3. **Re-format output (Code)**\n- **Purpose:** Processes and reformats the API response into a structured format suitable for logging into Google Sheets.\n- **Explanation:** It extracts and organizes the keyword data (like competition, CPC, etc.) into a format that can be mapped to Google Sheets columns.\n\n### 4. **Google Sheets (Append)**\n- **Purpose:** Appends the reformatted keyword data into the specified Google Sheets document.\n- **Explanation:** Logs the fetched keyword insights (like search volume, trends, competition, etc.) into a Google Sheets document for ongoing analysis.\n\n---\n\n## Summary\nThis workflow automates the process of keyword research by collecting input through a form, querying an SEO API for detailed keyword insights, and logging that data into a Google Sheet for easy tracking and analysis. It simplifies the process of keeping track of important SEO metrics for your targeted keywords.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "fca5eb74-cc39-45b0-82c1-efc8d00c2df6",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -60,
        -260
      ],
      "parameters": {
        "height": 420,
        "content": "**On form submission (Trigger)**\n- **Purpose:** This node triggers the workflow when the user submits the form with \"country\" and \"keyword\" as inputs.\n- **Explanation:** It initiates the process by accepting user input from the form and passing it to the next node for analysis.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "e3a571a3-3fd8-478c-8b98-24ac8338a36e",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        200,
        -260
      ],
      "parameters": {
        "height": 420,
        "content": "**Keyword Analysis (HTTP Request)**\n- **Purpose:** Sends a request to an external SEO API to analyze the provided keyword, fetching data like search volume, trends, and competition.\n- **Explanation:** It calls the keyword analysis API with the form input (country and keyword) and retrieves relevant keyword data.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "83e2f234-03c1-40f7-b696-15bf9ff371ef",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        460,
        -260
      ],
      "parameters": {
        "height": 420,
        "content": "**Re-format output (Code)**\n- **Purpose:** Processes and reformats the API response into a structured format suitable for logging into Google Sheets.\n- **Explanation:** It extracts and organizes the keyword data (like competition, CPC, etc.) into a format that can be mapped to Google Sheets columns.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "beee2895-71ef-4ce4-9e2f-8e9fd847f101",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        740,
        -260
      ],
      "parameters": {
        "height": 420,
        "content": "**Google Sheets (Append)**\n- **Purpose:** Appends the reformatted keyword data into the specified Google Sheets document.\n- **Explanation:** Logs the fetched keyword insights (like search volume, trends, competition, etc.) into a Google Sheets document for ongoing analysis.\n\n---"
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "Keyword Analysis": {
      "main": [
        [
          {
            "node": "Re format output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Re format output": {
      "main": [
        [
          {
            "node": "Google Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "On form submission": {
      "main": [
        [
          {
            "node": "Keyword Analysis",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}