{
  "name": "Job Application Tailor",
  "nodes": [
    {
      "parameters": {
        "fields": {
          "values": [
            {
              "name": "jobUrl",
              "value": "https://example.com/job-posting/123"
            }
          ]
        }
      },
      "name": "Start",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        450,
        300
      ],
      "notes": "Paste the URL of the job posting you want to apply for."
    },
    {
      "parameters": {
        "url": "={{ $json.jobUrl }}",
        "responseFormat": "text",
        "options": {}
      },
      "name": "Fetch Job Description",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        650,
        300
      ],
      "notes": "Fetches the HTML content of the job posting URL."
    },
    {
      "parameters": {
        "filePath": "/path/to/your/master_resume.txt"
      },
      "name": "Read Master Resume",
      "type": "n8n-nodes-base.readFile",
      "typeVersion": 1,
      "position": [
        650,
        500
      ],
      "notes": "Reads your master resume file. **ACTION REQUIRED:** Update the file path to point to your master_resume.txt file."
    },
    {
      "parameters": {
        "url": "https://api.example.com/v1/chat/completions",
        "options": {},
        "bodyParameters": {
          "parameters": [
            {
              "name": "model",
              "value": "gpt-4"
            },
            {
              "name": "messages",
              "value": "={{ [ { \"role\": \"system\", \"content\": \"You are a world-class career coach and resume writer. You will be given a master resume and a job description. Your task is to first, rewrite the resume to perfectly tailor it to the job description, focusing on the most relevant skills and experiences. Second, write a compelling and concise cover letter for the same job. Respond with a single JSON object with two keys: 'tailored_resume' and 'cover_letter'.\" }, { \"role\": \"user\", \"content\": \"Job Description:\n\" + $node[\"Fetch Job Description\"].json.data + \"\n\nMaster Resume:\n\" + $node[\"Read Master Resume\"].json.data + \"\" } ] }}"
            }
          ]
        },
        "authentication": "headerAuth"
      },
      "name": "Tailor Resume & Draft Letter",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        850,
        400
      ],
      "notes": "Sends the job description and master resume to an LLM for tailoring. **ACTION REQUIRED:** Configure LLM URL and authentication.",
      "credentials": {
        "httpHeaderAuth": {
          "id": "placeholder",
          "name": "LLM API Key"
        }
      }
    },
    {
      "parameters": {
        "filePath": "/path/to/your/tailored_resume.txt",
        "content": "={{ JSON.parse($json.choices[0].message.content).tailored_resume }}"
      },
      "name": "Save Tailored Resume",
      "type": "n8n-nodes-base.writeFile",
      "typeVersion": 1,
      "position": [
        1050,
        300
      ],
      "notes": "Saves the tailored resume to a text file. **ACTION REQUIRED:** Update the file path to your desired output location."
    },
    {
      "parameters": {
        "filePath": "/path/to/your/cover_letter.txt",
        "content": "={{ JSON.parse($json.choices[0].message.content).cover_letter }}"
      },
      "name": "Save Cover Letter",
      "type": "n8n-nodes-base.writeFile",
      "typeVersion": 1,
      "position": [
        1050,
        500
      ],
      "notes": "Saves the cover letter to a text file. **ACTION REQUIRED:** Update the file path to your desired output location."
    }
  ],
  "connections": {
    "Start": {
      "main": [
        [
          {
            "node": "Fetch Job Description",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Job Description": {
      "main": [
        [
          {
            "node": "Tailor Resume & Draft Letter",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read Master Resume": {
      "main": [
        [
          {
            "node": "Tailor Resume & Draft Letter",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Tailor Resume & Draft Letter": {
      "main": [
        [
          {
            "node": "Save Tailored Resume",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Save Cover Letter",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}