{
  "id": "jpHiringSignals1",
  "name": "JobsPipe: weekly company hiring signals",
  "nodes": [
    {
      "parameters": {
        "content": "## JobsPipe: company hiring signals, weekly\n\n1. Create a **Header Auth** credential named `JobsPipe API`: name `Authorization`, value `Bearer jp_live_...`.\n2. List your accounts in **Companies to watch**. `company_name_or` is an exact match on the company name; switch the body to `company_name_partial_match_or` for a contains match.\n3. Pick your spreadsheet in **Log to Google Sheets**. Row 1 needs `week_of`, `company`, `new_roles_7d`, `latest_title`, `latest_url`.\n\nEach company is one call with `limit: 1` and `include_total_results: true`: the count of postings from the last 7 days comes back in `metadata.total_results` and you pay for the single job returned (1 credit per company per run at most, 0 when nothing matched).",
        "height": 400,
        "width": 620
      },
      "id": "ba333688-dfce-5dc2-9fea-10fe81acfe06",
      "name": "About this template",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -260,
        -460
      ]
    },
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "weeks",
              "triggerAtDay": [
                1
              ],
              "triggerAtHour": 8
            }
          ]
        }
      },
      "id": "1678679b-e4a9-5c53-aeb8-d577b58d95a5",
      "name": "Every Monday at 08:00",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [
        0,
        0
      ]
    },
    {
      "parameters": {
        "jsCode": "const companies = [\n  'Stripe',\n  'Datadog',\n  'Snowflake',\n];\nreturn companies.map((company) => ({ json: { company } }));"
      },
      "id": "0e3f1074-55a7-5adc-b371-a3d9a278a113",
      "name": "Companies to watch",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        220,
        0
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.jobspipe.dev/v1/jobs/search",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n  \"company_name_or\": {{ JSON.stringify([$json.company]) }},\n  \"posted_at_max_age_days\": 7,\n  \"include_total_results\": true,\n  \"limit\": 1\n}",
        "options": {
          "timeout": 60000,
          "batching": {
            "batch": {
              "batchSize": 1,
              "batchInterval": 600
            }
          }
        }
      },
      "id": "697b8af0-d4f4-5968-8eb5-07313a58ae4a",
      "name": "Count new roles",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        440,
        0
      ],
      "credentials": {
        "httpHeaderAuth": {
          "name": "JobsPipe API"
        }
      }
    },
    {
      "parameters": {
        "jsCode": "return $input.all().map((item, i) => {\n  const company = $('Companies to watch').all()[i].json.company;\n  const meta = item.json.metadata || {};\n  const latest = (item.json.data || [])[0] || {};\n  return {\n    json: {\n      week_of: $now.toUTC().toFormat('yyyy-MM-dd'),\n      company,\n      new_roles_7d: meta.total_results ?? 0,\n      latest_title: latest.job_title || '',\n      latest_url: latest.url || '',\n    },\n  };\n});"
      },
      "id": "5a8dc2de-3f0e-583e-8d2d-7326fd2d56c5",
      "name": "Summarize per company",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        660,
        0
      ]
    },
    {
      "parameters": {
        "authentication": "oAuth2",
        "operation": "append",
        "documentId": {
          "__rl": true,
          "value": "",
          "mode": "url"
        },
        "sheetName": {
          "__rl": true,
          "value": "gid=0",
          "mode": "list",
          "cachedResultName": "Sheet1"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "week_of": "={{ $json.week_of }}",
            "company": "={{ $json.company }}",
            "new_roles_7d": "={{ $json.new_roles_7d }}",
            "latest_title": "={{ $json.latest_title }}",
            "latest_url": "={{ $json.latest_url }}"
          },
          "matchingColumns": [],
          "schema": [
            {
              "id": "week_of",
              "displayName": "week_of",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "company",
              "displayName": "company",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "new_roles_7d",
              "displayName": "new_roles_7d",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "number",
              "canBeUsedToMatch": true
            },
            {
              "id": "latest_title",
              "displayName": "latest_title",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "latest_url",
              "displayName": "latest_url",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "id": "4771eb67-3d99-5eff-9ac5-0dea871654e1",
      "name": "Log to Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.5,
      "position": [
        880,
        0
      ],
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "Google Sheets account"
        }
      }
    }
  ],
  "connections": {
    "Every Monday at 08:00": {
      "main": [
        [
          {
            "node": "Companies to watch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Companies to watch": {
      "main": [
        [
          {
            "node": "Count new roles",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Count new roles": {
      "main": [
        [
          {
            "node": "Summarize per company",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Summarize per company": {
      "main": [
        [
          {
            "node": "Log to Google Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "pinData": {},
  "tags": []
}
