{
  "name": "Complete booking system with Google Calendar, business hours & REST API",
  "nodes": [
    {
      "id": "f634fd9d-8ba4-4c93-9db1-582b1e8ad991",
      "name": "Booking Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -2464,
        -240
      ]
    },
    {
      "id": "011a2f41-f0c3-4cd0-9969-7da1cbc3f427",
      "name": "Validate Input",
      "type": "n8n-nodes-base.code",
      "position": [
        -1968,
        -240
      ]
    },
    {
      "id": "c6138e82-ab61-40ca-b910-5d3fd220ef06",
      "name": "Validation Check",
      "type": "n8n-nodes-base.if",
      "position": [
        -1808,
        -240
      ]
    },
    {
      "id": "657c2588-a78d-4a56-84a9-d05402027348",
      "name": "Business Hours Check",
      "type": "n8n-nodes-base.code",
      "position": [
        -1056,
        -240
      ]
    },
    {
      "id": "f1696ada-2220-409f-a6d6-20a0af802a46",
      "name": "Time Validation Check",
      "type": "n8n-nodes-base.if",
      "position": [
        -880,
        -240
      ]
    },
    {
      "id": "1a83780e-5c40-4eda-b9bf-07db8db03c5c",
      "name": "Check Availability",
      "type": "n8n-nodes-base.code",
      "position": [
        320,
        -272
      ]
    },
    {
      "id": "d306380e-991b-4ed1-9e49-120416e9a368",
      "name": "Availability Check",
      "type": "n8n-nodes-base.if",
      "position": [
        496,
        -272
      ]
    },
    {
      "id": "b99740f9-2f54-4463-8f5d-3ce5dfa0f6f8",
      "name": "Create Calendar Event",
      "type": "n8n-nodes-base.googleCalendar",
      "position": [
        1136,
        -272
      ]
    },
    {
      "id": "ce008e1d-3ea2-47f7-9ad6-444b85011fb1",
      "name": "Prepare Success Response",
      "type": "n8n-nodes-base.code",
      "position": [
        1344,
        -272
      ]
    },
    {
      "id": "bd5d586c-101f-43a0-996d-9daf56e16006",
      "name": "Success Response",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        1520,
        -272
      ]
    },
    {
      "id": "4809f9d6-0545-4929-9b7e-2fed1baef77d",
      "name": "Error Response",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        -1408,
        96
      ]
    },
    {
      "id": "8ed8f9f8-0e0e-4672-9b96-3493090d0cc7",
      "name": "Time Error Response",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        -480,
        112
      ]
    },
    {
      "id": "f275c219-5f3e-432c-a56a-1e120b1b72a1",
      "name": "Availability Error Response",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        832,
        80
      ]
    },
    {
      "id": "5eafcbd8-36ae-447b-9801-b599c154ae93",
      "name": "Prepare Validation Error",
      "type": "n8n-nodes-base.code",
      "position": [
        -1568,
        96
      ]
    },
    {
      "id": "05e0736b-2e25-4414-94f9-e065c7a2f78a",
      "name": "Prepare Time Error",
      "type": "n8n-nodes-base.code",
      "position": [
        -624,
        112
      ]
    },
    {
      "id": "a4b2ce24-64ed-4554-817a-be4e8e1f219a",
      "name": "Prepare Availability Error",
      "type": "n8n-nodes-base.code",
      "position": [
        656,
        80
      ]
    },
    {
      "id": "b2b026d5-aace-4e35-96e0-50ad518becc4",
      "name": "Check Calendar Availability - public holiday",
      "type": "n8n-nodes-base.googleCalendar",
      "position": [
        112,
        -272
      ]
    },
    {
      "id": "21087fe4-a8f3-45ce-9311-271638b3ed01",
      "name": "Check Calendar Availability - Main",
      "type": "n8n-nodes-base.googleCalendar",
      "position": [
        -64,
        -272
      ]
    },
    {
      "id": "2b3e3f48-053c-4aca-a620-262220445eed",
      "name": "Check Calendar Availability",
      "type": "n8n-nodes-base.googleCalendar",
      "position": [
        -1344,
        1952
      ]
    },
    {
      "id": "657ea779-54a4-4b14-97f8-6ad9338ba6a9",
      "name": "Validate Date1",
      "type": "n8n-nodes-base.code",
      "position": [
        -1744,
        1952
      ]
    },
    {
      "id": "6986af41-125a-44a8-863c-c0bf287f391a",
      "name": "Booking Timeslot webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -2336,
        1952
      ]
    },
    {
      "id": "682404b7-8e65-458c-88ab-8f7af92c0654",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -3392,
        -544
      ],
      "parameters": {
        "width": 208,
        "height": 80,
        "content": "## Make a Booking"
      }
    },
    {
      "id": "020d4645-f547-46a8-b79d-f3474f410172",
      "name": "Wait",
      "type": "n8n-nodes-base.wait",
      "position": [
        -2272,
        -240
      ]
    },
    {
      "id": "521cabc0-39ac-44e9-9cdc-eb278d00914f",
      "name": "Wait1",
      "type": "n8n-nodes-base.wait",
      "position": [
        -2128,
        1952
      ]
    },
    {
      "id": "7baeedf5-55e5-4f29-be40-b1e16bd4ebe8",
      "name": "ConfigTimeSlots",
      "type": "n8n-nodes-base.set",
      "position": [
        -1968,
        1952
      ]
    },
    {
      "id": "8008974b-2b69-4c9f-a9eb-cc4a3dfc16bb",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1616,
        -48
      ],
      "parameters": {
        "width": 384,
        "height": 304,
        "content": "## Handle validation \n1. name + email validation\n2. phone validation\n3. date time validation"
      }
    },
    {
      "id": "863e46b6-20c9-4d46-ac72-a8d8a276ae84",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -656,
        -32
      ],
      "parameters": {
        "width": 400,
        "height": 288,
        "content": "## Handle validation \n1. datetime is weekend \n2. datetime is non-business hours \n3. datetime is lunch or dinner hours"
      }
    },
    {
      "id": "9d5bb1b8-797a-45ae-8099-09e2dc52b29e",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        656,
        -64
      ],
      "parameters": {
        "width": 320,
        "height": 304,
        "content": "## Handle validation \n1. datetime is conflicting with  another event\n2. datetime is a malaysian public holiday "
      }
    },
    {
      "id": "a6c9d369-708c-48d1-bd3c-bbdb99dde83b",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -112,
        -480
      ],
      "parameters": {
        "width": 1120,
        "height": 736,
        "content": "## Checking datetime  \n1. Malaysian public holiday\n2. Event booking conflict"
      }
    },
    {
      "id": "f63f18ce-12f1-4ad8-bb41-3b9c1238f462",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1104,
        -464
      ],
      "parameters": {
        "width": 864,
        "height": 736,
        "content": "## Checking datetime  \n1. is a weekend working day?\n2. is a non-business hours?\n3. is a lunch or dinner hours?"
      }
    },
    {
      "id": "579efc35-1b5f-4f50-bae5-10a1a1d3544f",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2032,
        -464
      ],
      "parameters": {
        "width": 816,
        "height": 736,
        "content": "## Checking input received\n1. is a valid name, email?\n2. is a valid phone number?\n3. is a valid date time?"
      }
    },
    {
      "id": "43bce511-7190-4152-8392-5b196b52e9b6",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1104,
        -480
      ],
      "parameters": {
        "width": 560,
        "height": 720,
        "content": "## Creating the calendar entry\n "
      }
    },
    {
      "id": "192d0193-0783-40e3-b763-be38026cff03",
      "name": "Sticky Note10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2496,
        -464
      ],
      "parameters": {
        "width": 400,
        "height": 736,
        "content": "## Endpoint for making a booking\nReceives the input name,email,phone and datetime for booking"
      }
    },
    {
      "id": "53d5e3b2-8d1b-4427-bc55-c1925bd79cc3",
      "name": "Sticky Note12",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -3392,
        -448
      ],
      "parameters": {
        "width": 840,
        "height": 2020,
        "content": "## Create a Booking :  MAKE A BOOKING ENDPOINT\n\n### Purpose \nThis workflow provides a webhook API endpoint that your frontend can easily integrate typically triggered by a submit button on a booking f"
      }
    },
    {
      "id": "3e214651-c3b0-4166-a49f-bc6eb15fefe2",
      "name": "Sticky Note13",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -3408,
        1808
      ],
      "parameters": {
        "width": 840,
        "height": 2244,
        "content": "## Get Booking Slots :  FETCH BOOKING SLOTS ENDPOINT\n\n### Purpose \nThis workflow powers a REST API endpoint designed to respond when a user interacts with the frontend booking form and selects a speci"
      }
    },
    {
      "id": "3e51b455-3bf6-4f0c-a7f6-55085adbcdec",
      "name": "Sticky Note11",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2416,
        1808
      ],
      "parameters": {
        "width": 1712,
        "height": 416,
        "content": "## Endpoint for getting booking slots by specific date\nReceives the timeslots for booking"
      }
    },
    {
      "id": "023484db-6e34-4a00-b19c-419c8e486ee4",
      "name": "Sticky Note14",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -4192,
        -448
      ],
      "parameters": {
        "width": 660,
        "height": 3200,
        "content": "## Demo\n\n \n![Demo](https://raw.githubusercontent.com/dragonjump/suarify-booking/main/full-demo-makebooking.gif)\n\n* [frontend code example](https://github.com/dragonjump/suarify-booking/blob/gh-pages/i"
      }
    },
    {
      "id": "d210e469-05a7-42f5-91f2-9c5e571094cd",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -3392,
        1680
      ],
      "parameters": {
        "width": 400,
        "height": 80,
        "content": "## Get Booking slots for date"
      }
    },
    {
      "id": "d0249a98-bd41-4129-b443-acb4fd1f7426",
      "name": "Check Public Holiday Calendar",
      "type": "n8n-nodes-base.googleCalendar",
      "position": [
        -1552,
        1952
      ]
    },
    {
      "id": "22b73d2f-d8ca-40c8-87df-9eecc3e40db4",
      "name": "Process Holiday Check Calendar",
      "type": "n8n-nodes-base.code",
      "position": [
        -1120,
        1952
      ]
    },
    {
      "id": "989997f0-1ca6-48fb-a078-b160df5f5812",
      "name": "Holiday Response Calendar",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        -896,
        1952
      ]
    }
  ],
  "connections": {
    "Wait": {
      "main": [
        [
          {
            "node": "Validate Input",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait1": {
      "main": [
        [
          {
            "node": "ConfigTimeSlots",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Validate Date1": {
      "main": [
        [
          {
            "node": "Check Public Holiday Calendar",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Validate Input": {
      "main": [
        [
          {
            "node": "Validation Check",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Booking Webhook": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ConfigTimeSlots": {
      "main": [
        [
          {
            "node": "Validate Date1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Validation Check": {
      "main": [
        [
          {
            "node": "Business Hours Check",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Prepare Validation Error",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Availability Check": {
      "main": [
        [
          {
            "node": "Create Calendar Event",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Prepare Availability Error",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Availability": {
      "main": [
        [
          {
            "node": "Availability Check",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Time Error": {
      "main": [
        [
          {
            "node": "Time Error Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Business Hours Check": {
      "main": [
        [
          {
            "node": "Time Validation Check",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Calendar Event": {
      "main": [
        [
          {
            "node": "Prepare Success Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Time Validation Check": {
      "main": [
        [
          {
            "node": "Check Calendar Availability - Main",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Prepare Time Error",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Booking Timeslot webhook": {
      "main": [
        [
          {
            "node": "Wait1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Success Response": {
      "main": [
        [
          {
            "node": "Success Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Validation Error": {
      "main": [
        [
          {
            "node": "Error Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Availability Error": {
      "main": [
        [
          {
            "node": "Availability Error Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Calendar Availability": {
      "main": [
        [
          {
            "node": "Process Holiday Check Calendar",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Public Holiday Calendar": {
      "main": [
        [
          {
            "node": "Check Calendar Availability",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Process Holiday Check Calendar": {
      "main": [
        [
          {
            "node": "Holiday Response Calendar",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Calendar Availability - Main": {
      "main": [
        [
          {
            "node": "Check Calendar Availability - public holiday",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Calendar Availability - public holiday": {
      "main": [
        [
          {
            "node": "Check Availability",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}