{
  "name": "Lunexo – Contact Form Auto-Reply",
  "nodes": [
    {
      "parameters": {
        "content": "## Contact Form Auto-Reply\n\n**What it does:** Receives contact form submissions via webhook, sends a professional auto-reply email to the lead, and alerts your admin.\n\n**Setup (~5 min):**\n1. Add your SMTP credentials (Gmail, SendGrid, etc.)\n2. Change `YOUR_ADMIN_EMAIL` in the Code node\n3. Activate the workflow\n4. Point your contact form to the webhook URL\n\n**Variables to change:**\n- `YOUR_ADMIN_EMAIL` — your inbox for alerts",
        "height": 300,
        "width": 350,
        "color": 5
      },
      "id": "b1a2c3d4-e5f6-7890-abcd-100000000001",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [40, 80]
    },
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "contact-form",
        "responseMode": "responseNode",
        "options": {}
      },
      "id": "b1a2c3d4-e5f6-7890-abcd-100000000002",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [240, 300],
      "webhookId": "b1a2c3d4-e5f6-7890-abcd-100000000010"
    },
    {
      "parameters": {
        "jsCode": "try {\n  const input = $input.first().json;\n  const body = input.body || input;\n  const name = body.name || body.fullName || 'Visitor';\n  const email = body.email || '';\n  const subject = body.subject || 'Contact Form Submission';\n  const message = body.message || body.text || '';\n\n  const autoReplyHtml = `<div style=\"font-family:Arial,sans-serif;max-width:600px;margin:0 auto;padding:20px;\">`\n    + `<h2 style=\"color:#6C2BD9;\">Thank you, ${name}!</h2>`\n    + `<p>We received your message and will get back to you within 24 hours.</p>`\n    + `<div style=\"background:#f4f0ff;border-left:4px solid #6C2BD9;padding:12px 16px;margin:16px 0;\">`\n    + `<strong>Your message:</strong><br/>${message}`\n    + `</div>`\n    + `<p style=\"color:#888;font-size:12px;\">— Lunexo</p>`\n    + `</div>`;\n\n  const adminAlertHtml = `<div style=\"font-family:Arial,sans-serif;max-width:600px;margin:0 auto;padding:20px;\">`\n    + `<h2 style=\"color:#6C2BD9;\">New Contact Form Submission</h2>`\n    + `<table style=\"width:100%;border-collapse:collapse;\">`\n    + `<tr><td style=\"padding:8px;border-bottom:1px solid #eee;font-weight:bold;\">Name</td><td style=\"padding:8px;border-bottom:1px solid #eee;\">${name}</td></tr>`\n    + `<tr><td style=\"padding:8px;border-bottom:1px solid #eee;font-weight:bold;\">Email</td><td style=\"padding:8px;border-bottom:1px solid #eee;\">${email}</td></tr>`\n    + `<tr><td style=\"padding:8px;border-bottom:1px solid #eee;font-weight:bold;\">Subject</td><td style=\"padding:8px;border-bottom:1px solid #eee;\">${subject}</td></tr>`\n    + `<tr><td style=\"padding:8px;font-weight:bold;\">Message</td><td style=\"padding:8px;\">${message}</td></tr>`\n    + `</table></div>`;\n\n  return [{ json: { name, email, subject, message, autoReplyHtml, adminAlertHtml, success: true } }];\n} catch (err) {\n  return [{ json: { name: 'Unknown', email: '', subject: 'Error', message: '', autoReplyHtml: '', adminAlertHtml: '', success: false, error: err.message } }];\n}"
      },
      "id": "b1a2c3d4-e5f6-7890-abcd-100000000003",
      "name": "Extract Data",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [460, 300]
    },
    {
      "parameters": {
        "fromEmail": "noreply@yourdomain.com",
        "toEmail": "={{ $json.email }}",
        "subject": "=We received your message, {{ $json.name }}!",
        "emailType": "html",
        "html": "={{ $json.autoReplyHtml }}",
        "options": {}
      },
      "id": "b1a2c3d4-e5f6-7890-abcd-100000000004",
      "name": "Send Auto-Reply",
      "type": "n8n-nodes-base.emailSend",
      "typeVersion": 2.1,
      "position": [680, 300],
      "credentials": {
        "smtp": {
          "id": "CHANGE_ME",
          "name": "Your SMTP Account"
        }
      }
    },
    {
      "parameters": {
        "fromEmail": "noreply@yourdomain.com",
        "toEmail": "YOUR_ADMIN_EMAIL",
        "subject": "=New Contact: {{ $json.subject }} from {{ $json.name }}",
        "emailType": "html",
        "html": "={{ $json.adminAlertHtml }}",
        "options": {}
      },
      "id": "b1a2c3d4-e5f6-7890-abcd-100000000005",
      "name": "Send Admin Alert",
      "type": "n8n-nodes-base.emailSend",
      "typeVersion": 2.1,
      "position": [900, 300],
      "credentials": {
        "smtp": {
          "id": "CHANGE_ME",
          "name": "Your SMTP Account"
        }
      }
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "={{ JSON.stringify({ success: true, message: 'Contact form received. Auto-reply sent.' }) }}",
        "options": {}
      },
      "id": "b1a2c3d4-e5f6-7890-abcd-100000000006",
      "name": "Respond OK",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.1,
      "position": [1120, 300]
    }
  ],
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "Extract Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Data": {
      "main": [
        [
          {
            "node": "Send Auto-Reply",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Auto-Reply": {
      "main": [
        [
          {
            "node": "Send Admin Alert",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Admin Alert": {
      "main": [
        [
          {
            "node": "Respond OK",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "b1a2c3d4-e5f6-7890-abcd-100000000099",
  "meta": {
    "templateCredsSetupCompleted": false,
    "instanceId": "lunexo"
  },
  "pinData": {},
  "staticData": null,
  "tags": [
    { "name": "Lunexo" },
    { "name": "Email" },
    { "name": "Lead" },
    { "name": "Contact Form" }
  ]
}
