{
  "name": "VerbatimCV: parse emailed CVs and route remote candidates",
  "nodes": [
    {
      "parameters": {
        "pollTimes": { "item": [{ "mode": "everyMinute" }] },
        "simple": false,
        "filters": { "q": "has:attachment (filename:pdf OR filename:docx)" },
        "options": { "downloadAttachments": true, "dataPropertyAttachmentsPrefixName": "attachment_" }
      },
      "id": "a1f0c5e2-0000-4000-8000-000000000001",
      "name": "New email with a CV",
      "type": "n8n-nodes-base.gmailTrigger",
      "typeVersion": 1.2,
      "position": [0, 0]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.verbatimcv.com/v1/parse",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpBearerAuth",
        "sendBody": true,
        "contentType": "multipart-form-data",
        "bodyParameters": {
          "parameters": [
            { "parameterType": "formBinaryData", "name": "file", "inputDataFieldName": "attachment_0" }
          ]
        },
        "options": { "timeout": 120000 }
      },
      "id": "a1f0c5e2-0000-4000-8000-000000000002",
      "name": "Parse CV (VerbatimCV)",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [240, 0],
      "credentials": { "httpBearerAuth": { "id": "verbatimcv", "name": "VerbatimCV API key" } }
    },
    {
      "parameters": {
        "conditions": {
          "options": { "caseSensitive": true, "leftValue": "", "typeValidation": "strict", "version": 2 },
          "conditions": [
            {
              "id": "c1",
              "leftValue": "={{ $json.preferences.work_arrangement.source !== 'absent' && $json.preferences.work_arrangement.value.includes('remote') }}",
              "rightValue": "",
              "operator": { "type": "boolean", "operation": "true", "singleValue": true }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "id": "a1f0c5e2-0000-4000-8000-000000000003",
      "name": "Open to remote?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [480, 0]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            { "id": "s1", "name": "route", "value": "remote", "type": "string" },
            { "id": "s2", "name": "name", "value": "={{ $json.candidate.full_name }}", "type": "string" },
            { "id": "s3", "name": "work_arrangement", "value": "={{ $json.preferences.work_arrangement.value.join(', ') }}", "type": "string" },
            { "id": "s4", "name": "quote", "value": "={{ $json.preferences.work_arrangement.evidence }}", "type": "string" },
            { "id": "s5", "name": "confirm_with_a_person", "value": "={{ $json.agent_guidance.confirm_before_acting.join(', ') }}", "type": "string" },
            { "id": "s6", "name": "prompt_injection_found", "value": "={{ $json.safety.prompt_injection.detected }}", "type": "boolean" }
          ]
        },
        "options": {}
      },
      "id": "a1f0c5e2-0000-4000-8000-000000000004",
      "name": "Remote candidate",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [720, -100]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            { "id": "t1", "name": "route", "value": "other", "type": "string" },
            { "id": "t2", "name": "name", "value": "={{ $json.candidate.full_name }}", "type": "string" },
            { "id": "t3", "name": "work_arrangement", "value": "={{ $json.preferences.work_arrangement.source === 'absent' ? 'not stated' : $json.preferences.work_arrangement.value.join(', ') }}", "type": "string" },
            { "id": "t4", "name": "quote", "value": "={{ $json.preferences.work_arrangement.evidence ?? '' }}", "type": "string" },
            { "id": "t5", "name": "confirm_with_a_person", "value": "={{ $json.agent_guidance.confirm_before_acting.join(', ') }}", "type": "string" },
            { "id": "t6", "name": "prompt_injection_found", "value": "={{ $json.safety.prompt_injection.detected }}", "type": "boolean" }
          ]
        },
        "options": {}
      },
      "id": "a1f0c5e2-0000-4000-8000-000000000005",
      "name": "Onsite, hybrid or not stated",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [720, 100]
    }
  ],
  "connections": {
    "New email with a CV": { "main": [[{ "node": "Parse CV (VerbatimCV)", "type": "main", "index": 0 }]] },
    "Parse CV (VerbatimCV)": { "main": [[{ "node": "Open to remote?", "type": "main", "index": 0 }]] },
    "Open to remote?": {
      "main": [
        [{ "node": "Remote candidate", "type": "main", "index": 0 }],
        [{ "node": "Onsite, hybrid or not stated", "type": "main", "index": 0 }]
      ]
    }
  },
  "settings": { "executionOrder": "v1" },
  "pinData": {}
}
