{
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "d70c3059-3f69-43da-8551-1e5fc00755a1",
      "name": "On form submission",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -820,
        -40
      ],
      "parameters": {
        "options": {},
        "formTitle": "SERP Keyword Ranking Checker",
        "formFields": {
          "values": [
            {
              "fieldLabel": "keyword",
              "placeholder": "e.g. labubu",
              "requiredField": true
            },
            {
              "fieldLabel": "Country",
              "placeholder": "e.g. us",
              "requiredField": true
            }
          ]
        },
        "formDescription": "Enter your keyword for research the market."
      },
      "typeVersion": 2.2
    },
    {
      "id": "9fa5e35f-6519-4107-8fa5-d62b9ed1b043",
      "name": "Global Storage",
      "type": "n8n-nodes-base.set",
      "position": [
        -520,
        -40
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "10714a4e-2be6-4167-aef5-afe30eebdc2b",
              "name": "keyword",
              "type": "string",
              "value": "={{ $json.keyword }}"
            },
            {
              "id": "6d160d8b-ab11-4f0a-a484-2e3f8f7f3033",
              "name": "country",
              "type": "string",
              "value": "={{ $json.Country }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "3b582bb8-9930-47d1-a07e-a5971c5c06c2",
      "name": "If",
      "type": "n8n-nodes-base.if",
      "position": [
        180,
        -20
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "3ec0a058-9e37-4363-a4da-b7937144be13",
              "operator": {
                "type": "array",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{ $json.data.semrushAPI.serpResults }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "4e5c4b34-02d0-4dab-9b17-51e0a2b4d9df",
      "name": "Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        960,
        -400
      ],
      "parameters": {
        "columns": {
          "value": {
            "Country": "={{ $('Global Storage').item.json.country }}",
            "Keyword": "={{ $('Global Storage').item.json.keyword }}",
            "Json data": "={{ $json.data.semrushAPI.serpResults }}"
          },
          "schema": [
            {
              "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": "Json data",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Json data",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": ""
        },
        "authentication": "serviceAccount"
      },
      "credentials": {
        "googleApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "fc7a635f-1c97-4844-ac37-5d689cf2d6dd",
      "name": "Wait",
      "type": "n8n-nodes-base.wait",
      "position": [
        540,
        140
      ],
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "f0ffdaa0-2409-4506-a348-1932f210ba6a",
      "name": "Google Sheets1",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1000,
        140
      ],
      "parameters": {
        "columns": {
          "value": {
            "Country": "={{ $('Global Storage').item.json.country }}",
            "Keyword": "={{ $('Global Storage').item.json.keyword }}",
            "Json data": "=No result found. Please try another keyword..."
          },
          "schema": [
            {
              "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": "Json data",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Json data",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": ""
        },
        "authentication": "serviceAccount"
      },
      "credentials": {
        "googleApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "47463c0d-1eaa-4460-8ec8-b95a7a17f898",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -880,
        -180
      ],
      "parameters": {
        "height": 300,
        "content": "### 1. \ud83d\udfe2 **On form submission**\n**Type:** `formTrigger`  \n**Description:** Triggers when a user submits the form with `Keyword` & `Country` fields.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "58784227-c465-4d57-9dc9-a1b40b7fc2c3",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -580,
        -180
      ],
      "parameters": {
        "height": 300,
        "content": "### 2. \ud83d\udce6 **Global Storage**\n**Type:** `set`  \n**Description:** Stores the website value from the form for use in later nodes.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "4e382014-0405-4289-ba2e-41d3e58ca803",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -280,
        -220
      ],
      "parameters": {
        "width": 300,
        "height": 360,
        "content": "### 3. \ud83c\udf10 **SERP Keyword Ranking Checker**\n**Type:** `httpRequest`  \n**Description:** Sends a POST request to the RapidAPI SERP Keyword Ranking Checker endpoint (`serp.php`) to get broad match keywords insights.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "dff6f500-2ed2-4196-84d2-aefaf634ba1a",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        80,
        -220
      ],
      "parameters": {
        "width": 300,
        "height": 340,
        "content": "### 4. \u2696\ufe0f **Condition Checking**\n**Type:** `if`  \n**Description:** Evaluates whether the response body contains non-empty data. If true, it proceeds down the \"true\" branch, otherwise it moves to the \"false\" branch for further actions. Ideal for handling conditional logic in workflows.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "673c5c34-42f4-4f07-b224-bc8de78048c3",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        440,
        -40
      ],
      "parameters": {
        "width": 340,
        "height": 320,
        "content": "### 7. \u23f3 **Wait Node (5-Second Interval)**\n**Type:** `wait`  \n**Description:** Introduces a 5-second delay in the workflow before moving to the next action. Ideal for controlling the flow of execution, pacing API calls, or ensuring sufficient time between operations.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "03234bef-6b97-4d00-b9a9-a9655420bf85",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        440,
        -440
      ],
      "parameters": {
        "width": 340,
        "height": 320,
        "content": "### 5. \u23f3 **Wait Node (5-Second Interval)**\n**Type:** `wait`  \n**Description:** Introduces a 5-second delay in the workflow before moving to the next action. Ideal for controlling the flow of execution, pacing API calls, or ensuring sufficient time between operations.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "ed8ccf20-02e0-4ab5-babb-c3ae1753b944",
      "name": "Wait1",
      "type": "n8n-nodes-base.wait",
      "position": [
        560,
        -260
      ],
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "3289f067-2f24-4a69-b914-bad51769d3a9",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        840,
        -200
      ],
      "parameters": {
        "width": 400,
        "height": 500,
        "content": "### 8. \ud83d\udcca **Google Sheets - Insert 'No result found' Record**\n**Type:** `googleSheets`  \n**Description:** This node inserts a record with the status \"No result found\" into a Google Sheet when no relevant data is found in the response body. Ideal for logging missing data, tracking errors, or maintaining a record of failed API requests.\n\n**Key Features:**\n- Automatically inserts \"Not Found\" when data is missing or unavailable.\n- Customizable to log specific fields or add default messages.\n- Can be used to maintain error tracking or data gaps in a structured sheet."
      },
      "typeVersion": 1
    },
    {
      "id": "64aa2d6a-4a17-4c3a-953a-23d05c8692cf",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        840,
        -740
      ],
      "parameters": {
        "width": 400,
        "height": 500,
        "content": "### 6. \ud83d\udcca **Google Sheets - Insert Record from Response Body**\n**Type:** `googleSheets`  \n**Description:** This node extracts data from the response body of a previous request and automatically inserts it into a specified Google Sheet. It allows for seamless data entry into your spreadsheet, making it ideal for logging, tracking, or storing information from API responses.\n\n**Key Features:**\n- Maps response body fields to sheet columns.\n- Supports multiple rows of data insertion.\n- Easily configurable with Google Sheets API credentials.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "d0986719-64ab-41bc-b553-8f48cffa1c01",
      "name": "SERP Keyword Ranking Checker",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -180,
        -40
      ],
      "parameters": {
        "url": "https://rapidapi.com/PrineshPatel/api/serp-keyword-ranking-checker",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "contentType": "multipart-form-data",
        "sendHeaders": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "keyword",
              "value": "={{ $json.keyword }}"
            },
            {
              "name": "country",
              "value": "={{ $json.country }}"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "x-rapidapi-host",
              "value": "serp-keyword-ranking-checker.p.rapidapi.com"
            },
            {
              "name": "x-rapidapi-key",
              "value": "your key"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "f9c591c5-4210-42e2-986e-00f7ff08b229",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -620,
        -840
      ],
      "parameters": {
        "width": 800,
        "height": 540,
        "content": "# \ud83d\udd0d SERP Keyword Ranking Checker with RapidAPI & Google Sheets\n**Automate keyword SERP ranking lookups** and log the data into Google Sheets using this no-code n8n workflow. Perfect for SEO professionals, digital marketers, or anyone tracking keyword visibility across regions.\n\n---\n\n## \ud83e\uddf0 Tools Used\n\n- [**n8n**](https://n8n.io/) \u2013 No-code automation platform\n- [**SERP Keyword Ranking Checker API** (by PrineshPatel on RapidAPI)](https://rapidapi.com/PrineshPatel/api/serp-keyword-ranking-checker) \u2013 Fetch real-time keyword SERP data\n- **Google Sheets** \u2013 Log keyword data for tracking, analysis, or client reporting\n\n---\n"
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "If": {
      "main": [
        [
          {
            "node": "Wait1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait": {
      "main": [
        [
          {
            "node": "Google Sheets1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait1": {
      "main": [
        [
          {
            "node": "Google Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Global Storage": {
      "main": [
        [
          {
            "node": "SERP Keyword Ranking Checker",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "On form submission": {
      "main": [
        [
          {
            "node": "Global Storage",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "SERP Keyword Ranking Checker": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}