{
  "name": "Screen and score CV candidates with Mistral OCR and Gemini",
  "nodes": [
    {
      "id": "fdefa89b-a5f1-4b12-8d0c-9977f7b423ca",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -432,
        -240
      ],
      "parameters": {
        "width": 288,
        "height": 416,
        "content": "### 📥 Watch Inbox\n**Trigger:** Fires when a new email arrives in INBOX.\n\n- Format: `Resolved` (full data + binary)\n- Attachments: ON → store candidate resume as `attachment_0`\n- Action: Mark as Read"
      }
    },
    {
      "id": "e24bce3a-5be7-40ff-bcf9-046242e45423",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -128,
        -240
      ],
      "parameters": {
        "width": 256,
        "height": 416,
        "content": "### 📄 OCR Extraction\n**Mistral OCR** reads the CV binary.\n\n- Model: `mistral-ocr-latest`\n- Input: Candidate Resume/CV \n- Output: Extracted info from PDF \n- Works on both digital & scanned PDFs"
      }
    },
    {
      "id": "b117d81a-5f42-4f44-ae52-75109be0bb3d",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        144,
        -240
      ],
      "parameters": {
        "width": 384,
        "height": 416,
        "content": "### 🤖 AI CV Scoring\n**Gemini** evaluates CV vs JD.\n\n- Model: `gemini-3.1-flash-lite-preview`\n- Input: Extracted info of Candidate from Mistral OCR\n- Returns JSON: score, decision, name, summary, key_s"
      }
    },
    {
      "id": "3586d228-3a05-4915-8120-68c102b1c3b4",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        544,
        -240
      ],
      "parameters": {
        "width": 256,
        "height": 416,
        "content": "### ⚙️ Parse Response\n**Critical node** — does 3 things:\n\n1. Strips Gemini markdown fences (` ```json `)\n2. Parses JSON into clean fields\n3. Passes `binary` from IMAP trigger forward so CV attachment "
      }
    },
    {
      "id": "aa798038-c950-43bb-8b0e-4b55e0ecdecc",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        816,
        -240
      ],
      "parameters": {
        "width": null,
        "height": 416,
        "content": "### 🔀 Route Decision\n**IF** \n`decision == \"shortlisted\"`\n\n- ✅ TRUE → HR email + candidate invite\n- ❌ FALSE → polite decline to candidate"
      }
    },
    {
      "id": "2209f484-41db-444c-9828-8b3cbbb441d9",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1072,
        -304
      ],
      "parameters": {
        "width": 352,
        "height": 384,
        "content": "### 📧 HR Notification\n**Sends to HR** on shortlist.\n\n- Includes: score, name, email, key skills, AI summary\n- Attachment: `attachment_0` (original CV PDF)\n- Subject has score in title for quick scanni"
      }
    },
    {
      "id": "5773fb5c-a56f-404f-9c24-d4f5e6305854",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1440,
        -304
      ],
      "parameters": {
        "width": 336,
        "height": 384,
        "content": "### 📧 Interview Invite\n**Sends to shortlisted candidate.**\n\n- Includes scheduling link (update `YOUR_CALENDLY_OR_CAL_LINK_HERE`)\n- 'What to Expect' section with 3 interview steps\n- Runs after Node 6 ("
      }
    },
    {
      "id": "f7702b41-f029-4dd6-a9e0-cdb6622ed70c",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1344,
        96
      ],
      "parameters": {
        "width": 432,
        "height": null,
        "content": "### 📧 Polite Decline\n**Sends to rejected candidate.**\n\n- Empathetic tone, no harsh language\n- Links to appstonelab.com/career for future roles\n- No CV attachment needed here"
      }
    },
    {
      "id": "fee1c26f-feef-47f0-b827-b8db69bf41b5",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -832,
        -240
      ],
      "parameters": {
        "width": 384,
        "height": 416,
        "content": "## 🤖 AI Hiring Pipeline\n\n**Purpose:** Automates end-to-end CV screening for a Specific role.\n\n**Flow:**\n1. Watches inbox for incoming CV emails\n2. Extracts CV text via Mistral OCR (works on scanned + "
      }
    },
    {
      "id": "007f091d-8989-4b97-8890-a39cf790a30d",
      "name": "Watch Inbox for CV Emails",
      "type": "n8n-nodes-base.emailReadImap",
      "position": [
        -336,
        0
      ]
    },
    {
      "id": "b38a7e72-3f95-4a68-a286-00805200131b",
      "name": "OCR: Extract CV Text",
      "type": "n8n-nodes-base.mistralAi",
      "position": [
        -48,
        0
      ]
    },
    {
      "id": "5baea769-a76e-4c5e-968e-d560039f300b",
      "name": "AI Score CV",
      "type": "@n8n/n8n-nodes-langchain.googleGemini",
      "position": [
        224,
        0
      ]
    },
    {
      "id": "ffe38dd7-159c-45de-b3b7-4fb6666511bf",
      "name": "Parse AI Response + Pass Binary",
      "type": "n8n-nodes-base.code",
      "position": [
        624,
        0
      ]
    },
    {
      "id": "7e42598e-b1ab-4930-acbd-7708f4330705",
      "name": "Shortlisted or Rejected?",
      "type": "n8n-nodes-base.if",
      "position": [
        896,
        0
      ]
    },
    {
      "id": "72dc86a0-3a33-4e18-9e99-03c4b9bd717f",
      "name": "Notify HR with CV Summary",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        1200,
        -96
      ]
    },
    {
      "id": "a40e915e-4935-49e7-9445-fa0477ee9d8f",
      "name": "Send Interview Invite to Candidate",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        1552,
        -96
      ]
    },
    {
      "id": "78e89300-7984-4f53-913f-f59de720afc1",
      "name": "Send Decline Email to Candidate",
      "type": "n8n-nodes-base.emailSend",
      "position": [
        1136,
        96
      ]
    }
  ],
  "connections": {
    "AI Score CV": {
      "main": [
        [
          {
            "node": "Parse AI Response + Pass Binary",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OCR: Extract CV Text": {
      "main": [
        [
          {
            "node": "AI Score CV",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Shortlisted or Rejected?": {
      "main": [
        [
          {
            "node": "Notify HR with CV Summary",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send Decline Email to Candidate",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Notify HR with CV Summary": {
      "main": [
        [
          {
            "node": "Send Interview Invite to Candidate",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Watch Inbox for CV Emails": {
      "main": [
        [
          {
            "node": "OCR: Extract CV Text",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse AI Response + Pass Binary": {
      "main": [
        [
          {
            "node": "Shortlisted or Rejected?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}