Complete REST API Appointment Scheduling and Availability Checker - n8n Workflow

Use this robust n8n workflow to manage a complete booking system. It validates user input, checks business hours, public holidays, and Google Calendar availability before confirming an appointment. Essential n8n templates for complex scheduling.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • Businesses needing a flexible, custom-branded booking interface.

  • Developers requiring a robust backend for scheduling powered by n8n.

  • Service providers who must strictly enforce specific business hours (including lunch/dinner breaks) and avoid public holidays.

  • Users looking for advanced examples of n8n templates using code and flow control for complex validation.

Overview

This comprehensive n8n workflow template creates a powerful, timezone-aware scheduling backend accessible via two distinct REST API endpoints. It solves the challenge of managing complex booking rules—including specific business hours (9 AM to 9 PM, excluding specific breaks like 12 PM - 2 PM and 6 PM - 8 PM), weekends, and public holidays (by querying a separate public holiday calendar). This sophisticated n8n template ensures that every booking is cross-validated against existing appointments in Google Calendar, preventing double bookings.

The workflow includes both the 'Make Booking' endpoint for final confirmation and the 'Check Slots' endpoint for real-time frontend feedback, making it a crucial n8n node setup for any service business that demands scheduling accuracy and robust validation.

How it Works

This n8n workflow operates in two primary modes, both initialized by an n8n trigger Webhook node:

1. Make a Booking Endpoint (/make-booking)


  1. Trigger and Validation: The workflow starts with the Booking Webhook n8n trigger node receiving customer data (name, email, date, time) via a POST request.

  2. The Validate Input Code n8n node performs strict format checks (email, phone, date format) and ensures all required fields are present.

  3. Business Logic Check: If valid, the Business Hours Check Code n8n node evaluates if the requested time falls within the defined Malaysian business hours (Mon-Fri, 9 AM - 9 PM) while specifically excluding defined break times (lunch and dinner).

  4. Conflict Detection: The workflow simultaneously queries two separate Google Calendar n8n node instances: one for the main booking calendar and one for the Malaysia public holiday calendar.

  5. The Check Availability Code n8n node consolidates data from both calendar checks. It performs a time-overlap calculation to ensure the slot is free from both existing appointments and public holidays.

  6. Final Action: If the slot is available, the Create Calendar Event Google Calendar n8n node generates a new appointment, adding the customer as an attendee. A successful JSON response is then returned.

  7. Error Handling: If any validation fails (input, time restrictions, or availability), the n8n workflow immediately branches to a dedicated error response node, providing descriptive feedback to the calling application.

2. Get Booking Slots Endpoint (/check-booking-date)


  1. Slot Setup: This branch is triggered by the Booking Timeslot webhook n8n trigger node when a date is selected. The ConfigTimeSlots n8n node loads a predefined array of potential time slots for the day.

  2. Day Status Check: The workflow queries the Google Calendar n8n node instances to determine if the selected date is a weekend or a public holiday.

  3. Availability Processing: The Process Holiday Check Calendar Code n8n node iterates through the predefined slots. It checks each slot against the actual calendar events for that day. Any slot that overlaps with an existing booking or a holiday is marked as available: false.

  4. Response: A comprehensive JSON object is returned, detailing the day's status (working day/holiday/weekend) and the final list of bookable slots, allowing the frontend to dynamically update the booking form.

Installation Guide

To deploy this powerful n8n workflow template, follow these steps:


  1. Import: Copy the provided JSON and import it into your n8n instance.

  2. Credentials Setup: You will need a Google Calendar OAuth2 API credential. Follow the official n8n documentation to set this up.

  3. Calendar IDs: Update the Google Calendar n8n node parameters with your specific Calendar IDs:

- In the Check Calendar Availability - Main and Create Calendar Event nodes, replace YOURBOOKING[email protected] with your main booking calendar's ID.
- The public holiday calendar ID (en.malaysia#[email protected]) can be retained or replaced if you target a different region.

  1. Time Slot Configuration: Adjust the available time slots and built-in breaks by editing the Javascript in the ConfigTimeSlots n8n node (used by the 'Get Slots' endpoint) and the logic within the Business Hours Check Code n8n node (used by the 'Make Booking' endpoint) to match your exact operating hours and timezone.

Node Details

This n8n workflow utilizes advanced logic across several key n8n node types:

Booking Webhook (n8n trigger): The primary entry point for a booking request. Key configuration includes the path make-booking and POST method, ensuring it acts as a robust REST API endpoint.
Validate Input (Code n8n node): Essential for security and data integrity. It validates data fields (name, email format using regex, phone number) before processing, ensuring only clean data proceeds through the n8n workflow.
Business Hours Check (Code n8n node): A critical component that embeds complex business logic (Malaysian timezone UTC+8, specific break exclusions). It determines the validity of the requested time and prepares the ISO date strings required for Google Calendar n8n node operations.
Google Calendar n8n node (Check Availability): Used twice in the main flow. The first instance checks the Public Holiday calendar, and the second checks the Main Booking Calendar. Both use the getAll operation to fetch events overlapping the proposed slot.
Check Availability (Code n8n node): This node processes the output of the two Google Calendar n8n node calls. It contains custom logic to detect any time overlap between the proposed booking and existing calendar events or detected public holidays.
Create Calendar Event (Google Calendar n8n node): The final action n8n node. If all checks pass, it uses the start and end times derived from the Business Hours Check to officially create the confirmed event and send out the invitation.

Related n8n Workflows

Free

Nodes: 8 Nodes
Updated: December 26 2025
View all
Created by

I embarked on my coding journey at the age of 13, driven by a deep passion for AI, automation, and engineering. Over the years, I've taken on various roles including Developer, Engineer, Senior Engineer, Architect, Principal Engineer, Freelance Consultant, and Head of Engineering.

Featured*