{
  "name": "Salon Booking WhatsApp Agent",
  "nodes": [
    {
      "parameters": {
        "promptType": "define",
        "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\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’s intent (service info, stylist details, availability, booking, cancel, edit).\n\nIn \"Particular Stylist Details\" 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\nService Inquiries\n\nCall \"Salon Services\" Tool to fetch current services.\n\nIf requested service unavailable → politely suggest valid services.\n\nWait for user confirmation before moving to stylists.\n\nIf confirmed → call \"Particular Stylist Details\" Tool and ask if they want to check availability.\n\nBooking Appointments\n\nStep-by-step flow: service → stylist → time.\n\nCall \"Particular Stylist Details\" Tool (services must be an array).\n\nSuggest only future slots.\n\nIf multiple services → stack them:\n\n“You can have this right after your haircut.”\n\nOnce slot chosen → 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 → ask politely first.\n\nWhen all details are ready → call UserSalonBooking Tool and confirm.\n\nEdit 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 → update via \"Update Booking\" Tool.\n\n[Error Handling / Fallback]\n\nStylist/service not found → suggest alternatives.\n\nSlot unavailable → suggest nearest future slot.\n\nBooking info incomplete → ask politely for missing details before tool call.\n\nSystem error → 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 → 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 \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": {}
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 2.2,
      "position": [
        1056,
        -112
      ],
      "id": "3aaf4f8d-3d00-47bc-8124-e87394583660",
      "name": "AI Agent"
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.2,
      "position": [
        672,
        96
      ],
      "id": "da854d95-1a72-4242-a7d3-eae56d4f706e",
      "name": "OpenAI Chat Model",
      "credentials": {
        "openAiApi": {
          "id": "UFoXLJTyZlrIERe4",
          "name": "OpenAI account"
        }
      }
    },
    {
      "parameters": {
        "sessionIdType": "customKey",
        "sessionKey": "={{ $json.data.from }}",
        "contextWindowLength": 10
      },
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "typeVersion": 1.3,
      "position": [
        800,
        176
      ],
      "id": "ca9aa03e-b486-4b65-a3bf-2e85baa50d55",
      "name": "Simple Memory"
    },
    {
      "parameters": {
        "from": "={{ $('Twilio Trigger').item.json.data.to.split(\"+\")[1] }}",
        "to": "={{ $('Twilio Trigger').item.json.data.from.split(\"+\")[1] }}",
        "toWhatsapp": true,
        "message": "={{ $json.output }}",
        "options": {}
      },
      "type": "n8n-nodes-base.twilio",
      "typeVersion": 1,
      "position": [
        1568,
        -112
      ],
      "id": "df479379-85f0-4fe9-bbb1-20dfd64e8abc",
      "name": "Send an SMS/MMS/WhatsApp message",
      "credentials": {
        "twilioApi": {
          "id": "9GDTn7krj5zj5GnI",
          "name": "Twilio account"
        }
      }
    },
    {
      "parameters": {
        "content": "## Data Setup\nCreate your own spreadsheet with these tabs/columns, then select it in the Google Sheets nodes:\n- **Salon Booking → Services**: _(columns as used in the nodes)_\n- **Salon Booking → Suggest Stylist**: _(columns as used in the nodes)_\n- **Salon Booking → Order Booking**: `Phone`, `Date`, `Services`, `Start_time`, `Stylist_name`, `customer_name`\n- **Salon Booking → Opening Hours**: _(columns as used in the nodes)_\n- **Salon Booking → Particular Stylist Details**: _(columns as used in the nodes)_",
        "height": 112,
        "width": 368
      },
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        544,
        -272
      ],
      "typeVersion": 1,
      "id": "78beef58-e583-4310-9d74-0bcb44c8a3c4",
      "name": "Sticky Note"
    },
    {
      "parameters": {
        "documentId": {
          "__rl": true,
          "value": "1jF0ACPiyK1gk4J_oWwpMQ8KG9Wek8RtG8Ay2npJClak",
          "mode": "list",
          "cachedResultName": "Salon Booking"
        },
        "sheetName": {
          "__rl": true,
          "value": 1011822210,
          "mode": "list",
          "cachedResultName": "Services"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheetsTool",
      "typeVersion": 4.7,
      "position": [
        928,
        224
      ],
      "id": "4018e90b-7bb7-416f-a07a-d78b6e484778",
      "name": "Salon Services",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "9rJzpmHDDKlqEEe9",
          "name": "Google Sheets account"
        }
      }
    },
    {
      "parameters": {
        "documentId": {
          "__rl": true,
          "value": "1jF0ACPiyK1gk4J_oWwpMQ8KG9Wek8RtG8Ay2npJClak",
          "mode": "list",
          "cachedResultName": "Salon Booking"
        },
        "sheetName": {
          "__rl": true,
          "value": 1978384237,
          "mode": "list",
          "cachedResultName": "Suggest Stylist"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheetsTool",
      "typeVersion": 4.7,
      "position": [
        1056,
        272
      ],
      "id": "45a6cd7b-eea8-4de9-afe4-57e576ffd628",
      "name": "Suggest Stylist",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "9rJzpmHDDKlqEEe9",
          "name": "Google Sheets account"
        }
      }
    },
    {
      "parameters": {
        "documentId": {
          "__rl": true,
          "value": "1jF0ACPiyK1gk4J_oWwpMQ8KG9Wek8RtG8Ay2npJClak",
          "mode": "list",
          "cachedResultName": "Salon Booking"
        },
        "sheetName": {
          "__rl": true,
          "value": "gid=0",
          "mode": "list",
          "cachedResultName": "Order Booking"
        },
        "filtersUI": {
          "values": [
            {
              "lookupColumn": "Phone",
              "lookupValue": "={{ $json.data.from }}"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheetsTool",
      "typeVersion": 4.7,
      "position": [
        1200,
        320
      ],
      "id": "ec6d4a4a-92a7-450f-8169-7ffa2e522469",
      "name": "Get Booking Details",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "9rJzpmHDDKlqEEe9",
          "name": "Google Sheets account"
        }
      }
    },
    {
      "parameters": {
        "documentId": {
          "__rl": true,
          "value": "1jF0ACPiyK1gk4J_oWwpMQ8KG9Wek8RtG8Ay2npJClak",
          "mode": "list",
          "cachedResultName": "Salon Booking"
        },
        "sheetName": {
          "__rl": true,
          "value": 1322339636,
          "mode": "list",
          "cachedResultName": "Opening Hours"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheetsTool",
      "typeVersion": 4.7,
      "position": [
        1344,
        256
      ],
      "id": "8fb98588-518e-447b-a5d2-71775ff19f12",
      "name": "Opening Hours",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "9rJzpmHDDKlqEEe9",
          "name": "Google Sheets account"
        }
      }
    },
    {
      "parameters": {
        "operation": "append",
        "documentId": {
          "__rl": true,
          "value": "1jF0ACPiyK1gk4J_oWwpMQ8KG9Wek8RtG8Ay2npJClak",
          "mode": "list",
          "cachedResultName": "Salon Booking"
        },
        "sheetName": {
          "__rl": true,
          "value": "gid=0",
          "mode": "list",
          "cachedResultName": "Order Booking"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "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') }}"
          },
          "matchingColumns": [],
          "schema": [
            {
              "id": "Date",
              "displayName": "Date",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Phone",
              "displayName": "Phone",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Services",
              "displayName": "Services",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Start_time",
              "displayName": "Start_time",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Stylist_name",
              "displayName": "Stylist_name",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "customer_name",
              "displayName": "customer_name",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheetsTool",
      "typeVersion": 4.7,
      "position": [
        1472,
        224
      ],
      "id": "b4673ebb-e8c9-4374-94af-72450f28fc46",
      "name": "Booking Services",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "9rJzpmHDDKlqEEe9",
          "name": "Google Sheets account"
        }
      }
    },
    {
      "parameters": {
        "documentId": {
          "__rl": true,
          "value": "1jF0ACPiyK1gk4J_oWwpMQ8KG9Wek8RtG8Ay2npJClak",
          "mode": "list",
          "cachedResultName": "Salon Booking"
        },
        "sheetName": {
          "__rl": true,
          "value": 1861968928,
          "mode": "list",
          "cachedResultName": "Particular Stylist Details"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheetsTool",
      "typeVersion": 4.7,
      "position": [
        1600,
        176
      ],
      "id": "21fee6aa-3526-4e6d-a6eb-834b1620361f",
      "name": "Particular Stylist Details",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "9rJzpmHDDKlqEEe9",
          "name": "Google Sheets account"
        }
      }
    },
    {
      "parameters": {
        "operation": "update",
        "documentId": {
          "__rl": true,
          "value": "1jF0ACPiyK1gk4J_oWwpMQ8KG9Wek8RtG8Ay2npJClak",
          "mode": "list",
          "cachedResultName": "Salon Booking"
        },
        "sheetName": {
          "__rl": true,
          "value": "gid=0",
          "mode": "list",
          "cachedResultName": "Order Booking"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "Phone": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Phone__using_to_match_', ``, 'string') }}",
            "Date": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Date', ``, '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') }}"
          },
          "matchingColumns": [
            "Phone"
          ],
          "schema": [
            {
              "id": "Date",
              "displayName": "Date",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Phone",
              "displayName": "Phone",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "Services",
              "displayName": "Services",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Start_time",
              "displayName": "Start_time",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Stylist_name",
              "displayName": "Stylist_name",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "customer_name",
              "displayName": "customer_name",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "displayName": "row_number",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "number",
              "canBeUsedToMatch": true,
              "readOnly": true,
              "removed": true
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheetsTool",
      "typeVersion": 4.7,
      "position": [
        1712,
        128
      ],
      "id": "e8cea5a3-b20b-42c2-8348-537332692343",
      "name": "Update Booking",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "9rJzpmHDDKlqEEe9",
          "name": "Google Sheets account"
        }
      }
    },
    {
      "parameters": {
        "updates": [
          "com.twilio.messaging.inbound-message.received"
        ]
      },
      "type": "n8n-nodes-base.twilioTrigger",
      "typeVersion": 1,
      "position": [
        656,
        -112
      ],
      "id": "73cc4783-297b-4b62-921b-8e175013f876",
      "name": "Twilio Trigger",
      "webhookId": "e3bf3606-e539-4104-8938-4c68eb641a24",
      "credentials": {
        "twilioApi": {
          "id": "9GDTn7krj5zj5GnI",
          "name": "Twilio account"
        }
      }
    }
  ],
  "pinData": {},
  "connections": {
    "AI Agent": {
      "main": [
        [
          {
            "node": "Send an SMS/MMS/WhatsApp message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "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
          }
        ]
      ]
    },
    "Salon Services": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Suggest Stylist": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Get Booking Details": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Opening Hours": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Booking Services": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Particular Stylist Details": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Update Booking": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Twilio Trigger": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "6205d26a-ff59-475e-8538-0c20cfad64d2",
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "f1c26778ec36097a9722a22c47c5e9c01f00b8862dadd0121ec118026a370fa6"
  },
  "id": "PQLpFGzQUFm9PfIo",
  "tags": []
}