{
  "id": "49jPs7OkPU0PqODZ",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "07 - Automated Job Curation Engine",
  "tags": [],
  "nodes": [
    {
      "id": "c4d4a93c-2aca-4090-88b7-3b8e75ed7984",
      "name": "\u23f0 Schedule: Trigger Every Day",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -340,
        440
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "triggerAtHour": 9
            }
          ]
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "32968ac3-397b-419c-a3f4-fd8192030515",
      "name": "\ud83d\udcc4 Read Pending Job Role from Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -120,
        440
      ],
      "parameters": {
        "options": {
          "returnFirstMatch": true
        },
        "filtersUI": {
          "values": [
            {
              "lookupValue": "Pending",
              "lookupColumn": "Status"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/{{Your_Sheet_ID}}/edit#gid=0",
          "cachedResultName": "Your_Sheet_No"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/{{Your_Sheet_ID}}/edit?usp=drivesdk",
          "cachedResultName": "Job Scraper"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "f5f29814-a6b2-4178-a84b-9646130340d8",
      "name": "\ud83c\udf10 Search Jobs via JSearch API",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        100,
        440
      ],
      "parameters": {
        "url": "https://jsearch.p.rapidapi.com/search",
        "options": {},
        "sendQuery": true,
        "sendHeaders": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "query",
              "value": "={{ $json.Position + ' in ' + $json.Location }}"
            },
            {
              "name": "page",
              "value": "1"
            },
            {
              "name": "num_pages",
              "value": "1"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "X-RapidAPI-Key",
              "value": "YOUR_RAPIDAPI_KEY"
            },
            {
              "name": "X-RapidAPI-Host",
              "value": "jsearch.p.rapidapi.com"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "cfd205db-f9b1-4906-8b42-3529a7d7bffe",
      "name": "\ud83e\udde0 Extract Job Data from API Response",
      "type": "n8n-nodes-base.code",
      "position": [
        320,
        440
      ],
      "parameters": {
        "jsCode": "const allItems = [];\n\nfor (const item of items) {\n  const jobs = item.json.data || [];\n  for (const job of jobs) {\n    allItems.push({\n      json: {\n        title: job.job_title,\n        company: job.employer_name,\n        location: `${job.job_city}, ${job.job_country}`,\n        apply_link: job.job_apply_link,\n        is_remote: job.job_is_remote,\n        posted_date: job.job_posted_at_datetime_utc,\n      }\n    });\n  }\n}\n\nreturn allItems;"
      },
      "typeVersion": 2
    },
    {
      "id": "a54cfdfd-b0f9-4027-9309-3aae34ff3564",
      "name": "\ud83d\udd0d Filter Valid Job Listings",
      "type": "n8n-nodes-base.filter",
      "position": [
        540,
        440
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "579057db-1ec8-4a3b-8dca-7169d9699521",
              "operator": {
                "type": "string",
                "operation": "exists",
                "singleValue": true
              },
              "leftValue": "={{ $json.title }}",
              "rightValue": "="
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "bdd89987-6256-408b-8bd5-0cd0154dd300",
      "name": "\ud83d\udcca Write Jobs to Output Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        760,
        440
      ],
      "parameters": {
        "columns": {
          "value": {
            "Title": "={{ $json.title }}",
            "Company": "={{ $json.company }}",
            "Location": "={{ $json.location }}",
            "Is Remote": "={{ $json.is_remote }}",
            "Posted On": "={{ $json.posted_date }}",
            "Apply Link": "={{ $json.apply_link }}"
          },
          "schema": [
            {
              "id": "Title",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Title",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Company",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Company",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Location",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Location",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Apply Link",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Apply Link",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Is Remote",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Is Remote",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Posted On",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Posted On",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Apply Link"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/{{Your_Sheet_ID}}/edit#gid=0",
          "cachedResultName": "Your_Sheet_No"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "Your_Sheet_ID",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/{{Your_Sheet_ID}}/edit?usp=drivesdk",
          "cachedResultName": "Job Listing"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "b834f983-9319-4c96-bf9f-7adbee871647",
      "name": "\u2705 Mark Job as Scraped in Source Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        980,
        440
      ],
      "parameters": {
        "columns": {
          "value": {
            "Status": "Scraped",
            "row_number": "={{ $('\ud83d\udcc4 Read Pending Job Role from Sheet').item.json.row_number }}"
          },
          "schema": [
            {
              "id": "Position",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Position",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Location",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Location",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Status",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": true,
              "required": false,
              "displayName": "row_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "row_number"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/{{Your_Sheet_ID}}/edit#gid=0",
          "cachedResultName": "Your_Sheet_No"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/{{Your_Sheet_ID}}/edit?usp=drivesdk",
          "cachedResultName": "Job Scraper"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "executeOnce": true,
      "typeVersion": 4.6
    },
    {
      "id": "b9c7a999-6c09-48e5-aea8-b5a14e30ed51",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -380,
        200
      ],
      "parameters": {
        "width": 420,
        "height": 520,
        "content": "## Trigger & Input\n\n\u2022 Triggers the workflow on a defined hourly interval.\n\u2022 Fetches a single row from the \"Job Scraper\" sheet where Status = \"Pending\".\n\u2022 This row includes 'Position' and 'Location' values for the job search.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "c987a1d7-03a7-40b1-99d3-57d9049b3c32",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        80,
        200
      ],
      "parameters": {
        "color": 3,
        "width": 620,
        "height": 520,
        "content": "## Job Search & Processing\n\n\u2022 Sends query (Position + Location) to the JSearch API.\n\u2022 Parses the API response and extracts individual job listings.\n\u2022 Filters out empty or invalid results to ensure clean output.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "8c5c5acc-6b1b-4ece-b4c2-af47bda1ecd2",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        720,
        200
      ],
      "parameters": {
        "color": 4,
        "width": 460,
        "height": 520,
        "content": "## Output & Status Update\n\n\u2022 Writes valid jobs to the \"Job Listing\" sheet with fields like title, location, company, etc.\n\u2022 Marks the original row in the source sheet as \"Scraped\" using the row number for tracking.\n"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "5e71e30c-da84-4500-bea9-ce72b5596424",
  "connections": {
    "\ud83d\udd0d Filter Valid Job Listings": {
      "main": [
        [
          {
            "node": "\ud83d\udcca Write Jobs to Output Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u23f0 Schedule: Trigger Every Day": {
      "main": [
        [
          {
            "node": "\ud83d\udcc4 Read Pending Job Role from Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\ud83d\udcca Write Jobs to Output Sheet": {
      "main": [
        [
          {
            "node": "\u2705 Mark Job as Scraped in Source Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\ud83c\udf10 Search Jobs via JSearch API": {
      "main": [
        [
          {
            "node": "\ud83e\udde0 Extract Job Data from API Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\ud83d\udcc4 Read Pending Job Role from Sheet": {
      "main": [
        [
          {
            "node": "\ud83c\udf10 Search Jobs via JSearch API",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\ud83e\udde0 Extract Job Data from API Response": {
      "main": [
        [
          {
            "node": "\ud83d\udd0d Filter Valid Job Listings",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}