{
  "name": "Job Pipeline - Phase 1",
  "nodes": [
    {
      "parameters": {},
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        0,
        0
      ],
      "id": "c9f3e062-4f5c-439f-95a7-ed2f5b69d1ed",
      "name": "When clicking \u2018Execute workflow\u2019"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "http://jobspy:8000/scrape",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "{\n  \"search_term\": \"Data Analyst\",\n  \"location\": \"Dublin, Ireland\",\n  \"sites\": [\"indeed\", \"linkedin\"],\n  \"results_wanted\": 10,\n  \"hours_old\": 168,\n  \"role_family\": \"Data\",\n  \"save_csv\": true\n}",
        "options": {
          "timeout": 300000
        }
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.4,
      "position": [
        208,
        0
      ],
      "id": "609a3975-30ec-49bc-bd1d-41b815c2efe0",
      "name": "HTTP Request"
    },
    {
      "parameters": {
        "jsCode": "// Extract jobs from HTTP response and emit one item per row\n// matching the Google Sheet column headers exactly.\n\nconst response = $input.first().json;\nconst jobs = response.jobs || [];\nconst scrapedAt = response.scraped_at;\n\nreturn jobs.map(job => ({\n  json: {\n    scraped_at: scrapedAt,\n    role_family: job.role_family || '',\n    site: job.site || '',\n    title: job.title || '',\n    company: job.company || '',\n    location: job.location || '',\n    date_posted: job.date_posted || '',\n    is_remote: job.is_remote === true ? 'TRUE' : 'FALSE',\n    job_url: job.job_url || '',\n    min_amount: job.min_amount || '',\n    max_amount: job.max_amount || '',\n    currency: job.currency || '',\n    search_term: job.search_term || '',\n  },\n}));"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        416,
        0
      ],
      "id": "1c08f75a-6bc7-4f2a-a4ee-d8c389837e8d",
      "name": "Code in JavaScript"
    },
    {
      "parameters": {
        "operation": "append",
        "documentId": {
          "__rl": true,
          "value": "https://docs.google.com/spreadsheets/d/1Z3qbKjYuKA1EFids9QYppzjuaiMf9quxN8hw_chZhfM/edit?gid=0#gid=0",
          "mode": "url"
        },
        "sheetName": {
          "__rl": true,
          "value": "gid=0",
          "mode": "list",
          "cachedResultName": "Sheet1",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1Z3qbKjYuKA1EFids9QYppzjuaiMf9quxN8hw_chZhfM/edit#gid=0"
        },
        "columns": {
          "mappingMode": "autoMapInputData",
          "value": {},
          "matchingColumns": [],
          "schema": [
            {
              "id": "scraped_at",
              "displayName": "scraped_at",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "role_family",
              "displayName": "role_family",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "site",
              "displayName": "site",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "title",
              "displayName": "title",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "company",
              "displayName": "company",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "location",
              "displayName": "location",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "date_posted",
              "displayName": "date_posted",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "is_remote",
              "displayName": "is_remote",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "job_url",
              "displayName": "job_url",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "min_amount",
              "displayName": "min_amount",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "max_amount",
              "displayName": "max_amount",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "currency",
              "displayName": "currency",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "search_term",
              "displayName": "search_term",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.7,
      "position": [
        624,
        0
      ],
      "id": "de02ed86-cc4f-4e8d-8227-020469342c4d",
      "name": "Append row in sheet",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      }
    }
  ],
  "connections": {
    "When clicking \u2018Execute workflow\u2019": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request": {
      "main": [
        [
          {
            "node": "Code in JavaScript",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code in JavaScript": {
      "main": [
        [
          {
            "node": "Append row in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1",
    "binaryMode": "separate"
  },
  "versionId": "b4b75296-4e04-45aa-8e7e-eff6260231c9",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "id": "f2xuFZxItrETLZlo",
  "tags": []
}