{
  "name": "AI Job Application Auto-Reply",
  "nodes": [
    {
      "parameters": {
        "pollTimes": { "item": [{ "mode": "everyMinute", "minute": 10 }] },
        "filters": { "labelIds": ["INBOX"] },
        "simple": false
      },
      "id": "d1e2f3a4-0001-0001-0001-000000000001",
      "name": "Gmail Trigger",
      "type": "n8n-nodes-base.gmailTrigger",
      "typeVersion": 1,
      "position": [240, 300],
      "credentials": { "gmailOAuth2": { "id": "YOUR_GMAIL_CREDENTIAL_ID", "name": "Gmail OAuth2" } }
    },
    {
      "parameters": {
        "dataType": "string",
        "value1": "={{ $json.subject.toLowerCase() }}",
        "rules": {
          "rules": [
            { "value2": "application" },
            { "value2": "applying" },
            { "value2": "cv" },
            { "value2": "resume" },
            { "value2": "candidate" }
          ]
        }
      },
      "id": "d1e2f3a4-0002-0002-0002-000000000002",
      "name": "Is Job Application?",
      "type": "n8n-nodes-base.switch",
      "typeVersion": 1,
      "position": [460, 300]
    },
    {
      "parameters": {
        "resource": "chat",
        "operation": "create",
        "model": "gpt-4o",
        "messages": {
          "values": [
            {
              "role": "system",
              "content": "You are a professional recruiter assistant. Write a warm, genuine acknowledgement reply to a job application. Thank them for applying, say their application is under review, give a realistic timeline of 5-7 business days. Keep it under 100 words. No fluff, no hollow corporate speak."
            },
            {
              "role": "user",
              "content": "=Application email:\nFrom: {{ $json.from }}\nSubject: {{ $json.subject }}\nBody: {{ $json.text ? $json.text.slice(0, 800) : $json.snippet }}"
            }
          ]
        }
      },
      "id": "d1e2f3a4-0003-0003-0003-000000000003",
      "name": "Generate Reply",
      "type": "n8n-nodes-base.openAi",
      "typeVersion": 1,
      "position": [680, 160],
      "credentials": { "openAiApi": { "id": "YOUR_OPENAI_CREDENTIAL_ID", "name": "OpenAI API" } }
    },
    {
      "parameters": {
        "fromEmail": "YOUR_EMAIL@gmail.com",
        "toEmail": "={{ $('Gmail Trigger').item.json.from.match(/<(.+)>/)?.[1] || $('Gmail Trigger').item.json.from }}",
        "subject": "=Re: {{ $('Gmail Trigger').item.json.subject }}",
        "text": "={{ $json.message.content }}"
      },
      "id": "d1e2f3a4-0004-0004-0004-000000000004",
      "name": "Send Reply via SMTP",
      "type": "n8n-nodes-base.emailSend",
      "typeVersion": 2,
      "position": [900, 160],
      "credentials": { "smtp": { "id": "YOUR_SMTP_CREDENTIAL_ID", "name": "SMTP" } }
    },
    {
      "parameters": {
        "operation": "addLabel",
        "messageId": "={{ $('Gmail Trigger').item.json.id }}",
        "labelIds": ["Label_AUTO_REPLIED"]
      },
      "id": "d1e2f3a4-0005-0005-0005-000000000005",
      "name": "Label as Replied",
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 1,
      "position": [1120, 160],
      "credentials": { "gmailOAuth2": { "id": "YOUR_GMAIL_CREDENTIAL_ID", "name": "Gmail OAuth2" } }
    }
  ],
  "connections": {
    "Gmail Trigger": { "main": [[{ "node": "Is Job Application?", "type": "main", "index": 0 }]] },
    "Is Job Application?": { "main": [[{ "node": "Generate Reply", "type": "main", "index": 0 }], [], [], [], []] },
    "Generate Reply": { "main": [[{ "node": "Send Reply via SMTP", "type": "main", "index": 0 }]] },
    "Send Reply via SMTP": { "main": [[{ "node": "Label as Replied", "type": "main", "index": 0 }]] }
  },
  "active": false,
  "settings": { "executionOrder": "v1" },
  "versionId": "d1e2f3a4-aaaa-bbbb-cccc-000000000004",
  "meta": { "templateCredsSetupCompleted": false },
  "id": "workflow-job-application-auto-reply",
  "tags": [{ "name": "HR" }, { "name": "Gmail" }, { "name": "AI" }]
}
