{
  "id": "Lv9oRZsJbywQxyXP",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Smart Lead Welcomer (Dental)",
  "tags": [],
  "nodes": [
    {
      "id": "b00450c4-4bf7-4d87-a2c4-dbdf3afc5638",
      "name": "Google Sheets Trigger",
      "type": "n8n-nodes-base.googleSheetsTrigger",
      "position": [
        -16,
        48
      ],
      "parameters": {
        "event": "rowAdded",
        "options": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 951804608,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/",
          "cachedResultName": "Form responses 1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1RLC2D_t-NYuhbKD8WV-EPh_INH7idEVhslXNbP2-jSE",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/",
          "cachedResultName": " Smart Lead Welcomer (Dental)"
        }
      },
      "credentials": {
        "googleSheetsTriggerOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "873655e8-0f44-4583-9314-42b8493c41e0",
      "name": "Wait",
      "type": "n8n-nodes-base.wait",
      "position": [
        256,
        48
      ],
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "7fe90709-0b71-413d-a580-28f97b8cb483",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -816,
        -528
      ],
      "parameters": {
        "color": 6,
        "width": 464,
        "height": 240,
        "content": "## \u26a0\ufe0f The Problem\n**Dental clinics lose many new leads.\n\nPatients submit forms (teeth whitening, Invisalign, implants, etc.) but:\n\nThey only get a generic thank-you (not engaging).\n\nBy the time the clinic calls, many never respond.\n\nThis means lost revenue + cold leads."
      },
      "typeVersion": 1
    },
    {
      "id": "4c2bd99e-ed16-4e45-b35f-faa07191f274",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        528,
        48
      ],
      "parameters": {
        "text": "=Patient Details:\n- Full Name: {{$json[\"Full Name\"]}}\n- Email: {{$json[\"Email\"]}}\n- Treatment Interest: {{ $json[' What are you most interested in?'] }}\n- Dental Concern: {{$json[\"What\u2019s your main dental concern right now? (e.g., yellow teeth, missing tooth, crooked smile)\"]}}\n- Contact Method: {{ $json[' What\u2019s the best way to reach you?'] }}\n- Contact Time: {{$json[\"What\u2019s the best time to reach you?\"]}}\n",
        "options": {
          "systemMessage": "=You are a friendly and professional dental clinic assistant for SmileBright Dental. \nYour task is to write a short, warm, and engaging welcome email based on the patient's form inputs. \nTailor the email to their treatment choice, mentioning it positively (e.g., Teeth Whitening \u2192 \u2728 brighter smile, Invisalign \u2192 \ud83d\ude01 confident smile, Dental Implants \u2192 \ud83e\uddb7 restored smile). \nUse their main dental concern for personalization. \nEncourage them to book an appointment and include their preferred contact method and time. \nKeep the tone enthusiastic, professional, and concise. \n\n\u26a0\ufe0f Important: Return the output as a complete **HTML email** with:\n- A subject line in `<title>` at the top (for the email subject)\n- An `<h1>` or `<h2>` for greeting\n- Paragraphs `<p>` for the body\n- Emojis to make it friendly\n- A clear clickable call-to-action button (`<a href=\"https://wa.me/...\" style=\"...\">Book Appointment</a>`)\n\nDo not return JSON or plain text. Only valid HTML.\n"
        },
        "promptType": "define"
      },
      "typeVersion": 2.2
    },
    {
      "id": "800070a1-e597-4e9e-a648-76c2e7360e0d",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        496,
        -144
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-3.5-turbo",
          "cachedResultName": "gpt-3.5-turbo"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "d4667734-2bd0-4a0d-a35f-cf286ea976d0",
      "name": "Think",
      "type": "@n8n/n8n-nodes-langchain.toolThink",
      "position": [
        736,
        -144
      ],
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "697650aa-7639-49ba-a49a-c1bd04186d46",
      "name": "Simple Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        624,
        -144
      ],
      "parameters": {
        "sessionKey": "={{ $('Google Sheets Trigger').item.json['Email address'] }}",
        "sessionIdType": "customKey"
      },
      "typeVersion": 1.3
    },
    {
      "id": "ac13787d-2893-4572-bcb9-d6632008d4e4",
      "name": "Send a message",
      "type": "n8n-nodes-base.gmail",
      "position": [
        944,
        -48
      ],
      "parameters": {
        "sendTo": "={{ $('Google Sheets Trigger').item.json.Email }}",
        "message": "={{ $json.output }}",
        "options": {
          "appendAttribution": false
        },
        "subject": "=Welcome to SmileBright Dental"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "b79c7074-b933-495f-9475-6192f40c6284",
      "name": "Send a message1",
      "type": "n8n-nodes-base.gmail",
      "position": [
        960,
        160
      ],
      "parameters": {
        "sendTo": "user@example.com",
        "message": "=A new patient lead has arrived \ud83c\udf89  Name:{{ $('Google Sheets Trigger').item.json['Full Name'] }}  Email:{{ $('Google Sheets Trigger').item.json['Email address'] }} Phone: {{ $('Google Sheets Trigger').item.json['Phone no'] }}Treatment Interest: {{ $('Google Sheets Trigger').item.json[' What are you most interested in?'] }}Dental Concern:{{ $('Google Sheets Trigger').item.json['What\u2019s your main dental concern right now? (e.g., yellow teeth, missing tooth, crooked smile)'] }}\nPlease follow up with them on {{ $('Google Sheets Trigger').item.json[' What\u2019s the best way to reach you?'] }} in the{{ $('Google Sheets Trigger').item.json['What\u2019s the best time to reach you?'] }}",
        "options": {
          "appendAttribution": false
        },
        "subject": "=New Lead  {{ $('Google Sheets Trigger').item.json['Full Name'] }}",
        "emailType": "text"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "6d27638f-ce3d-48b7-98ea-b4ea5c1b45f6",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -224,
        -80
      ],
      "parameters": {
        "width": 512,
        "height": 128,
        "content": "##  Trigger\n\u26a1 Fires when a new patient submits the form.\nform is: https://docs.google.com/forms/u/0/d/e/1FAIpQLSevL3LaoKWTLuekELB0Mrp6k5jVh5WZockkdv0Lefn1_YjtXg/formResponse"
      },
      "typeVersion": 1
    },
    {
      "id": "fd709424-75ff-4c66-950f-4753471428aa",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -192,
        208
      ],
      "parameters": {
        "color": 3,
        "width": 304,
        "height": 192,
        "content": "## \ud83d\udcca Save every lead for clinic records."
      },
      "typeVersion": 1
    },
    {
      "id": "4de5d999-378f-45f4-80fb-bc1b0d84643b",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        432,
        -288
      ],
      "parameters": {
        "color": 5,
        "width": 432,
        "height": 592,
        "content": "## AI AGENT \n\ud83e\udd16 Generate friendly, personalized welcome message."
      },
      "typeVersion": 1
    },
    {
      "id": "b4a45166-fe5e-46b2-95b0-e6841986908e",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1152,
        -64
      ],
      "parameters": {
        "color": 7,
        "content": "## Patient Notification\n \n**SEND** \ud83d\udce7 personalized welcome email ,appointment notification,immediately."
      },
      "typeVersion": 1
    },
    {
      "id": "f5247169-9177-47d0-984d-29b2afca881b",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1152,
        192
      ],
      "parameters": {
        "color": 7,
        "content": "## Dentist Notification\n \n**SEND** \ud83d\udce7 personalized welcome email ,appointment notification,immediately."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "b7e9eecf-b28b-49d8-97cb-10a7a33931f8",
  "connections": {
    "Wait": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Think": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Send a message1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Send a message1": {
      "main": [
        [
          {
            "node": "Send a message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Google Sheets Trigger": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}