{
  "name": "Table Booking Bot",
  "nodes": [
    {
      "parameters": {
        "public": true,
        "initialMessages": "Hi there! Welcome to Daily Bean. I can help you book a table. Tell me your name, the date, the time, and how many people will join you. Send in any order you like, and I'll check availability right away.",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "typeVersion": 1.4,
      "position": [
        0,
        0
      ],
      "id": "ce3ab228-8b8b-45ce-b69f-703720209c9c",
      "name": "When chat message received",
      "webhookId": "be3e8680-50c8-4c4f-b6c5-23e8d64c92f8"
    },
    {
      "parameters": {
        "options": {
          "systemMessage": "You are a restaurant booking agent that helps customer book tables. Your workflow: \n1. When a customer requests a booking, extract: Name, Date, Time, and Number of People\n2. Use Read Booking Tool to check existing bookings\n3. Check if the requested date and time already has a booking\n4. If there is a conflict (same date AND time): - DO NOT add the booking - Inform the customer that the time slot is already taken - Ask them to choose another time slot\n5. If there is NO conflict: - Use Add Bookings Tool to add the booking -Confirm the booking to the customer\nIMPORTANT: NEVER cancel or overwrite existing bookings. If the time slot is taken, politely inform the customer and ask them to select a different time."
        }
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 3.1,
      "position": [
        208,
        0
      ],
      "id": "27a17933-9a96-4e8c-869d-4fc66f257bf6",
      "name": "AI Agent"
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "typeVersion": 1,
      "position": [
        80,
        208
      ],
      "id": "1483cbbc-8897-477b-bfdb-8c74c2aebafa",
      "name": "Google Gemini Chat Model",
      "credentials": {
        "googlePalmApi": {
          "id": "D8iXA8dtNAsLQKQa",
          "name": "Google Gemini(PaLM) Api account"
        }
      }
    },
    {
      "parameters": {},
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "typeVersion": 1.3,
      "position": [
        224,
        208
      ],
      "id": "e80dd906-5aea-4f07-b092-5e0b5e199034",
      "name": "Simple Memory"
    },
    {
      "parameters": {
        "descriptionType": "manual",
        "toolDescription": "Use this tool to add a new booking to the google sheet. Only use this after checking availability with the read bookings tool. The sheet has columns: Name, Date, Time, and Number of People.",
        "operation": "append",
        "documentId": {
          "__rl": true,
          "value": "1XR_SoGGjqvuxdrdldctzJEI798DWDSIA6-nDzHiDDe4",
          "mode": "list",
          "cachedResultName": "Bookings",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1XR_SoGGjqvuxdrdldctzJEI798DWDSIA6-nDzHiDDe4/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": "=New",
          "mode": "name"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "Name": "={{ $fromAI('Name', 'Customer full name') }}",
            "Number of People": "={{ $fromAI('People', 'Number of guests', 'number') }}",
            "Time": "={{ $fromAI('time', 'Booking time') }}",
            "Date": "={{ $fromAI('date', 'Booking date')}} "
          },
          "matchingColumns": [],
          "schema": [
            {
              "id": "Name",
              "displayName": "Name",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "Date",
              "displayName": "Date",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "Time",
              "displayName": "Time",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "Number of People",
              "displayName": "Number of People",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {
          "locationDefine": {
            "values": {}
          }
        }
      },
      "type": "n8n-nodes-base.googleSheetsTool",
      "typeVersion": 4.7,
      "position": [
        368,
        208
      ],
      "id": "1efe95b6-259c-4ab1-b966-f4d02253704f",
      "name": "Add Bookings Tool",
      "notesInFlow": true,
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "TgPQC99gvHvEZzvo",
          "name": "Google Sheets account"
        }
      },
      "notes": "Mapping Columns Mode not working"
    },
    {
      "parameters": {
        "descriptionType": "manual",
        "toolDescription": "Use this tool to read all existing bookings from the google sheet. The sheet has columns: Name, Date, Time, number of People. Check this before creating a new booking to avoid double bookings.",
        "documentId": {
          "__rl": true,
          "value": "1XR_SoGGjqvuxdrdldctzJEI798DWDSIA6-nDzHiDDe4",
          "mode": "list",
          "cachedResultName": "Bookings",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1XR_SoGGjqvuxdrdldctzJEI798DWDSIA6-nDzHiDDe4/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": "=New",
          "mode": "name"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheetsTool",
      "typeVersion": 4.7,
      "position": [
        464,
        304
      ],
      "id": "9c1a5d3d-71b1-4369-a088-2674f9ec5238",
      "name": "Read Bookings Tool",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "TgPQC99gvHvEZzvo",
          "name": "Google Sheets account"
        }
      }
    },
    {
      "parameters": {
        "mode": "perItem",
        "minutesSaved": 1
      },
      "type": "n8n-nodes-base.timeSaved",
      "typeVersion": 1,
      "position": [
        560,
        0
      ],
      "id": "7f92565d-8c33-4434-8a05-1ebfe45fe670",
      "name": "Time Saved"
    }
  ],
  "pinData": {},
  "connections": {
    "When chat message received": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Add Bookings Tool": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Read Bookings Tool": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Time Saved",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1",
    "binaryMode": "separate",
    "availableInMCP": false,
    "timeSavedMode": "dynamic",
    "callerPolicy": "workflowsFromSameOwner",
    "errorWorkflow": "XpIwFbxtOZCVqH80"
  },
  "versionId": "efc19739-2b4f-4502-ba32-e277a5167267",
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "de33315ccd8c8df612c54de8ea941ad063e50c03727d03cbfc3a7e6c3875936b"
  },
  "id": "cxdYCoxK52n97NbT",
  "tags": [
    {
      "updatedAt": "2026-03-14T13:30:15.728Z",
      "createdAt": "2026-03-14T13:30:15.728Z",
      "id": "u2Zf7F4Fj1uPzjeQ",
      "name": "ZMGIT"
    }
  ]
}