{
 "name": "Quote request form (n8n Form Trigger)",
 "nodes": [
  {
   "name": "Quote form",
   "type": "n8n-nodes-base.formTrigger",
   "typeVersion": 2.6,
   "position": [
    0,
    0
   ],
   "webhookId": "3f6a1d52-9c1e-4b7a-a0f4-5e2b8c7d9a10",
   "parameters": {
    "formTitle": "Request a quote",
    "formDescription": "Tell us what you need and we will reply within one business day.",
    "formFields": {
     "values": [
      {
       "fieldLabel": "Your name",
       "fieldName": "name",
       "fieldType": "text",
       "requiredField": true,
       "placeholder": "Jane Smith"
      },
      {
       "fieldLabel": "Email",
       "fieldName": "email",
       "fieldType": "email",
       "requiredField": true,
       "placeholder": "jane@example.com"
      },
      {
       "fieldLabel": "Phone",
       "fieldName": "phone",
       "fieldType": "text",
       "requiredField": false,
       "placeholder": "(555) 555-0100"
      },
      {
       "fieldLabel": "What do you need?",
       "fieldName": "service",
       "fieldType": "dropdown",
       "requiredField": true,
       "fieldOptions": {
        "values": [
         {
          "option": "Repair"
         },
         {
          "option": "Installation"
         },
         {
          "option": "Maintenance"
         },
         {
          "option": "Something else"
         }
        ]
       }
      },
      {
       "fieldLabel": "Tell us about the job",
       "fieldName": "details",
       "fieldType": "textarea",
       "requiredField": true,
       "placeholder": "What, where and when"
      },
      {
       "fieldLabel": "Photos (optional)",
       "fieldName": "photos",
       "fieldType": "file",
       "requiredField": false,
       "multipleFiles": true,
       "acceptFileTypes": ".jpg,.jpeg,.png,.pdf"
      },
      {
       "fieldType": "hiddenField",
       "fieldName": "source",
       "fieldValue": "direct"
      },
      {
       "fieldLabel": "Company website",
       "fieldName": "company_website",
       "fieldType": "text",
       "requiredField": false,
       "placeholder": "Leave blank"
      }
     ]
    },
    "options": {
     "path": "quote-request",
     "buttonLabel": "Send request",
     "customCss": "/* Honeypot: hide the decoy field from people, bots still see it */\n.form-group:has(#field-7) { position: absolute; left: -9999px; height: 1px; overflow: hidden; }",
     "respondWithOptions": {
      "values": {
       "respondWith": "text",
       "formSubmittedText": "Thanks, we got it. We reply to every request within one business day."
      }
     },
     "ignoreBots": true
    },
    "responseMode": "onReceived"
   },
   "id": "qf1"
  },
  {
   "name": "Looks like a real lead?",
   "type": "n8n-nodes-base.if",
   "typeVersion": 2.2,
   "position": [
    200,
    0
   ],
   "parameters": {
    "conditions": {
     "options": {
      "caseSensitive": true,
      "leftValue": "",
      "typeValidation": "loose",
      "version": 2
     },
     "conditions": [
      {
       "id": "h1",
       "leftValue": "={{ $json.company_website }}",
       "rightValue": "",
       "operator": {
        "type": "string",
        "operation": "empty",
        "singleValue": true
       }
      },
      {
       "id": "h2",
       "leftValue": "={{ $json.name }}",
       "rightValue": "",
       "operator": {
        "type": "string",
        "operation": "notEmpty",
        "singleValue": true
       }
      },
      {
       "id": "h3",
       "leftValue": "={{ $json.details }}",
       "rightValue": "",
       "operator": {
        "type": "string",
        "operation": "notEmpty",
        "singleValue": true
       }
      },
      {
       "id": "h4",
       "leftValue": "={{ $json.email }}",
       "rightValue": "^[^@\\s]+@[^@\\s]+\\.[^@\\s]+$",
       "operator": {
        "type": "string",
        "operation": "regex"
       }
      },
      {
       "id": "h5",
       "leftValue": "={{ ['Repair','Installation','Maintenance','Something else'].includes($json.service) }}",
       "rightValue": "",
       "operator": {
        "type": "boolean",
        "operation": "true",
        "singleValue": true
       }
      }
     ],
     "combinator": "and"
    },
    "options": {}
   },
   "id": "qf2"
  },
  {
   "name": "Save lead",
   "type": "n8n-nodes-base.dataTable",
   "typeVersion": 1.1,
   "position": [
    400,
    -60
   ],
   "parameters": {
    "dataTableId": {
     "__rl": true,
     "mode": "list",
     "value": ""
    },
    "columns": {
     "mappingMode": "defineBelow",
     "value": {
      "name": "={{ $json.name }}",
      "email": "={{ $json.email }}",
      "phone": "={{ $json.phone }}",
      "service": "={{ $json.service }}",
      "details": "={{ $json.details }}",
      "source": "={{ $json.source }}",
      "files": "={{ Object.keys($binary || {}).join(', ') }}",
      "submitted_at": "={{ $json.submittedAt }}"
     },
     "matchingColumns": [],
     "schema": [
      {
       "id": "name",
       "displayName": "name",
       "required": false,
       "defaultMatch": false,
       "display": true,
       "type": "string",
       "canBeUsedToMatch": true
      },
      {
       "id": "email",
       "displayName": "email",
       "required": false,
       "defaultMatch": false,
       "display": true,
       "type": "string",
       "canBeUsedToMatch": true
      },
      {
       "id": "phone",
       "displayName": "phone",
       "required": false,
       "defaultMatch": false,
       "display": true,
       "type": "string",
       "canBeUsedToMatch": true
      },
      {
       "id": "service",
       "displayName": "service",
       "required": false,
       "defaultMatch": false,
       "display": true,
       "type": "string",
       "canBeUsedToMatch": true
      },
      {
       "id": "details",
       "displayName": "details",
       "required": false,
       "defaultMatch": false,
       "display": true,
       "type": "string",
       "canBeUsedToMatch": true
      },
      {
       "id": "source",
       "displayName": "source",
       "required": false,
       "defaultMatch": false,
       "display": true,
       "type": "string",
       "canBeUsedToMatch": true
      },
      {
       "id": "files",
       "displayName": "files",
       "required": false,
       "defaultMatch": false,
       "display": true,
       "type": "string",
       "canBeUsedToMatch": true
      },
      {
       "id": "submitted_at",
       "displayName": "submitted_at",
       "required": false,
       "defaultMatch": false,
       "display": true,
       "type": "string",
       "canBeUsedToMatch": true
      }
     ]
    },
    "options": {}
   },
   "id": "qf3"
  },
  {
   "name": "Notify team",
   "type": "n8n-nodes-base.httpRequest",
   "typeVersion": 4.2,
   "position": [
    600,
    -60
   ],
   "parameters": {
    "method": "POST",
    "url": "https://hooks.slack.com/services/PASTE/YOUR/WEBHOOK",
    "sendBody": true,
    "specifyBody": "json",
    "jsonBody": "={{ JSON.stringify({ text: 'New quote request: ' + $('Quote form').item.json.name + ' <' + $('Quote form').item.json.email + '> wants ' + $('Quote form').item.json.service }) }}",
    "options": {}
   },
   "id": "qf4"
  }
 ],
 "connections": {
  "Quote form": {
   "main": [
    [
     {
      "node": "Looks like a real lead?",
      "type": "main",
      "index": 0
     }
    ]
   ]
  },
  "Save lead": {
   "main": [
    [
     {
      "node": "Notify team",
      "type": "main",
      "index": 0
     }
    ]
   ]
  },
  "Looks like a real lead?": {
   "main": [
    [
     {
      "node": "Save lead",
      "type": "main",
      "index": 0
     }
    ],
    []
   ]
  }
 },
 "settings": {
  "executionOrder": "v1"
 },
 "pinData": {},
 "meta": {
  "note": "From theautomatedshop.com. 1) Create a Data Table named quote_requests with text columns name, email, phone, service, details, source, files, submitted_at and pick it in Save lead. 2) Paste your Slack incoming-webhook URL into Notify team (or swap it for an email node). 3) Publish, then share the Production URL, not the Test URL."
 }
}