{
  "name": "Instant web-form reply (Dental practices)",
  "nodes": [
    {
      "id": "a785d669-b8b6-5be0-a4a7-76acc4fe0c7e",
      "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": "e88b54d7-af01-557c-9928-60f8306bd058"
    },
    {
      "id": "43ebba5b-cd11-59f8-955a-681d5830c3a5",
      "name": "Config (edit me)",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        220,
        0
      ],
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "6f4293a6-fd93-5c4e-8630-7b52bceb3bd3",
              "name": "business_name",
              "value": "YOUR BUSINESS NAME",
              "type": "string"
            },
            {
              "id": "105934bd-44c4-5540-a2cf-ca83d8b5c7ff",
              "name": "booking_link",
              "value": "https://YOUR-BOOKING-LINK",
              "type": "string"
            },
            {
              "id": "dbfdecb7-1a82-5224-b419-ff15d89e64c2",
              "name": "hours",
              "value": "Mon-Fri 8am-6pm",
              "type": "string"
            },
            {
              "id": "e5df2594-7b77-5f9a-b347-8b47c46b11b1",
              "name": "owner_email",
              "value": "you@example.com",
              "type": "string"
            },
            {
              "id": "ba80b8c2-de84-5adf-a5f2-2a32afc7496d",
              "name": "owner_cell",
              "value": "+15555550100",
              "type": "string"
            },
            {
              "id": "c13e81b5-0915-50ae-b5a2-a51ccaa67e74",
              "name": "twilio_number",
              "value": "+15555550199",
              "type": "string"
            },
            {
              "id": "30e2a924-d8d2-5f30-82ad-e1d3d40c98a5",
              "name": "lead_name",
              "value": "={{ $json.body.name || $json.body.first_name || 'there' }}",
              "type": "string"
            },
            {
              "id": "bc2e6c33-6c56-5b0b-9e85-5f8cfeeaec54",
              "name": "lead_phone",
              "value": "={{ $json.body.phone || '' }}",
              "type": "string"
            },
            {
              "id": "2f82a427-1869-59fd-b202-716090105554",
              "name": "lead_email",
              "value": "={{ $json.body.email || '' }}",
              "type": "string"
            },
            {
              "id": "759b0bf4-47a5-5d38-80f8-aabf363c9ac7",
              "name": "lead_message",
              "value": "={{ $json.body.message || $json.body.details || '' }}",
              "type": "string"
            }
          ]
        },
        "includeOtherFields": true,
        "options": {}
      }
    },
    {
      "id": "6051c16a-9072-513d-a212-22bb1abbd2db",
      "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": "7a9a1857-9a8e-5a98-91b8-4ed8d526bdee",
      "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 front-desk coordinator at a dental practice. Write one short, warm SMS reply (under 300 characters) to someone asking about an appointment. Welcome new patients, offer the online booking link, and say the team will follow up during office hours. Do not give medical or dental advice, do not ask for health details, do not quote prices or insurance coverage. If they mention severe pain, swelling or trauma, tell them to call the office or, if after hours and severe, seek emergency care.",
              "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": "deed98a3-e05a-5358-8c85-937fc6674fec",
      "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": "31ef08c9-519e-53a0-81e6-170f2a4190ee",
              "leftValue": "={{ $('Config (edit me)').item.json.lead_phone }}",
              "rightValue": "",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      }
    },
    {
      "id": "e28af1db-718a-5125-ab64-9120cae9668d",
      "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": "061254d8-2317-574c-8cae-f6260ee2c580",
      "name": "Has an email?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [
        880,
        60
      ],
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": false,
            "leftValue": "",
            "typeValidation": "loose"
          },
          "conditions": [
            {
              "id": "896dab77-4622-5c55-ad0f-d415547ddeea",
              "leftValue": "={{ $('Config (edit me)').item.json.lead_email }}",
              "rightValue": "",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      }
    },
    {
      "id": "892ead80-ea0c-5d5d-a57b-bbc0ef90a902",
      "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": "2c37759f-b08a-58ab-a330-ddc24481ecaa",
      "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": "771e6216-76f8-57ab-9fb2-1a87b9508d47",
      "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": []
}