{
  "id": "OuMVyHH0IcL51eRb",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "n8n-salon-appointment-booking-agent",
  "tags": [],
  "nodes": [
    {
      "id": "a2bcb9ef-6210-4d3a-8017-0fc50924e417",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -64,
        -128
      ],
      "parameters": {
        "text": "=[Identity]\n\nYou are an AI assistant for GlamourEdge Salon, a smart and helpful digital receptionist designed to handle service inquiries, manage bookings, and assist with appointment modifications or cancellations.\n\n[Style]\n\nSpeak in a warm, human tone, like chatting with a client on WhatsApp.\n\nRespond naturally, clearly, and respectfully.\n\nAlways return output in WhatsApp chat-friendly format:\n\nUse line breaks (\\n) for separate sentences.\n\nUse friendly, concise language.\n\nOptional emojis for casual friendliness (\ud83d\ude0a, \ud83d\udc87\u200d\u2640\ufe0f, \ud83d\udcc5, \u23f0).\n\nKeep answers helpful, short, and human-like, never robotic.\n\nAlways polite and provide next steps.\n\n[Response Guidelines]\n\nAlways respond only after calling the appropriate tool.\n\nCall the tool according to the user\u2019s intent (service info, stylist details, availability, booking, cancel, edit).\n\nIn StylistAvailableSlots Tool, always pass services as an array.\n\nStructure responses in conversational WhatsApp style, not lists.\n\nNever share or speak URLs.\n\nRefer to today as {{$now.day}} and current time as {{$now}}.\n\nRespect privacy: never repeat personal info unless necessary.\n\nUse phone number from {{ $json.data.from }} for booking.\n\nKeep replies short, friendly, and human-like.\n\n[Task & Goals]\n\ud83d\udd39 Service Inquiries\n\nCall SalonServices Tool to fetch current services.\n\nIf requested service unavailable \u2192 politely suggest valid services.\n\nWait for user confirmation before moving to stylists.\n\nIf confirmed \u2192 call StylistDetails Tool and ask if they want to check availability.\n\n\ud83d\udd39 Booking Appointments\n\nStep-by-step flow: service \u2192 stylist \u2192 time.\n\nCall StylistAvailableSlots Tool (services must be an array).\n\nSuggest only future slots.\n\nIf multiple services \u2192 stack them:\n\n\u201cYou can have this right after your haircut.\u201d\n\nOnce slot chosen \u2192 confirm approximate end time (final confirmation only).\n\nBefore calling booking tool, verify:\n\nService chosen\n\nStylist chosen\n\nDate & Time confirmed\n\nUser name\n\nUser email\n\nUser phone: {{ $json.data.from }} (do not ask the user)\n\nIf any detail missing \u2192 ask politely first.\n\nWhen all details are ready \u2192 call UserSalonBooking Tool and confirm.\n\n\ud83d\udd39 Cancel Appointment\n\nAsk for phone number.\n\nCall GetUserAppointmentDetails Tool.\n\nConfirm details \u2192 ask reason \u2192 call UserCancelAppointment Tool.\n\n\ud83d\udd39 Edit Appointment\n\nAsk for phone number.\n\nCall GetUserAppointmentDetails Tool.\n\nConfirm existing appointment.\n\nAsk what they want to change (service, stylist, date/time).\n\nValidate with GetStylistAndServices Tool.\n\nIf valid \u2192 update via UpdateBooking Tool.\n\n[Error Handling / Fallback]\n\nStylist/service not found \u2192 suggest alternatives.\n\nSlot unavailable \u2192 suggest nearest future slot.\n\nBooking info incomplete \u2192 ask politely for missing details before tool call.\n\nSystem error \u2192 apologize and silently trigger transfer_call_tool.\n\n[WhatsApp Formatting Rules]\n\nAlways reply in WhatsApp chat style.\n\nWhen user selects multiple services \u2192 show them in WhatsApp with simple bullet points or numbers.\n\nUse line breaks for clarity.\n\nKeep messages friendly, short, and human-like.\n\nOptional emojis (\ud83d\ude0a, \ud83d\udc87\u200d\u2640\ufe0f, \ud83d\udcc5, \u23f0).\n\nNo Markdown tables or lists; just plain text with natural line breaks.\n\n[User Input]\n\nHere is the user input:\n\n{{ $json.data.body }}",
        "options": {},
        "promptType": "define"
      },
      "typeVersion": 2.2
    },
    {
      "id": "a0c064d7-8443-4e67-86cb-cb97f0707efd",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -448,
        64
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "3c8fe6e3-f40a-4d51-b442-40601141a28b",
      "name": "Simple Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        -320,
        144
      ],
      "parameters": {
        "sessionKey": "={{ $json.data.from }}",
        "sessionIdType": "customKey",
        "contextWindowLength": 10
      },
      "typeVersion": 1.3
    },
    {
      "id": "cf9c618c-48de-43da-9bc4-c6287f3b41eb",
      "name": "Booking services",
      "type": "n8n-nodes-base.googleSheetsTool",
      "position": [
        352,
        192
      ],
      "parameters": {
        "columns": {
          "value": {
            "Date": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Date', `send user selected date in this format:YYYY-MM-DD`, 'string') }}",
            "Phone": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Phone', `Send user Phone number`, 'string') }}",
            "Services": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Services', `Send user Services in array  if user choose multiple services than pass in array, like [\"haircut\",\"spa\"] this type`, 'string') }}",
            "Start_time": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Start_time', `Send user Services Start Time in this format. hh:mm`, 'string') }}",
            "Stylist_name": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Stylist_name', `Send user selected stylist name`, 'string') }}",
            "customer_name": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('customer_name', `send user name`, 'string') }}"
          },
          "schema": [
            {
              "id": "Date",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Phone",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Phone",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Services",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Services",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Start_time",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Start_time",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Stylist_name",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Stylist_name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "customer_name",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "customer_name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1jF0ACPiyK1gk4J_oWwpMQ8KG9Wek8RtG8Ay2npJClak/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1jF0ACPiyK1gk4J_oWwpMQ8KG9Wek8RtG8Ay2npJClak",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1jF0ACPiyK1gk4J_oWwpMQ8KG9Wek8RtG8Ay2npJClak/edit?usp=drivesdk",
          "cachedResultName": "Salon Booking manage"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "ed3cb5f0-d9d6-49fe-b3f6-c116568ffd80",
      "name": "SuggestStylist",
      "type": "n8n-nodes-base.googleSheetsTool",
      "position": [
        -64,
        240
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 1978384237,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1jF0ACPiyK1gk4J_oWwpMQ8KG9Wek8RtG8Ay2npJClak/edit#gid=1978384237",
          "cachedResultName": "SuggestStylist"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1jF0ACPiyK1gk4J_oWwpMQ8KG9Wek8RtG8Ay2npJClak",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1jF0ACPiyK1gk4J_oWwpMQ8KG9Wek8RtG8Ay2npJClak/edit?usp=drivesdk",
          "cachedResultName": "Salon Booking manage"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "84636255-2f7a-4f51-aa01-f64e6970dc8b",
      "name": "openingHour",
      "type": "n8n-nodes-base.googleSheetsTool",
      "position": [
        224,
        224
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 1322339636,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1jF0ACPiyK1gk4J_oWwpMQ8KG9Wek8RtG8Ay2npJClak/edit#gid=1322339636",
          "cachedResultName": "openingHour"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1jF0ACPiyK1gk4J_oWwpMQ8KG9Wek8RtG8Ay2npJClak",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1jF0ACPiyK1gk4J_oWwpMQ8KG9Wek8RtG8Ay2npJClak/edit?usp=drivesdk",
          "cachedResultName": "Salon Booking manage"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "9c0ed897-c90a-4fac-9c97-7b133bc62699",
      "name": "salonservices",
      "type": "n8n-nodes-base.googleSheetsTool",
      "position": [
        -192,
        192
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 1011822210,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1jF0ACPiyK1gk4J_oWwpMQ8KG9Wek8RtG8Ay2npJClak/edit#gid=1011822210",
          "cachedResultName": "Services"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1jF0ACPiyK1gk4J_oWwpMQ8KG9Wek8RtG8Ay2npJClak",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1jF0ACPiyK1gk4J_oWwpMQ8KG9Wek8RtG8Ay2npJClak/edit?usp=drivesdk",
          "cachedResultName": "Salon Booking manage"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "7ee2db3a-980a-4357-9e8b-66c27b6f853c",
      "name": "perticullerstylistsdetails",
      "type": "n8n-nodes-base.googleSheetsTool",
      "position": [
        480,
        144
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 1861968928,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1jF0ACPiyK1gk4J_oWwpMQ8KG9Wek8RtG8Ay2npJClak/edit#gid=1861968928",
          "cachedResultName": "PerticullerStylistsDetails"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1jF0ACPiyK1gk4J_oWwpMQ8KG9Wek8RtG8Ay2npJClak",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1jF0ACPiyK1gk4J_oWwpMQ8KG9Wek8RtG8Ay2npJClak/edit?usp=drivesdk",
          "cachedResultName": "Salon Booking manage"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "2dfde257-a813-40d4-8114-c5f35ab88d3e",
      "name": "Updatebooking",
      "type": "n8n-nodes-base.googleSheetsTool",
      "position": [
        592,
        96
      ],
      "parameters": {
        "columns": {
          "value": {
            "Date": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Date', ``, 'string') }}",
            "Phone": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Phone__using_to_match_', ``, 'string') }}",
            "Services": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Services', ``, 'string') }}",
            "Start_time": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Start_time', ``, 'string') }}",
            "Stylist_name": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Stylist_name', ``, 'string') }}",
            "customer_name": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('customer_name', ``, 'string') }}"
          },
          "schema": [
            {
              "id": "Date",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Phone",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Phone",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Services",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Services",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Start_time",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Start_time",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Stylist_name",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Stylist_name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "customer_name",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "customer_name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Phone"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1jF0ACPiyK1gk4J_oWwpMQ8KG9Wek8RtG8Ay2npJClak/edit#gid=0",
          "cachedResultName": "Order Booking"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1jF0ACPiyK1gk4J_oWwpMQ8KG9Wek8RtG8Ay2npJClak",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1jF0ACPiyK1gk4J_oWwpMQ8KG9Wek8RtG8Ay2npJClak/edit?usp=drivesdk",
          "cachedResultName": "Salon Booking manage"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "2437b396-4f00-4b9e-bdd3-079c966ddf96",
      "name": "Getbookingdetails",
      "type": "n8n-nodes-base.googleSheetsTool",
      "position": [
        96,
        240
      ],
      "parameters": {
        "options": {},
        "filtersUI": {
          "values": [
            {
              "lookupValue": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('values0_Value', ``, 'string') }}",
              "lookupColumn": "Phone"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1jF0ACPiyK1gk4J_oWwpMQ8KG9Wek8RtG8Ay2npJClak/edit#gid=0",
          "cachedResultName": "Order Booking"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1jF0ACPiyK1gk4J_oWwpMQ8KG9Wek8RtG8Ay2npJClak",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1jF0ACPiyK1gk4J_oWwpMQ8KG9Wek8RtG8Ay2npJClak/edit?usp=drivesdk",
          "cachedResultName": "Salon Booking manage"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "66a50036-1492-46f8-9706-590c34ad413a",
      "name": "Send an SMS/MMS/WhatsApp message",
      "type": "n8n-nodes-base.twilio",
      "position": [
        448,
        -128
      ],
      "parameters": {
        "to": "={{ $('Twilio Trigger').item.json.data.from.split(\"+\")[1] }}",
        "from": "={{ $('Twilio Trigger').item.json.data.to.split(\"+\")[1] }}",
        "message": "={{ $json.output }}",
        "options": {},
        "toWhatsapp": true
      },
      "credentials": {
        "twilioApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "322c4e17-01a7-470e-83e6-e0125613d486",
      "name": "Twilio Trigger",
      "type": "n8n-nodes-base.twilioTrigger",
      "position": [
        -560,
        -128
      ],
      "parameters": {
        "updates": [
          "com.twilio.messaging.inbound-message.received"
        ]
      },
      "credentials": {
        "twilioApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "1ca07c67-64a1-44db-9c7c-6959d7ca6b36",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -576,
        -288
      ],
      "parameters": {
        "width": 368,
        "height": 112,
        "content": "## Sample Spreadsheet\nhttps://docs.google.com/spreadsheets/d/1jF0ACPiyK1gk4J_oWwpMQ8KG9Wek8RtG8Ay2npJClak/edit?usp=sharing"
      },
      "typeVersion": 1
    }
  ],
  "active": true,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "96457bbe-2529-4af5-84f5-151700f052b1",
  "connections": {
    "AI Agent": {
      "main": [
        [
          {
            "node": "Send an SMS/MMS/WhatsApp message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "openingHour": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Updatebooking": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "salonservices": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "SuggestStylist": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Twilio Trigger": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Booking services": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Getbookingdetails": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "perticullerstylistsdetails": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  }
}