{
  "name": "Template - Appointment Booking Agent (Free Version) - fabimarkl.com",
  "nodes": [
    {
      "parameters": {
        "content": "## Qualification and Appointment Selection",
        "height": 440,
        "width": 780,
        "color": 4
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        272,
        352
      ],
      "id": "6d6ca4c3-adbe-48ab-9cfe-f4eab196828f",
      "name": "Sticky Note1"
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "=UserInput: {{ $json.message.text }}",
        "options": {
          "systemMessage": "=#IMPORTANT:\nAppointments can only be booked after collecting customer name, email, and service preference.\n\n#Identity\nYou're Zen Touch Massage & Spa's friendly WhatsApp booking assistant.\n\n#Back Context\n- Zen Touch Massage & Spa is a premium wellness center offering therapeutic massage and spa treatments\n- We're open Monday-Friday 9am-7pm\n- Located at Maximilianstraße 35, 80539 München (near Odeonsplatz)\n- All therapists are licensed professionals with 5+ years experience\n\n#Services We Offer:\n- Quick Massage (15 min) - $35\n- Express Relief Massage (30 min) - $65\n- Relaxation Massage (45 min) - $85\n- Deep Healing Massage (90 min) - $145\n\n#Booking Links (CRITICAL — use the exact link for the selected service):\n- Quick Massage → https://cal.com/fabimarkl/quick-massage\n- Express Relief Massage → https://cal.com/fabimarkl/express-relief-massage\n- Relaxation Massage → https://cal.com/fabimarkl/relaxation-massage\n- Deep Healing Massage → https://cal.com/fabimarkl/deep-massage\n\n#Role\nWhen someone messages, warmly greet them and help them book their perfect relaxation session. Ask a few quick questions to understand their needs, collect name and email, then send them their personalized booking link.\n\n#Tone\nWarm. Professional. Relaxing. Like a friendly spa receptionist who genuinely cares about your wellness.\n\n---\n\n#Conversation Flow\n\n## Initial reply to first message:\n\nHi there! 🌿 Welcome to Zen Touch Massage & Spa! I'm here to help you book your perfect relaxation session.\n\nMind if I ask you a few quick questions to find the right service for you?\n\nAsk these one by one (wait for their answers):\n\n**a) Which massage service interests you today?**\n\nIf answer == \"not sure\" or \"what do you have\":\n→ We offer four wonderful options:\n  • Quick Massage (15 min) - $35 – Perfect for quick pain relief\n  • Express Relief Massage (30 min) - $65 – Perfect for busy schedules\n  • Relaxation Massage (45 min) - $85 – Our most popular choice\n  • Deep Healing Massage (90 min) - $145 – Complete therapeutic experience\n\n  Which sounds right for you?\nElse:\n  Continue\n\n**b) Is this your first visit to Zen Touch?**\n\nIf answer == \"yes\":\n→ Wonderful! As a first-time guest, you'll receive 15% off. Please arrive 15 minutes early for a brief consultation.\nElse:\n→ Welcome back! Great to have you with us again.\n\n---\n\n## Collect Contact Info:\n→ Perfect! To complete your booking, I'll need your name, email and phone number.\n\nAfter the user responds with name and email:\n- Save to \"Lead_Capture Google Sheet\" (name=[captured_name], email=[captured_email], phoneNumber=[captured_phone], summary=[service name requested + duration + first time or returning client; no linebreaks or special characters]), ContactID = {{ $json.message.from.id }}\n- Only call the Lead_Capture Google Sheet tool ONCE — after both name and email are collected. Do not repeat this step.\n\n---\n\n## Send Booking Link:\n\nAfter saving the lead, send this message (use the correct link for their service):\n\n\"Thanks [name]! 🌿 Here's your personal booking link for the [service name]:\n\n👉 [insert correct booking link here]\n\nJust pick a time that works for you — it only takes a minute. Please note we have a 24-hour cancellation policy. See you soon! 💆‍♀️\"\n\n---\n\n#Rules:\n- One question at a time.\n- Keep it light, warm, and easy to reply to.\n- Emojis are fine, but not too many (spa-appropriate only 🌿 💆‍♀️ ✨).\n- If someone types 'RESET' then start from the very beginning.\n- Never send the booking link without first collecting name, email, and service preference.\n- Never repeat a question once it has been answered.\n- If the user says something like \"I just told you\" or \"already sent\", stop and proceed as if the info was provided.\n- Always check the last few messages before replying to avoid repeating yourself.\n- For prenatal or medical massages, confirm they have doctor's approval before sending the link."
        }
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 2,
      "position": [
        544,
        432
      ],
      "id": "fbc8cf60-5dca-4ff9-9601-2bab78ead711",
      "name": "AI Agent"
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "value": "gpt-5.4",
          "mode": "list",
          "cachedResultName": "gpt-5.4"
        },
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.2,
      "position": [
        432,
        560
      ],
      "id": "f33353ff-e112-4372-8cb7-0623f97bb4a1",
      "name": "OpenAI Chat Model",
      "credentials": {
        "openAiApi": {
          "id": "BtsDVHuiHTT1gHLM",
          "name": "OpenAi account 19"
        }
      }
    },
    {
      "parameters": {
        "sessionIdType": "customKey",
        "sessionKey": "={{ $json.message.from.id }}",
        "contextWindowLength": 50
      },
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "typeVersion": 1.3,
      "position": [
        544,
        608
      ],
      "id": "1433aa02-535a-494d-bb34-6312b2388c16",
      "name": "Simple Memory"
    },
    {
      "parameters": {
        "operation": "appendOrUpdate",
        "documentId": {
          "__rl": true,
          "value": "1pdNU4i0PKZ37yvrtMUqfkkb-a-__r8y5jCkvCjpwXZg",
          "mode": "list",
          "cachedResultName": "demo 4.6. -  Automated WhatsApp AI booking assistant for businesses",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1pdNU4i0PKZ37yvrtMUqfkkb-a-__r8y5jCkvCjpwXZg/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": 1915567193,
          "mode": "list",
          "cachedResultName": "Leads",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1pdNU4i0PKZ37yvrtMUqfkkb-a-__r8y5jCkvCjpwXZg/edit#gid=1915567193"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "Contact ID": "={{ $json.message.from.id }}",
            "Email": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Email__using_to_match_', ``, 'string') }}",
            "Name": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Name', ``, 'string') }}",
            "Phone Number": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Phone_Number', ``, 'string') }}",
            "Summary": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Summary', `this is the detailed summary of what the suers responded and requested. `, 'string') }}"
          },
          "matchingColumns": [
            "Email"
          ],
          "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,
              "removed": false
            },
            {
              "id": "Phone Number",
              "displayName": "Phone Number",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Summary",
              "displayName": "Summary",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Booked",
              "displayName": "Booked",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Event Name",
              "displayName": "Event Name",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "EventID",
              "displayName": "EventID",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Appointment Date",
              "displayName": "Appointment Date",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "SMS Reminder Sent",
              "displayName": "SMS Reminder Sent",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Contact ID",
              "displayName": "Contact ID",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheetsTool",
      "typeVersion": 4.6,
      "position": [
        704,
        640
      ],
      "id": "f8a366ff-1c0d-4509-8053-ed58db74ad86",
      "name": "Lead_Capture",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "f0Vp1Lk3R1WC9AoW",
          "name": "Google Sheets account 53"
        }
      }
    },
    {
      "parameters": {
        "content": "![Source example](https://upload.wikimedia.org/wikipedia/commons/5/5e/WhatsApp_icon.png?20200503174721#full-width)",
        "height": 300,
        "width": 260,
        "color": 7
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        0,
        0
      ],
      "id": "19147a54-875e-40d9-b8da-fddd7401ee0f",
      "name": "Sticky Note3"
    },
    {
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "type": "n8n-nodes-base.telegramTrigger",
      "typeVersion": 1.2,
      "position": [
        304,
        432
      ],
      "id": "e367d02e-8936-4255-97e1-7357be1b4271",
      "name": "Telegram Trigger",
      "webhookId": "32a68d7f-fde2-4290-b5f7-f8858bcf02aa",
      "credentials": {
        "telegramApi": {
          "id": "qBmAODbEwKeM6v2b",
          "name": "CallBookingsAI"
        }
      }
    },
    {
      "parameters": {
        "chatId": "={{ $('Telegram Trigger').item.json.message.from.id }}",
        "text": "={{ $json.output }}",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        864,
        432
      ],
      "id": "4aa6735b-b6d1-42c1-8716-167ec6bcb079",
      "name": "Send a text message",
      "webhookId": "57a5c21c-3373-47ca-9870-309360b8a7d7",
      "credentials": {
        "telegramApi": {
          "id": "qBmAODbEwKeM6v2b",
          "name": "CallBookingsAI"
        }
      }
    }
  ],
  "pinData": {},
  "connections": {
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Lead_Capture": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Send a text message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "a004a2a3-4b2d-4401-8cb2-b0fea1357d58",
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "7ff6625f0127f3e9a7865e3493009de1c48f57dc5ed87def3ae3316be7f6b238"
  },
  "id": "ESl8D5hLJxreCaI0",
  "tags": []
}