{
  "name": "google sheets",
  "nodes": [
    {
      "parameters": {},
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        -120,
        -100
      ],
      "id": "e795dbd8-f459-4381-982e-06e43b92ec8b",
      "name": "When clicking 'Test workflow'"
    },
    {
      "parameters": {
        "url": "https://api.hh.ru/vacancies",
        "options": {},
        "queryParametersUi": {
          "parameter": [
            {
              "name": "text",
              "value": "Go"
            },
            {
              "name": "per_page",
              "value": "15"
            },
            {
              "name": "schedule",
              "value": "remote"
            }
          ]
        }
      },
      "id": "34f22640-37dd-4733-bbe2-52a9c713768c",
      "name": "Get Vacancies",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        180,
        -120
      ]
    },
    {
      "parameters": {
        "functionCode": "const seen = new Set();\nreturn items[0].json.items\n  .filter(job => {\n    if (seen.has(job.id)) return false;\n    seen.add(job.id);\n    return true;\n  })\n  .map(job => {\n    return {\n      json: {\n        title: job.name,\n        company: job.employer.name,\n        url: job.alternate_url,\n        salary_from: job.salary ? job.salary.from : '',\n        salary_to: job.salary ? job.salary.to : '',\n        id: job.id\n      }\n    };\n  });"
      },
      "id": "2962cb28-14c8-46bc-a273-c1f11a6e2291",
      "name": "Format Vacancies",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        440,
        -120
      ]
    },
    {
      "parameters": {
        "url": "={{ 'https://api.hh.ru/vacancies/' + $json.id }}",
        "options": {},
        "responseFormat": "json"
      },
      "id": "a11d22b3-4c56-789d-ef01-234567890abc",
      "name": "Get Vacancy Details",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        920,
        -120
      ]
    },
    {
      "parameters": {
        "operation": "chatCompletion",
        "model": "gpt-3.5-turbo",
        "temperature": 0.0,
        "messagesUi": {
          "values": [
            {
              "role": "system",
              "content": "You are an assistant that determines if a job vacancy is for a Go developer. Respond with 'yes' or 'no'. Only output yes or no."
            },
            {
              "role": "user",
              "content": "Job description: {{$json.description}}"
            }
          ]
        }
      },
      "id": "b22e33c4-5d67-890e-f123-4567890abcde",
      "name": "Check Go Dev",
      "type": "n8n-nodes-base.openAi",
      "typeVersion": 1,
      "position": [
        1160,
        -120
      ],
      "credentials": {
        "openAIApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{$json.choices[0].message.content.trim().toLowerCase()}}",
              "operation": "equal",
              "value2": "yes"
            }
          ]
        }
      },
      "id": "c33f44d5-6e78-901f-2345-67890abcdef0",
      "name": "Filter Go",
      "type": "n8n-nodes-base.if",
      "typeVersion": 1,
      "position": [
        1400,
        -120
      ]
    },
    {
      "parameters": {
        "operation": "appendOrUpdate",
        "documentId": {
          "__rl": true,
          "value": "1DG3ICj_jAQ0OsDumJc5xwnkSumRFGtQ4spPBVG7X4bQ",
          "mode": "list",
          "cachedResultName": "\u0412\u0430\u043a\u0430\u043d\u0441\u0438\u0438 Go",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1DG3ICj_jAQ0OsDumJc5xwnkSumRFGtQ4spPBVG7X4bQ/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": "gid=0",
          "mode": "list",
          "cachedResultName": "\u041b\u0438\u0441\u04421",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1DG3ICj_jAQ0OsDumJc5xwnkSumRFGtQ4spPBVG7X4bQ/edit#gid=0"
        },
        "dataMode": "autoMapInputData",
        "columnToMatchOn": "id",
        "options": {}
      },
      "id": "37a0b279-9457-499d-8c4c-365f385a6476",
      "name": "Append to Google Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 3,
      "position": [
        680,
        -120
      ],
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      }
    }
  ],
  "connections": {
    "When clicking 'Test workflow'": {
      "main": [
        [
          {
            "node": "Get Vacancies",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Vacancies": {
      "main": [
        [
          {
            "node": "Format Vacancies",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Vacancies": {
      "main": [
        [
          {
            "node": "Get Vacancy Details",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Vacancy Details": {
      "main": [
        [
          {
            "node": "Check Go Dev",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Go Dev": {
      "main": [
        [
          {
            "node": "Filter Go",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter Go": {
      "main": [
        [
          {
            "node": "Append to Google Sheet",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "1b75f989-8767-446e-a2a0-316bb0965060",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "id": "jGFmy97WQZmLgXQZ",
  "tags": []
}