{
  "id": "",
  "meta": {
    "templateCredsSetupCompleted": false
  },
  "name": "Verified Job Offer Letter Generator",
  "tags": [],
  "nodes": [
    {
      "id": "e7eb164d-4c92-462f-b6c9-b0c44714b28b",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -1616,
        416
      ],
      "parameters": {
        "path": "job-offer-generator",
        "options": {},
        "httpMethod": "POST"
      },
      "typeVersion": 2.1
    },
    {
      "id": "604933ae-1dc3-4a93-967d-9a40a9f70f3d",
      "name": "Email Verification",
      "type": "n8n-nodes-verifiemail.verifiEmail",
      "position": [
        -1424,
        416
      ],
      "parameters": {
        "email": "={{ $json.body.candidateEmail }}"
      },
      "credentials": {
        "verifiEmailApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "1f9b6dba-adc5-4083-9755-fa9f5e0ffa04",
      "name": "Check Email Validity",
      "type": "n8n-nodes-base.if",
      "position": [
        -1216,
        416
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 3,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "89a382e8-9773-44d0-adae-4b59fcbb56fb",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              },
              "leftValue": "={{ $json.valid }}",
              "rightValue": false
            }
          ]
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "c563d924-0bc6-4c7e-a965-546bad259166",
      "name": "Prepare Offer Data",
      "type": "n8n-nodes-base.set",
      "position": [
        -944,
        352
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "7e233b03-e825-4715-afd7-6adae8603a35",
              "name": "candidateName",
              "type": "string",
              "value": "={{ $('Webhook').item.json.body.candidateName }}"
            },
            {
              "id": "03175440-80b9-47dd-b3ee-9100082afa81",
              "name": "candidateEmail",
              "type": "string",
              "value": "={{ $('Webhook').item.json.body.candidateEmail }}"
            },
            {
              "id": "f09ed0c5-387b-4fc8-ab43-0acbaabeb776",
              "name": "position",
              "type": "string",
              "value": "={{ $('Webhook').item.json.body.position }}"
            },
            {
              "id": "445fe494-6543-4991-818d-b93d944e6581",
              "name": "department",
              "type": "string",
              "value": "={{ $('Webhook').item.json.body.department }}"
            },
            {
              "id": "5e261953-ae62-4545-a105-a7905c33de1d",
              "name": "salary",
              "type": "number",
              "value": "={{ $('Webhook').item.json.body.salary }}"
            },
            {
              "id": "42d749e9-293d-48c8-b783-04b09943df28",
              "name": "formattedSalary",
              "type": "string",
              "value": "={{ \"$\" + Number($('Webhook').item.json.body.salary).toLocaleString() }}"
            },
            {
              "id": "1d487f83-835b-408a-8a6c-1ee751a15f6b",
              "name": "joiningDate",
              "type": "string",
              "value": "={{ $('Webhook').item.json.body.joiningDate }}"
            },
            {
              "id": "0b0f45ae-ef01-48a1-a990-958409e37be5",
              "name": "reportingTo",
              "type": "string",
              "value": "={{ $('Webhook').item.json.body.reportingTo }}"
            },
            {
              "id": "d6076d86-2589-4294-8826-21d2d47fdd95",
              "name": "workLocation",
              "type": "string",
              "value": "={{ $('Webhook').item.json.body.workLocation }}"
            },
            {
              "id": "83a6ed3d-8a57-475d-b142-7530a21a228b",
              "name": "offerDate",
              "type": "string",
              "value": "={{ $now.format('MMMM DD, YYYY') }}"
            },
            {
              "id": "b93bba53-26d5-40b4-9fa2-47885c540b3f",
              "name": "companyName",
              "type": "string",
              "value": "TechCorp Inc. "
            },
            {
              "id": "95df2235-353e-4793-8c2e-b118573ebd6d",
              "name": "hrName",
              "type": "string",
              "value": "Sarah Johnson"
            },
            {
              "id": "7b056659-365c-47ca-9ab3-ffffea0d2a85",
              "name": "hrTitle",
              "type": "string",
              "value": "VP of Human Resources"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "d155cee6-88f1-4f73-b762-369e54d526e9",
      "name": "Generate Offer Letter Content",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        -736,
        352
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4",
          "cachedResultName": "GPT-4"
        },
        "options": {
          "temperature": 0.7
        },
        "responses": {
          "values": [
            {
              "role": "system",
              "content": "=You are a professional HR communications specialist with 15+ years of experience writing job offer letters for Fortune 500 companies. Your expertise includes:\n\n- Crafting warm, professional, and legally compliant offer letters\n- Balancing enthusiasm with formality\n- Highlighting company culture and values\n- Using clear, unambiguous language for employment terms\n- Creating welcoming tones that excite candidates about joining\n\nGuidelines for your responses:\n1. Write in a professional business letter format (body text only, no letterhead)\n2. Use clear paragraphs with proper spacing\n3. Start with congratulations and enthusiasm\n4. Be specific about role expectations without overwhelming detail\n5. Mention benefits and company culture naturally\n6. End with clear next steps for acceptance\n7. Maintain a tone that is: professional yet warm, formal yet personable\n8. Avoid legal jargon unless absolutely necessary\n9. Do NOT include addresses, dates, or signature blocks (these will be added separately)\n10. Keep the letter between 400-600 words\n\nRemember: This letter represents the candidate's first official communication as a potential employee. Make it memorable and positive while remaining professional."
            },
            {
              "content": "=Please write a professional job offer letter body with the following details:\n\nCANDIDATE INFORMATION:\n- Full Name: {{ $json.candidateName }}\n- Email: {{ $json.candidateEmail }}\n\nPOSITION DETAILS:\n- Job Title: {{ $json.position }}\n- Department: {{ $json.department }}\n- Reports To: {{ $json.reportingTo }}\n- Work Location: {{ $json.workLocation }}\n- Start Date: {{ $json.joiningDate }}\n\nCOMPENSATION:\n- Annual Base Salary: {{ $json.formattedSalary }}\n\nLETTER REQUIREMENTS:\n1. Opening paragraph: Congratulate the candidate warmly and express genuine excitement\n2. Second paragraph: Brief overview of the role and its importance to the company\n3. Third paragraph: Highlight 2-3 key responsibilities or opportunities in this position\n4. Fourth paragraph: Mention the compensation, benefits package overview, and work arrangements\n5. Fifth paragraph: Express confidence in their abilities and cultural fit\n6. Closing paragraph: Clear next steps - review letter, sign acceptance, and contact information for questions\n\nTONE: Professional, welcoming, and enthusiastic. Make {{ $json.candidateName }} feel valued and excited to join.\n\nOUTPUT FORMAT: Return only the letter body text with proper paragraph breaks. Do not include date, address blocks, or signature lines."
            }
          ]
        },
        "builtInTools": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "c0e34615-ec62-4d07-b5ff-0c3c165d5b84",
      "name": "Notify HR Team",
      "type": "n8n-nodes-base.slack",
      "position": [
        272,
        352
      ],
      "parameters": {
        "text": "=\u2705 *Job Offer Sent Successfully*\n\n\ud83d\udc64 *Candidate:* {{ $('Prepare Offer Data').item.json.candidateName }}\n\ud83d\udce7 *Email:* {{ $('Prepare Offer Data').item.json.candidateEmail }}\n\ud83d\udcbc *Position:* {{ $('Prepare Offer Data').item.json.position }}\n\ud83d\udcb0 *Salary:* {{ $('Prepare Offer Data').item.json.formattedSalary }}\n\ud83d\udcc5 *Start Date:* {{ $('Prepare Offer Data').item.json.joiningDate }}\n\ud83c\udd94 *Document ID:* {{ $('Build HTML with SVG Signature').item.json.documentId }}\n\n\ud83d\udcce Offer letter PDF sent via email.",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_SLACK_CHANNEL_ID",
          "cachedResultName": "YOUR_CHANNEL_NAME"
        },
        "otherOptions": {}
      },
      "credentials": {
        "slackApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.4
    },
    {
      "id": "2cfb1776-1894-404f-955f-55ee96e08981",
      "name": "Deliver Offer Letter",
      "type": "n8n-nodes-base.gmail",
      "position": [
        112,
        352
      ],
      "parameters": {
        "sendTo": "={{ $('Prepare Offer Data').item.json.candidateEmail }}",
        "message": "=<!DOCTYPE html>\n<html>\n<head>\n  <style>\n    body {\n      font-family: Arial, sans-serif;\n      line-height: 1.6;\n      color: #333;\n      max-width: 600px;\n      margin: 0 auto;\n    }\n    .header {\n      background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);\n      color: white;\n      padding: 30px;\n      text-align: center;\n      border-radius: 8px 8px 0 0;\n    }\n    .content {\n      padding: 30px;\n      background: #f8f9fa;\n    }\n    .cta-box {\n      background: white;\n      border-left: 4px solid #667eea;\n      padding: 20px;\n      margin: 20px 0;\n      border-radius: 4px;\n    }\n    .next-steps {\n      background: white;\n      padding: 20px;\n      border-radius: 8px;\n      margin: 20px 0;\n    }\n    .next-steps h3 {\n      color: #667eea;\n      margin-top: 0;\n    }\n    .next-steps ul {\n      padding-left: 20px;\n    }\n    .next-steps li {\n      margin: 10px 0;\n    }\n    .footer {\n      background: #2c3e50;\n      color: white;\n      padding: 20px;\n      text-align: center;\n      font-size: 12px;\n      border-radius: 0 0 8px 8px;\n    }\n    .highlight {\n      color: #667eea;\n      font-weight: bold;\n    }\n  </style>\n</head>\n<body>\n  <div class=\"header\">\n    <h1 style=\"margin: 0;\">\ud83c\udf89 Congratulations!</h1>\n    <p style=\"margin: 10px 0 0 0;\">Your Job Offer from {{ $('Prepare Offer Data').item.json.companyName }}</p>\n  </div>\n  \n  <div class=\"content\">\n    <p>Dear <strong>{{ $('Prepare Offer Data').item.json.candidateName }}</strong>,</p>\n    \n    <div class=\"cta-box\">\n      <p style=\"margin: 0; font-size: 16px;\">\n        We are <strong>delighted</strong> to extend an offer for the position of \n        <span class=\"highlight\">{{ $('Prepare Offer Data').item.json.position }}</span> \n        at {{ $('Prepare Offer Data').item.json.companyName }}!\n      </p>\n    </div>\n    \n    <p>After careful consideration of your qualifications and our conversations during the interview process, we believe you will be an excellent addition to our <strong>{{ $('Prepare Offer Data').item.json.department }}</strong> team.</p>\n    \n    <p>\ud83d\udcce <strong>Please find your official offer letter attached to this email.</strong> The letter contains detailed information about your position, compensation, and benefits.</p>\n    \n    <div class=\"next-steps\">\n      <h3>\ud83d\udccb Next Steps</h3>\n      <ul>\n        <li><strong>Review</strong> the attached offer letter carefully</li>\n        <li><strong>Sign and return</strong> the acceptance form within <strong>7 business days</strong></li>\n        <li><strong>Contact us</strong> if you have any questions or need clarification</li>\n        <li><strong>Prepare</strong> for your start date: <strong>{{ $('Prepare Offer Data').item.json.joiningDate }}</strong></li>\n      </ul>\n    </div>\n    \n    <p>To accept this offer, please:</p>\n    <ol>\n      <li>Download and review the attached PDF</li>\n      <li>Sign the offer letter</li>\n      <li>Reply to this email with the signed copy</li>\n    </ol>\n    \n    <p>If you have any questions about the offer, your role, or anything else, please don't hesitate to reach out to us at <a href=\"mailto:hr@techcorp.com\">hr@techcorp.com</a> or call us at <strong>(555) 123-4567</strong>.</p>\n    \n    <p style=\"margin-top: 30px;\">We're incredibly excited about the possibility of you joining our team and contributing to our mission!</p>\n    \n    <p>Warm regards,<br>\n    <strong>{{ $('Prepare Offer Data').item.json.hrName }}</strong><br>\n    {{ $('Prepare Offer Data').item.json.hrTitle }}<br>\n    {{ $('Prepare Offer Data').item.json.companyName }}</p>\n  </div>\n  \n  <div class=\"footer\">\n    <p><strong>{{ $('Prepare Offer Data').item.json.companyName }}</strong></p>\n    <p>123 Technology Drive, Innovation City, TC 12345</p>\n    <p>hr@techcorp.com | (555) 123-4567</p>\n    <p style=\"margin-top: 15px; opacity: 0.7;\">\n      This email contains confidential information intended only for {{ $('Prepare Offer Data').item.json.candidateName }}\n    </p>\n  </div>\n</body>\n</html>",
        "options": {
          "attachmentsUi": {
            "attachmentsBinary": [
              {}
            ]
          }
        },
        "subject": "=Job Offer - {{ $('Prepare Offer Data').item.json.position }} at {{ $('Prepare Offer Data').item.json.companyName }}"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "12edf1fd-d395-4832-ab9b-ad0a44538a63",
      "name": "Convert to PDF",
      "type": "n8n-nodes-htmlcsstopdf.htmlcsstopdf",
      "position": [
        -160,
        352
      ],
      "parameters": {
        "html_content": "={{ $json.html }}",
        "output_format": "file",
        "output_filename": "data"
      },
      "credentials": {
        "htmlcsstopdfApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "f01fb109-33ee-497a-b8c1-93ca4b8e4aa0",
      "name": "Build HTML with SVG Signature",
      "type": "n8n-nodes-base.code",
      "position": [
        -352,
        352
      ],
      "parameters": {
        "jsCode": "// Get data from previous nodes\nconst candidateData = $('Prepare Offer Data').item.json;\n\n// Get OpenAI output\nconst openAiData = $input.item.json;\n\n// Extract text from OpenAI\nlet offerLetterText = '';\ntry {\n  if (openAiData.output && openAiData.output[0] && openAiData.output[0].content) {\n    offerLetterText = openAiData.output[0].content[0].text;\n  }\n} catch (error) {\n  offerLetterText = 'Error extracting text: ' + error.message;\n}\n\n// Generate unique document ID\nfunction generateDocumentId() {\n  const timestamp = Date.now();\n  const random = Math.random().toString(36).substring(2, 9).toUpperCase();\n  return `OFFER-${timestamp}-${random}`;\n}\n\nconst documentId = generateDocumentId();\n\n// Generate SVG signature\nfunction generateSignatureSVG(name) {\n  return `\n    <svg width=\"250\" height=\"70\" xmlns=\"http://www.w3.org/2000/svg\">\n      <text x=\"10\" y=\"45\" \n            font-family=\"'Brush Script MT', 'Lucida Handwriting', cursive\" \n            font-size=\"32\" \n            fill=\"#2c3e50\"\n            style=\"font-style: italic; font-weight: 400;\">\n        ${name}\n      </text>\n    </svg>\n  `;\n}\n\nconst signatureSVG = generateSignatureSVG(candidateData.hrName);\n\n// Build the complete HTML\nconst html = `<!DOCTYPE html>\n<html>\n<head>\n  <meta charset=\"UTF-8\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n  <title>Job Offer Letter - ${candidateData.candidateName}</title>\n  <style>\n    * {\n      margin: 0;\n      padding: 0;\n      box-sizing: border-box;\n    }\n    \n    body {\n      font-family: 'Segoe UI', 'Arial', sans-serif;\n      line-height: 1.7;\n      color: #333;\n      background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);\n      padding: 30px;\n    }\n    \n    .container {\n      max-width: 850px;\n      margin: 0 auto;\n      background: white;\n      box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);\n      border-radius: 12px;\n      overflow: hidden;\n    }\n    \n    .letterhead {\n      background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);\n      color: white;\n      text-align: center;\n      padding: 40px 30px;\n      position: relative;\n      overflow: hidden;\n    }\n    \n    .letterhead::before {\n      content: '';\n      position: absolute;\n      top: -50%;\n      right: -50%;\n      width: 200%;\n      height: 200%;\n      background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);\n      animation: pulse 15s infinite;\n    }\n    \n    @keyframes pulse {\n      0%, 100% { transform: scale(1); }\n      50% { transform: scale(1.1); }\n    }\n    \n    .company-name {\n      font-size: 36px;\n      font-weight: 700;\n      margin-bottom: 8px;\n      text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);\n      position: relative;\n      z-index: 1;\n    }\n    \n    .company-tagline {\n      font-size: 15px;\n      opacity: 0.95;\n      font-weight: 300;\n      letter-spacing: 1px;\n      position: relative;\n      z-index: 1;\n    }\n    \n    .content-wrapper {\n      padding: 40px 50px;\n    }\n    \n    .date {\n      text-align: right;\n      margin-bottom: 35px;\n      color: #7f8c8d;\n      font-size: 14px;\n      font-weight: 500;\n    }\n    \n    .recipient {\n      margin-bottom: 35px;\n      padding: 20px;\n      background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);\n      border-left: 4px solid #667eea;\n      border-radius: 6px;\n    }\n    \n    .recipient strong {\n      font-size: 18px;\n      color: #2c3e50;\n      display: block;\n      margin-bottom: 5px;\n    }\n    \n    .recipient-email {\n      color: #667eea;\n      font-weight: 500;\n    }\n    \n    .subject-line {\n      background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);\n      color: white;\n      padding: 15px 25px;\n      border-radius: 8px;\n      margin-bottom: 30px;\n      font-weight: 600;\n      font-size: 16px;\n      box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);\n    }\n    \n    .content {\n      text-align: justify;\n      margin-bottom: 35px;\n      white-space: pre-line;\n      font-size: 15px;\n      line-height: 1.8;\n    }\n    \n    .content p {\n      margin-bottom: 15px;\n    }\n    \n    .details-box {\n      background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);\n      border: 2px solid #dee2e6;\n      border-radius: 10px;\n      padding: 30px;\n      margin: 30px 0;\n      box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);\n    }\n    \n    .details-box h3 {\n      color: #667eea;\n      font-size: 20px;\n      margin-bottom: 20px;\n      padding-bottom: 12px;\n      border-bottom: 2px solid #667eea;\n      display: flex;\n      align-items: center;\n    }\n    \n    .details-box h3::before {\n      content: '\ud83d\udccb';\n      margin-right: 10px;\n      font-size: 24px;\n    }\n    \n    .detail-row {\n      display: flex;\n      margin-bottom: 15px;\n      padding: 12px;\n      background: white;\n      border-radius: 6px;\n      transition: transform 0.2s ease;\n    }\n    \n    .detail-row:hover {\n      transform: translateX(5px);\n    }\n    \n    .detail-label {\n      font-weight: 600;\n      width: 180px;\n      color: #495057;\n      display: flex;\n      align-items: center;\n    }\n    \n    .detail-label::before {\n      content: '\u25b8';\n      color: #667eea;\n      margin-right: 8px;\n      font-weight: bold;\n    }\n    \n    .detail-value {\n      flex: 1;\n      color: #2c3e50;\n      font-weight: 500;\n    }\n    \n    .signature-section {\n      margin-top: 50px;\n      padding-top: 30px;\n      border-top: 2px dashed #dee2e6;\n    }\n    \n    .signature-section > p:first-child {\n      font-size: 16px;\n      color: #495057;\n      margin-bottom: 10px;\n    }\n    \n    .signature-svg {\n      margin: 20px 0 15px 0;\n      padding: 15px;\n      background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);\n      border-radius: 8px;\n      display: inline-block;\n      box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);\n    }\n    \n    .signature-details {\n      margin-top: 10px;\n      line-height: 1.8;\n    }\n    \n    .signature-details strong {\n      color: #2c3e50;\n      font-size: 17px;\n    }\n    \n    .signature-details br + strong {\n      color: #667eea;\n    }\n    \n    .digital-signature-block {\n      background: linear-gradient(135deg, #e8f4f8 0%, #d4e9f7 100%);\n      border: 2px solid #4a90e2;\n      border-radius: 10px;\n      padding: 25px;\n      margin: 35px 0;\n      box-shadow: 0 4px 15px rgba(74, 144, 226, 0.15);\n    }\n    \n    .signature-verified {\n      color: #27ae60;\n      font-weight: 700;\n      display: flex;\n      align-items: center;\n      margin-bottom: 18px;\n      font-size: 16px;\n    }\n    \n    .verified-icon {\n      display: inline-flex;\n      align-items: center;\n      justify-content: center;\n      width: 26px;\n      height: 26px;\n      background: linear-gradient(135deg, #27ae60 0%, #229954 100%);\n      color: white;\n      border-radius: 50%;\n      margin-right: 10px;\n      font-size: 16px;\n      font-weight: bold;\n      box-shadow: 0 2px 8px rgba(39, 174, 96, 0.3);\n    }\n    \n    .signature-details-verify {\n      color: #555;\n      line-height: 2;\n      font-size: 13px;\n      background: white;\n      padding: 15px;\n      border-radius: 6px;\n      border-left: 4px solid #4a90e2;\n    }\n    \n    .signature-details-verify strong {\n      color: #2c3e50;\n      font-weight: 600;\n      display: inline-block;\n      min-width: 140px;\n    }\n    \n    .footer {\n      background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);\n      color: white;\n      padding: 30px;\n      text-align: center;\n      font-size: 13px;\n      line-height: 1.8;\n    }\n    \n    .footer p {\n      margin-bottom: 8px;\n      opacity: 0.9;\n    }\n    \n    .footer .document-meta {\n      margin-top: 20px;\n      padding-top: 20px;\n      border-top: 1px solid rgba(255, 255, 255, 0.2);\n      font-size: 11px;\n      opacity: 0.7;\n      font-family: 'Courier New', monospace;\n    }\n    \n    .highlight {\n      color: #667eea;\n      font-weight: 600;\n    }\n    \n    @media print {\n      body {\n        background: white;\n        padding: 0;\n      }\n      \n      .container {\n        box-shadow: none;\n        border-radius: 0;\n      }\n    }\n  </style>\n</head>\n<body>\n  <div class=\"container\">\n    <!-- Letterhead -->\n    <div class=\"letterhead\">\n      <div class=\"company-name\">${candidateData.companyName}</div>\n      <div class=\"company-tagline\">Building Tomorrow's Technology Today</div>\n    </div>\n\n    <!-- Content Wrapper -->\n    <div class=\"content-wrapper\">\n      <!-- Date -->\n      <div class=\"date\">${candidateData.offerDate}</div>\n\n      <!-- Recipient -->\n      <div class=\"recipient\">\n        <strong>${candidateData.candidateName}</strong>\n        <span class=\"recipient-email\">${candidateData.candidateEmail}</span>\n      </div>\n\n      <!-- Subject -->\n      <div class=\"subject-line\">\n        Subject: Job Offer - ${candidateData.position}\n      </div>\n\n      <!-- Main Content -->\n      <div class=\"content\">\n        ${offerLetterText}\n      </div>\n\n      <!-- Position Details Box -->\n      <div class=\"details-box\">\n        <h3>Position Details</h3>\n        <div class=\"detail-row\">\n          <span class=\"detail-label\">Position</span>\n          <span class=\"detail-value\">${candidateData.position}</span>\n        </div>\n        <div class=\"detail-row\">\n          <span class=\"detail-label\">Department</span>\n          <span class=\"detail-value\">${candidateData.department}</span>\n        </div>\n        <div class=\"detail-row\">\n          <span class=\"detail-label\">Annual Salary</span>\n          <span class=\"detail-value highlight\">${candidateData.formattedSalary}</span>\n        </div>\n        <div class=\"detail-row\">\n          <span class=\"detail-label\">Start Date</span>\n          <span class=\"detail-value\">${candidateData.joiningDate}</span>\n        </div>\n        <div class=\"detail-row\">\n          <span class=\"detail-label\">Reports To</span>\n          <span class=\"detail-value\">${candidateData.reportingTo}</span>\n        </div>\n        <div class=\"detail-row\">\n          <span class=\"detail-label\">Work Location</span>\n          <span class=\"detail-value\">${candidateData.workLocation}</span>\n        </div>\n      </div>\n\n      <!-- Signature Section -->\n      <div class=\"signature-section\">\n        <p>Sincerely,</p>\n        \n        <div class=\"signature-svg\">\n          ${signatureSVG}\n        </div>\n        \n        <div class=\"signature-details\">\n          <strong>${candidateData.hrName}</strong><br>\n          <strong>${candidateData.hrTitle}</strong><br>\n          ${candidateData.companyName}\n        </div>\n      </div>\n\n      <!-- Digital Signature Verification Block -->\n      <div class=\"digital-signature-block\">\n        <div class=\"signature-verified\">\n          <span class=\"verified-icon\">\u2713</span>\n          Digitally Signed & Verified Document\n        </div>\n        <div class=\"signature-details-verify\">\n          <strong>Signed by:</strong> ${candidateData.hrName}<br>\n          <strong>Title:</strong> ${candidateData.hrTitle}<br>\n          <strong>Organization:</strong> ${candidateData.companyName}<br>\n          <strong>Date & Time:</strong> ${candidateData.offerDate}<br>\n          <strong>Document ID:</strong> ${documentId}<br>\n          <strong>Status:</strong> This document has been electronically signed and is legally binding.<br>\n          <strong>Verification:</strong> To verify authenticity, contact user@example.com with Document ID.\n        </div>\n      </div>\n    </div>\n\n    <!-- Footer -->\n    <div class=\"footer\">\n      <p><strong>Important Notice</strong></p>\n      <p>This offer is contingent upon successful background verification and reference checks.</p>\n      <p>${candidateData.companyName} | user@example.com | (555) 123-4567</p>\n      <p>123 Technology Drive, Innovation City, TC 12345</p>\n      \n      <div class=\"document-meta\">\n        Document ID: ${documentId} | Generated: ${new Date().toISOString()}<br>\n        Confidential - For ${candidateData.candidateName} Only\n      </div>\n    </div>\n  </div>\n</body>\n</html>`;\n\n// Return the HTML with all metadata\nreturn [{ \n  json: { \n    html: html,\n    documentId: documentId,\n    candidateName: candidateData.candidateName,\n    candidateEmail: candidateData.candidateEmail,\n    position: candidateData.position,\n    formattedSalary: candidateData.formattedSalary\n  } \n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "0b0a22ad-9d00-41e4-8584-7a3d77247666",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2160,
        -352
      ],
      "parameters": {
        "width": 496,
        "height": 912,
        "content": "### How It Works\nThis workflow automates the complete job offer letter generation and delivery process for HR teams. When candidate and position details are submitted via webhook, the system first verifies the candidate's email address using VerifiEmail to ensure deliverability and prevent bounced emails. Valid submissions proceed to data preparation where salary formatting, joining dates, and company details are structured. OpenAI GPT-4 then generates a professional, personalized offer letter body that's warm yet formal, highlighting the role, responsibilities, compensation, and company culture. The AI-generated content is merged with candidate details and formatted into a beautifully designed HTML document complete with company branding, styled headers, position details tables, and an SVG-based digital signature. This HTML is converted to a professional PDF that's immediately emailed to the candidate with clear next steps for acceptance. Simultaneously, the HR team receives a Slack notification with key offer details and document tracking information, ensuring internal visibility and follow-up capability.\n\n### Setup Steps\n1. Connect required credentials: OpenAI API, VerifiEmail, HTML-to-PDF service, Gmail, and Slack.\n2. Update company branding in the HTML generation node: company name, colors, logo, address, and contact details.\n3. Customize the HR signature section with your HR manager's name and title.\n4. Configure the Slack channel where offer notifications should be sent.\n5. Adjust the OpenAI prompt to match your company's tone and industry-specific requirements.\n6. Copy the webhook URL and integrate it into your HR management system or applicant tracking software.\n7. Test with sample candidate data to verify email delivery and PDF formatting.\n\n### Customization\n- Modify the AI system prompt to emphasize specific company values or culture points.\n- Adjust HTML styling and colors to match your corporate branding guidelines.\n- Add additional position details fields in the details box (benefits, bonus structure, equity, etc.).\n- Customize the email template styling and messaging to align with your employer brand."
      },
      "typeVersion": 1
    },
    {
      "id": "55c6eea1-4d5d-4aa5-a2a6-851b5dd696c5",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1632,
        288
      ],
      "parameters": {
        "color": 7,
        "width": 560,
        "height": 272,
        "content": "## Input & Email Verification\nReceives candidate details via webhook and verifies email deliverability before processing."
      },
      "typeVersion": 1
    },
    {
      "id": "f9379482-94c4-4d9a-a61d-ba90a63845b1",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -976,
        240
      ],
      "parameters": {
        "color": 7,
        "width": 496,
        "height": 304,
        "content": "## Data Preparation & AI Generation\nStructures candidate data and uses OpenAI to generate a professional, personalized offer letter."
      },
      "typeVersion": 1
    },
    {
      "id": "9029b224-7925-4b29-9d31-7e6c1a8be79a",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -432,
        256
      ],
      "parameters": {
        "color": 7,
        "width": 448,
        "height": 256,
        "content": "## Document Formatting & Conversion\nBuilds branded HTML offer letter with digital signature and converts it to PDF format."
      },
      "typeVersion": 1
    },
    {
      "id": "6cdc665c-7348-4e09-a1d1-51cfaf0fb70c",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        80,
        240
      ],
      "parameters": {
        "color": 7,
        "width": 384,
        "height": 288,
        "content": "## Delivery & Notifications\nEmails PDF to candidate and sends confirmation notification to HR team via Slack."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "",
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "Email Verification",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert to PDF": {
      "main": [
        [
          {
            "node": "Deliver Offer Letter",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Notify HR Team": {
      "main": [
        []
      ]
    },
    "Email Verification": {
      "main": [
        [
          {
            "node": "Check Email Validity",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Offer Data": {
      "main": [
        [
          {
            "node": "Generate Offer Letter Content",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Email Validity": {
      "main": [
        [
          {
            "node": "Prepare Offer Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Deliver Offer Letter": {
      "main": [
        [
          {
            "node": "Notify HR Team",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build HTML with SVG Signature": {
      "main": [
        [
          {
            "node": "Convert to PDF",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Offer Letter Content": {
      "main": [
        [
          {
            "node": "Build HTML with SVG Signature",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}