{
  "name": "Instant web-form reply (Plumbing & HVAC)",
  "nodes": [
    {
      "id": "33e2d710-bfb2-5e77-8bc7-4321772c7f5a",
      "name": "New lead from your form",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        0,
        0
      ],
      "parameters": {
        "httpMethod": "POST",
        "path": "new-lead",
        "responseMode": "responseNode",
        "options": {}
      },
      "webhookId": "0575b059-d4c2-59cc-9508-d6fcf547a968"
    },
    {
      "id": "49a4577d-2156-5a0f-8979-803aa33de9b0",
      "name": "Config (edit me)",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        220,
        0
      ],
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "1b28666f-7ea6-5e25-8506-29d8f5a3716c",
              "name": "business_name",
              "value": "YOUR BUSINESS NAME",
              "type": "string"
            },
            {
              "id": "9abb0e68-2606-5987-8248-0c48952e3418",
              "name": "booking_link",
              "value": "https://YOUR-BOOKING-LINK",
              "type": "string"
            },
            {
              "id": "13ca00db-bb03-5d9a-9240-57e1b9601c93",
              "name": "hours",
              "value": "Mon-Fri 8am-6pm",
              "type": "string"
            },
            {
              "id": "9cd9b132-1b27-5188-9d06-d50ee53dbe93",
              "name": "owner_email",
              "value": "you@example.com",
              "type": "string"
            },
            {
              "id": "afad8fb5-9349-5454-9024-4211dcbe8d55",
              "name": "owner_cell",
              "value": "+15555550100",
              "type": "string"
            },
            {
              "id": "e737ff78-2495-5017-8f36-600cae602ff0",
              "name": "twilio_number",
              "value": "+15555550199",
              "type": "string"
            },
            {
              "id": "51b52786-8f4c-5b0f-98fc-d1c8771eec75",
              "name": "lead_name",
              "value": "={{ $json.body.name || $json.body.first_name || 'there' }}",
              "type": "string"
            },
            {
              "id": "c6f73f39-4f44-5023-be3d-81cfc68b8150",
              "name": "lead_phone",
              "value": "={{ $json.body.phone || '' }}",
              "type": "string"
            },
            {
              "id": "5d81e850-8b42-5f78-b934-7f323012e01d",
              "name": "lead_email",
              "value": "={{ $json.body.email || '' }}",
              "type": "string"
            },
            {
              "id": "a194d0ca-2862-5c18-bd47-a215c9beb031",
              "name": "lead_message",
              "value": "={{ $json.body.message || $json.body.details || '' }}",
              "type": "string"
            }
          ]
        },
        "includeOtherFields": true,
        "options": {}
      }
    },
    {
      "id": "110c8dc6-ae1b-572d-a3a7-cb57187843b0",
      "name": "Tell the form it worked",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.1,
      "position": [
        440,
        0
      ],
      "parameters": {
        "respondWith": "text",
        "responseBody": "{\"ok\": true}",
        "options": {
          "responseHeaders": {
            "entries": [
              {
                "name": "Content-Type",
                "value": "application/json"
              }
            ]
          }
        }
      }
    },
    {
      "id": "903e20f2-5c79-5cad-8e6f-285d664fa3e1",
      "name": "AI writes reply",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "typeVersion": 1.8,
      "position": [
        660,
        0
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "value": "gpt-5-mini",
          "mode": "id"
        },
        "messages": {
          "values": [
            {
              "content": "You are the friendly dispatcher for a local plumbing and HVAC company. Write one short, warm SMS reply (under 300 characters) to a new lead. Acknowledge their problem in plain words, say a technician will call them shortly, and if they describe water actively leaking, gas smell, no heat in freezing weather or no AC in extreme heat, tell them to reply URGENT. Never quote prices. Never promise an exact arrival time. Sign off with the business name.",
              "role": "system"
            },
            {
              "content": "=Business: {{ $('Config (edit me)').item.json.business_name }}\nHours: {{ $('Config (edit me)').item.json.hours }}\nBooking link: {{ $('Config (edit me)').item.json.booking_link }}\nLead name: {{ $('Config (edit me)').item.json.lead_name }}\nWhat they wrote: {{ $('Config (edit me)').item.json.lead_message }}"
            }
          ]
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "REPLACE_OPENAI_CREDENTIAL",
          "name": "OpenAI account (placeholder)"
        }
      }
    },
    {
      "id": "773a181a-d05b-5d68-9de0-6d24cc44602e",
      "name": "Has a phone number?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [
        880,
        -140
      ],
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": false,
            "leftValue": "",
            "typeValidation": "loose"
          },
          "conditions": [
            {
              "id": "daff0eba-a344-53fe-bb7b-4ffb4656b42c",
              "leftValue": "={{ $('Config (edit me)').item.json.lead_phone }}",
              "rightValue": "",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      }
    },
    {
      "id": "1e8c7ef3-5e76-5a54-8f03-d59974956c44",
      "name": "Text the lead",
      "type": "n8n-nodes-base.twilio",
      "typeVersion": 1,
      "position": [
        1100,
        -140
      ],
      "parameters": {
        "from": "={{ $('Config (edit me)').item.json.twilio_number }}",
        "to": "={{ $('Config (edit me)').item.json.lead_phone }}",
        "message": "={{ $('AI writes reply').item.json.message.content }}",
        "options": {}
      },
      "credentials": {
        "twilioApi": {
          "id": "REPLACE_TWILIO_CREDENTIAL",
          "name": "Twilio account (placeholder)"
        }
      }
    },
    {
      "id": "b9d64fb3-675b-5fe0-9e03-d2c4553a59f3",
      "name": "Has an email?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [
        880,
        60
      ],
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": false,
            "leftValue": "",
            "typeValidation": "loose"
          },
          "conditions": [
            {
              "id": "5cb049eb-d3ce-5c43-abc3-61dd5327f5d5",
              "leftValue": "={{ $('Config (edit me)').item.json.lead_email }}",
              "rightValue": "",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      }
    },
    {
      "id": "e40b5527-1315-51f2-9b05-0acc58004492",
      "name": "Email the lead",
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.1,
      "position": [
        1100,
        60
      ],
      "parameters": {
        "sendTo": "={{ $('Config (edit me)').item.json.lead_email }}",
        "subject": "=Thanks for reaching out to {{ $('Config (edit me)').item.json.business_name }}",
        "emailType": "text",
        "message": "={{ $('AI writes reply').item.json.message.content }}",
        "options": {}
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "REPLACE_GMAIL_CREDENTIAL",
          "name": "Gmail account (placeholder)"
        }
      }
    },
    {
      "id": "7e1353af-5ad8-56c7-b425-62aae801f4f1",
      "name": "Email the owner",
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.1,
      "position": [
        880,
        260
      ],
      "parameters": {
        "sendTo": "={{ $('Config (edit me)').item.json.owner_email }}",
        "subject": "=New lead: {{ $('Config (edit me)').item.json.lead_name }}",
        "emailType": "text",
        "message": "=Name: {{ $('Config (edit me)').item.json.lead_name }}\nPhone: {{ $('Config (edit me)').item.json.lead_phone }}\nEmail: {{ $('Config (edit me)').item.json.lead_email }}\nMessage: {{ $('Config (edit me)').item.json.lead_message }}\n\nWe already replied with: {{ $('AI writes reply').item.json.message.content }}",
        "options": {}
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "REPLACE_GMAIL_CREDENTIAL",
          "name": "Gmail account (placeholder)"
        }
      }
    },
    {
      "id": "f7bc1cfb-0842-5e65-8a15-fa8eeee3a055",
      "name": "Setup steps",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -520,
        -160
      ],
      "parameters": {
        "content": "## Setup (about 1 hour)\n1. Fill in **Config (edit me)**.\n2. Connect your own **Twilio**, **OpenAI** and **Gmail** credentials on the red nodes.\n3. Point your website form to POST to `YOUR_N8N_URL/webhook/new-lead` with fields `name`, `phone`, `email`, `message` (or forward lead emails with a Gmail filter + an Email Trigger node).\n4. Register your Twilio number for A2P 10DLC.\n5. Send yourself a test lead, then activate.",
        "height": 380,
        "width": 460
      }
    }
  ],
  "connections": {
    "New lead from your form": {
      "main": [
        [
          {
            "node": "Config (edit me)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Config (edit me)": {
      "main": [
        [
          {
            "node": "Tell the form it worked",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Tell the form it worked": {
      "main": [
        [
          {
            "node": "AI writes reply",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI writes reply": {
      "main": [
        [
          {
            "node": "Has a phone number?",
            "type": "main",
            "index": 0
          },
          {
            "node": "Has an email?",
            "type": "main",
            "index": 0
          },
          {
            "node": "Email the owner",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Has a phone number?": {
      "main": [
        [
          {
            "node": "Text the lead",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Has an email?": {
      "main": [
        [
          {
            "node": "Email the lead",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "pinData": {},
  "meta": {
    "templateCredsSetupCompleted": false,
    "generatedBy": "Speed-to-Lead Playbooks"
  },
  "tags": []
}