{
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "c30700f0-60c1-4c18-bd05-93d28ae09c42",
      "name": "Code",
      "type": "n8n-nodes-base.code",
      "position": [
        -1552,
        208
      ],
      "parameters": {
        "jsCode": "// Binary data'n\u0131n ger\u00e7ek yap\u0131s\u0131n\u0131 g\u00f6rmek i\u00e7in\nconsole.log(\"JSON Keys:\", Object.keys($input.first().json));\nconsole.log(\"Binary Keys:\", Object.keys($input.first().binary || {}));\nconsole.log(\"Full Binary:\", $input.first().binary);\n\nreturn $input.all();"
      },
      "typeVersion": 2
    },
    {
      "id": "a61166c0-b977-4482-bb70-f36c022613a1",
      "name": "No Operation, do nothing",
      "type": "n8n-nodes-base.noOp",
      "position": [
        0,
        0
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "3b700a92-f90e-458e-a17f-942d483cff5f",
      "name": "1. Applicant Submits Form",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -1760,
        208
      ],
      "parameters": {
        "options": {},
        "formTitle": "test",
        "formFields": {
          "values": [
            {
              "fieldLabel": "Name surname",
              "requiredField": true
            },
            {
              "fieldLabel": "email",
              "requiredField": true
            },
            {
              "fieldType": "file",
              "fieldLabel": "CV",
              "multipleFiles": false,
              "requiredField": true,
              "acceptFileTypes": ".pdf"
            },
            {
              "fieldType": "number",
              "fieldLabel": "Experience Years",
              "requiredField": true
            }
          ]
        }
      },
      "typeVersion": 2.3,
      "alwaysOutputData": true
    },
    {
      "id": "bf5e61be-2934-4b99-aaf0-6c264a0b55b7",
      "name": "2. Extract Text from PDF CV",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        -1360,
        208
      ],
      "parameters": {
        "options": {},
        "operation": "pdf",
        "binaryPropertyName": "CV"
      },
      "typeVersion": 1
    },
    {
      "id": "4d93769b-1807-4b42-af08-b86cf92f30de",
      "name": "3. Analyze & Structure CV with AI",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        -1120,
        208
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini",
          "cachedResultName": "GPT-4.1-MINI"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "content": "=FORM DATA:\n- Name: {{ $node[\"On form submission1\"].json[\"Name surname\"] }}\n- Email: {{ $node[\"On form submission1\"].json[\"email\"] }}\n- Experience Years: {{ $node[\"On form submission1\"].json[\"Experience Years\"] }}\n\nCV TEXT:\n{{ $json.text }}\n\nExtract the data into the following JSON format for Google Sheets:\n{\n  \"name\": \"use_name_from_form\",\n  \"email\": \"use_email_from_form\",\n  \"phone\": \"phone_extracted_from_cv\",\n  \"experience_years\": \"use_experience_years_from_form\",\n  \"education\": \"All education as a single string - school, degree, year\",\n  \"work_experience\": \"All work experience as a single string - company, position, duration\",\n  \"skills\": \"All skills, comma-separated\",\n  \"certifications\": \"All certifications, comma-separated\",\n  \"languages\": \"Languages and their proficiency levels\",\n  \"address\": \"address_extracted_from_cv\",\n  \"cv_summary\": \"A 10-sentence summary of the CV for an HR manager\",\n  \"application_date\": \"{{ new Date().toLocaleDateString('en-US') }}\",\n  \"status\": \"New Application\"\n}\n\nIMPORTANT: Respond ONLY in the valid JSON format. Do not add any other text or explanations."
            }
          ]
        },
        "jsonOutput": true
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "14a1c88a-20cc-46b5-a9d3-1c26c6a230e2",
      "name": "4. Parse AI Output",
      "type": "n8n-nodes-base.code",
      "position": [
        -752,
        208
      ],
      "parameters": {
        "jsCode": "// content zaten object, parse etmeye gerek yok\nconst data = items[0].json.message.content;\n\nreturn [{ json: data }];"
      },
      "typeVersion": 2
    },
    {
      "id": "d1bff2d5-b644-441b-b76d-7b41dda8800f",
      "name": "5. Check for Duplicate Applicant",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -512,
        208
      ],
      "parameters": {
        "options": {},
        "filtersUI": {
          "values": [
            {
              "lookupValue": "={{ $node[\"4. Parse AI Output\"].json.email }}",
              "lookupColumn": "email"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1UvFYOE5C47Q8eQpGq0fLmxHwRjXpZTzssQiv7mOsC1E/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "url",
          "value": "https://docs.google.com/spreadsheets/d/1UvFYOE5C47Q8eQpGq0fLmxHwRjXpZTzssQiv7mOsC1E/edit?gid=0#gid=0"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7,
      "alwaysOutputData": true
    },
    {
      "id": "4bce4857-f0b0-4ac9-b11b-d57f41d7c72c",
      "name": "6. If Applicant is New...",
      "type": "n8n-nodes-base.if",
      "position": [
        -240,
        208
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "3009324b-7124-488e-931d-37221b4b57f9",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{ $json.email }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "b4320ad6-1d8c-491d-b7fa-78734aa6ff36",
      "name": "7. Save Applicant Data to Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        16,
        368
      ],
      "parameters": {
        "columns": {
          "value": {
            "email": "={{ $node[\"4. Parse AI Output\"].json.email }}",
            "status": "= {{ $node[\"4. Parse AI Output\"].json.status }}",
            "address": "={{ $node[\"4. Parse AI Output\"].json.address }}",
            "talents": "={{ $node[\"4. Parse AI Output\"].json.skills }}",
            "education": "={{ $node[\"4. Parse AI Output\"].json.education }}",
            "languages": "={{ $node[\"4. Parse AI Output\"].json.languages }}",
            "telephone": "={{ $node[\"4. Parse AI Output\"].json.phone }}",
            "cv_summary": "={{ $node[\"4. Parse AI Output\"].json.cv_summary }}",
            "experience": "={{ $node[\"4. Parse AI Output\"].json.work_experience }}",
            "certificates": "={{ $node[\"4. Parse AI Output\"].json.certifications }}",
            "name surname": "={{ $node[\"4. Parse AI Output\"].json.name }}",
            "application_date": "={{ $node[\"4. Parse AI Output\"].json.application_date }}",
            "experience_years": "={{ $node[\"4. Parse AI Output\"].json.experience_years }}"
          },
          "schema": [
            {
              "id": "name surname",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "name surname",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "email",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "telephone",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "telephone",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "experience_years",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "experience_years",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "education",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "education",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "experience",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "experience",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "talents",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "talents",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "certificates",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "certificates",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "languages",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "languages",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "address",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "address",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "cv_summary",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "cv_summary",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "application_date",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "application_date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "status",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "submittedAt",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "submittedAt",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "formMode",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "formMode",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "index",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "index",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "message",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "message",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "logprobs",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "logprobs",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "finish_reason",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "finish_reason",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "email"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1UvFYOE5C47Q8eQpGq0fLmxHwRjXpZTzssQiv7mOsC1E/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "url",
          "value": "https://docs.google.com/spreadsheets/d/1UvFYOE5C47Q8eQpGq0fLmxHwRjXpZTzssQiv7mOsC1E/edit?gid=0#gid=0"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "fb6b0443-dfda-4bc6-a1d7-f86ce2df4ada",
      "name": "8a. Send Confirmation Email to Applicant",
      "type": "n8n-nodes-base.gmail",
      "position": [
        368,
        208
      ],
      "parameters": {
        "sendTo": "={{ $node[\"4. Parse AI Output\"].json.email }}",
        "message": "=Dear {{ $node[\"4. Parse AI Output\"].json.name }},\n\nYour application has been received successfully.\n\nHere are your application details:\n- Email: {{ $node[\"4. Parse AI Output\"].json.email }}\n- Experience: {{ $node[\"4. Parse AI Output\"].json.experience_years }} years\n- Application Date: {{ $node[\"4. Parse AI Output\"].json.application_date }}\n\nWe will review your application and get back to you shortly.\n\nThank you.",
        "options": {},
        "subject": "Your Application Has Been Received"
      },
      "typeVersion": 2.1
    },
    {
      "id": "1177788a-8ce6-40b1-8e71-5825afefb22e",
      "name": "8b. Send Notification Email to Recruiter",
      "type": "n8n-nodes-base.gmail",
      "position": [
        368,
        512
      ],
      "parameters": {
        "sendTo": "user@example.com",
        "message": "=A new CV application has been received:\n\nName: {{ $node[\"4. Parse AI Output\"].json.name }}\nEmail: {{ $node[\"4. Parse AI Output\"].json.email }}\nExperience: {{ $node[\"4. Parse AI Output\"].json.experience_years }} years\n\nAI-Generated CV Summary:\n{{ $node[\"4. Parse AI Output\"].json.cv_summary }}\n\nThe applicant's data has been saved to Google Sheets.",
        "options": {},
        "subject": "=New Application - {{ $node[\"4. Parse AI Output\"].json.name }}"
      },
      "typeVersion": 2.1
    },
    {
      "id": "0fa496ba-afdb-4290-a6cb-cf15cacae9e2",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2384,
        16
      ],
      "parameters": {
        "width": 544,
        "height": 512,
        "content": "# AI-Powered Applicant Tracking System (ATS)\n\n**Purpose:** This workflow automates your initial hiring process. It captures job applications via an n8n form, uses AI to read and structure the candidate's PDF CV, saves the data to Google Sheets, and sends confirmation emails.\n\n### Quick Setup Guide\n\n1.  **Configure Credentials:**\n    *   `OpenAI` (Node 3): Set up your OpenAI credentials.\n    *   `Google Sheets` & `Gmail` (Nodes 5, 7, 8a, 8b): Configure your Google account credentials.\n2.  **Customize Form:** In the `1. Applicant Submits Form` node, customize your form fields if needed. **Activate the workflow** and copy the \"Production URL\" to share with applicants.\n3.  **Set Recruiter Email:** In the `8b. Send Notification...` node, change the \"To\" address to your own email.\n4.  **Link Your Sheet:** In nodes `5` and `7`, select your Google Sheet for storing applicant data."
      },
      "typeVersion": 1
    },
    {
      "id": "f3165533-3506-48b3-9524-496252336362",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1424,
        -80
      ],
      "parameters": {
        "color": 3,
        "width": 752,
        "height": 240,
        "content": "### Phase 1: AI CV Parsing Engine\n\n**Purpose:** This is the core of the automation. It transforms an unstructured CV into a structured database entry.\n\n*   **2. Extract Text:** Reads all the text content from the uploaded PDF file.\n*   **3. Analyze with AI:** Sends the raw CV text to OpenAI with a detailed prompt, instructing it to extract key information (experience, skills, education, etc.) and return it as a clean JSON object.\n*   **4. Parse AI Output:** Converts the AI's text response into a usable JSON object for the next steps."
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "Code": {
      "main": [
        [
          {
            "node": "2. Extract Text from PDF CV",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "4. Parse AI Output": {
      "main": [
        [
          {
            "node": "5. Check for Duplicate Applicant",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "1. Applicant Submits Form": {
      "main": [
        [
          {
            "node": "Code",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "6. If Applicant is New...": {
      "main": [
        [
          {
            "node": "No Operation, do nothing",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "7. Save Applicant Data to Google Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "2. Extract Text from PDF CV": {
      "main": [
        [
          {
            "node": "3. Analyze & Structure CV with AI",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "5. Check for Duplicate Applicant": {
      "main": [
        [
          {
            "node": "6. If Applicant is New...",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "3. Analyze & Structure CV with AI": {
      "main": [
        [
          {
            "node": "4. Parse AI Output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "7. Save Applicant Data to Google Sheets": {
      "main": [
        [
          {
            "node": "8a. Send Confirmation Email to Applicant",
            "type": "main",
            "index": 0
          },
          {
            "node": "8b. Send Notification Email to Recruiter",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}