{
  "name": "Job Description Writer with OpenAI",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "job-description",
        "responseMode": "lastNode",
        "options": {}
      },
      "id": "jdw00001-0001-4000-8000-000000000001",
      "name": "JD Request Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [240, 300]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "f1",
              "name": "jobTitle",
              "value": "={{ $json.body.jobTitle }}",
              "type": "string"
            },
            {
              "id": "f2",
              "name": "department",
              "value": "={{ $json.body.department }}",
              "type": "string"
            },
            {
              "id": "f3",
              "name": "mustHaveSkills",
              "value": "={{ $json.body.mustHaveSkills }}",
              "type": "string"
            },
            {
              "id": "f4",
              "name": "tone",
              "value": "={{ $json.body.tone ?? 'professional' }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "id": "jdw00001-0002-4000-8000-000000000002",
      "name": "Extract JD Inputs",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3,
      "position": [460, 300]
    },
    {
      "parameters": {
        "model": "gpt-4o",
        "messages": {
          "values": [
            {
              "role": "system",
              "content": "You are a seasoned HR content writer. Write compelling, inclusive job descriptions that attract top talent. Structure your output with sections: About the Role, Key Responsibilities, Required Skills, Nice-to-Have Skills, and Benefits. Avoid gendered language."
            },
            {
              "role": "user",
              "content": "Write a {{ $json.tone }} job description for a {{ $json.jobTitle }} in the {{ $json.department }} department. Must-have skills: {{ $json.mustHaveSkills }}."
            }
          ]
        },
        "options": {
          "temperature": 0.7,
          "maxTokens": 800
        }
      },
      "id": "jdw00001-0003-4000-8000-000000000003",
      "name": "Generate JD with OpenAI",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "typeVersion": 1,
      "position": [680, 300]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "o1",
              "name": "jobTitle",
              "value": "={{ $('Extract JD Inputs').item.json.jobTitle }}",
              "type": "string"
            },
            {
              "id": "o2",
              "name": "jobDescription",
              "value": "={{ $json.message.content }}",
              "type": "string"
            },
            {
              "id": "o3",
              "name": "generatedAt",
              "value": "={{ new Date().toISOString() }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "id": "jdw00001-0004-4000-8000-000000000004",
      "name": "Build JD Output",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3,
      "position": [900, 300]
    }
  ],
  "connections": {
    "JD Request Webhook": {
      "main": [[{ "node": "Extract JD Inputs", "type": "main", "index": 0 }]]
    },
    "Extract JD Inputs": {
      "main": [[{ "node": "Generate JD with OpenAI", "type": "main", "index": 0 }]]
    },
    "Generate JD with OpenAI": {
      "main": [[{ "node": "Build JD Output", "type": "main", "index": 0 }]]
    }
  },
  "active": false,
  "settings": { "executionOrder": "v1" },
  "meta": {},
  "pinData": {}
}
