{
  "name": "Lunexo – Support FAQ Auto-Responder",
  "nodes": [
    {
      "parameters": {
        "content": "## Support FAQ Auto-Responder\n\n**What it does:** Receives support questions via webhook, classifies them into 5 categories using keyword matching, and sends a category-specific auto-reply.\n\n**Categories:**\n- Billing (invoice, payment, pricing…)\n- Technical (bug, error, crash…)\n- Shipping (delivery, tracking…)\n- Refunds (return, cancel…)\n- General (everything else)\n\n**Setup (~5 min):**\n1. Add your SMTP credentials\n2. Activate the workflow\n3. Point your support form to the webhook URL",
        "height": 300,
        "width": 350,
        "color": 5
      },
      "id": "d3e4f5a6-b7c8-9012-cdef-300000000001",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [40, 80]
    },
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "support-faq",
        "responseMode": "responseNode",
        "options": {}
      },
      "id": "d3e4f5a6-b7c8-9012-cdef-300000000002",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [240, 300],
      "webhookId": "d3e4f5a6-b7c8-9012-cdef-300000000010"
    },
    {
      "parameters": {
        "jsCode": "const input = $input.first().json;\nconst body = input.body || input;\nconst name = body.name || body.fullName || 'Customer';\nconst email = body.email || '';\nconst question = (body.question || body.message || '').toLowerCase();\n\nconst categories = {\n  billing: {\n    keywords: ['invoice','payment','price','pricing','cost','bill','charge','subscription'],\n    subject: 'Billing Support',\n    reply: `<div style=\"font-family:Arial,sans-serif;max-width:600px;margin:0 auto;padding:20px;\"><h2 style=\"color:#6C2BD9;\">Billing Support</h2><p>Hi ${name},</p><p>Thank you for reaching out about billing. Here are some quick answers:</p><ul><li>Invoices are sent automatically after each payment cycle.</li><li>You can view and download invoices from your account dashboard.</li><li>To update payment methods, go to Settings → Billing.</li><li>For subscription changes, visit Settings → Plan.</li></ul><p>If this doesn't answer your question, a billing specialist will follow up within 24 hours.</p><p style=\"color:#888;font-size:12px;\">— Lunexo Support</p></div>`\n  },\n  technical: {\n    keywords: ['bug','error','crash','broken','not working','technical','issue','problem'],\n    subject: 'Technical Support',\n    reply: `<div style=\"font-family:Arial,sans-serif;max-width:600px;margin:0 auto;padding:20px;\"><h2 style=\"color:#6C2BD9;\">Technical Support</h2><p>Hi ${name},</p><p>We're sorry you're experiencing a technical issue. Here's what you can try:</p><ul><li>Clear your browser cache and cookies, then reload.</li><li>Try a different browser or incognito/private mode.</li><li>Check our <a href=\"#\">status page</a> for any ongoing incidents.</li><li>If the issue persists, our engineering team will investigate within 24 hours.</li></ul><p>Please include any error messages or screenshots in your reply to help us diagnose faster.</p><p style=\"color:#888;font-size:12px;\">— Lunexo Support</p></div>`\n  },\n  shipping: {\n    keywords: ['shipping','delivery','track','tracking','package','shipment','dispatch'],\n    subject: 'Shipping Support',\n    reply: `<div style=\"font-family:Arial,sans-serif;max-width:600px;margin:0 auto;padding:20px;\"><h2 style=\"color:#6C2BD9;\">Shipping Support</h2><p>Hi ${name},</p><p>Here's information about shipping:</p><ul><li>Standard shipping takes 3–5 business days.</li><li>Express shipping takes 1–2 business days.</li><li>You'll receive a tracking number via email once your order ships.</li><li>Track your package at our <a href=\"#\">order tracking page</a>.</li></ul><p>If your package is delayed beyond the expected window, please reply with your order number and we'll investigate.</p><p style=\"color:#888;font-size:12px;\">— Lunexo Support</p></div>`\n  },\n  refunds: {\n    keywords: ['refund','return','money back','cancel','cancellation','reimburse'],\n    subject: 'Refund & Returns',\n    reply: `<div style=\"font-family:Arial,sans-serif;max-width:600px;margin:0 auto;padding:20px;\"><h2 style=\"color:#6C2BD9;\">Refund & Returns</h2><p>Hi ${name},</p><p>Here's our refund policy overview:</p><ul><li>Refund requests can be submitted within 30 days of purchase.</li><li>Refunds are processed within 5–7 business days.</li><li>To start a return, go to Orders → select your order → Request Return.</li><li>Cancellations before shipment are refunded immediately.</li></ul><p>If you need further help, a support agent will reach out within 24 hours.</p><p style=\"color:#888;font-size:12px;\">— Lunexo Support</p></div>`\n  },\n  general: {\n    keywords: [],\n    subject: 'Support Request Received',\n    reply: `<div style=\"font-family:Arial,sans-serif;max-width:600px;margin:0 auto;padding:20px;\"><h2 style=\"color:#6C2BD9;\">We Got Your Message</h2><p>Hi ${name},</p><p>Thank you for contacting us. We've received your question and a team member will get back to you within 24 hours.</p><p>In the meantime, you might find answers in our <a href=\"#\">Help Center</a>.</p><p style=\"color:#888;font-size:12px;\">— Lunexo Support</p></div>`\n  }\n};\n\nlet detectedCategory = 'general';\nfor (const [cat, data] of Object.entries(categories)) {\n  if (cat === 'general') continue;\n  if (data.keywords.some(kw => question.includes(kw))) {\n    detectedCategory = cat;\n    break;\n  }\n}\n\nconst matched = categories[detectedCategory];\nreturn [{ json: { name, email, question: body.question || body.message || '', category: detectedCategory, replySubject: matched.subject, replyHtml: matched.reply } }];"
      },
      "id": "d3e4f5a6-b7c8-9012-cdef-300000000003",
      "name": "Classify Question",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [460, 300]
    },
    {
      "parameters": {
        "fromEmail": "support@yourdomain.com",
        "toEmail": "={{ $json.email }}",
        "subject": "={{ $json.replySubject }}",
        "emailType": "html",
        "html": "={{ $json.replyHtml }}",
        "options": {}
      },
      "id": "d3e4f5a6-b7c8-9012-cdef-300000000004",
      "name": "Send Category Reply",
      "type": "n8n-nodes-base.emailSend",
      "typeVersion": 2.1,
      "position": [680, 300],
      "credentials": {
        "smtp": {
          "id": "CHANGE_ME",
          "name": "Your SMTP Account"
        }
      }
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "={{ JSON.stringify({ success: true, category: $json.category, message: 'Support reply sent for category: ' + $json.category }) }}",
        "options": {}
      },
      "id": "d3e4f5a6-b7c8-9012-cdef-300000000005",
      "name": "Respond",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.1,
      "position": [900, 300]
    }
  ],
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "Classify Question",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Classify Question": {
      "main": [
        [
          {
            "node": "Send Category Reply",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Category Reply": {
      "main": [
        [
          {
            "node": "Respond",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "d3e4f5a6-b7c8-9012-cdef-300000000099",
  "meta": {
    "templateCredsSetupCompleted": false,
    "instanceId": "lunexo"
  },
  "pinData": {},
  "staticData": null,
  "tags": [
    { "name": "Lunexo" },
    { "name": "Support" },
    { "name": "FAQ" }
  ]
}
