Automated Reservation System using WhatsApp and PostgreSQL - n8n Workflow

Implement a dynamic customer reservation system using this advanced n8n workflow. Automate scheduling, manage state via PostgreSQL, and handle requests seamlessly using the WhatsApp n8n node.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • Businesses needing 24/7 automated booking and scheduling.

  • n8n Automation Specialists looking for complex, stateful chatbot n8n templates.

  • Developers needing to integrate PostgreSQL database operations with communication platforms.

  • Service providers aiming to streamline customer interaction through the WhatsApp n8n trigger.

Overview

This sophisticated n8n workflow provides a complete solution for automating customer reservations via WhatsApp. It solves the common challenge of maintaining conversation state in a stateless environment by leveraging a PostgreSQL database to track where the user is in the booking journey (START, BOOKING, BOOKED, PAYMENTS). This highly efficient n8n automation eliminates manual scheduling, reducing errors and increasing customer service availability. The structure demonstrates best practices for complex conditional routing, ensuring that every message received by the WhatsApp n8n trigger is handled correctly based on the user's current interaction status. This robust n8n template is ideal for businesses requiring reliable, dynamic scheduling capabilities. By using the specialized PostgreSQL n8n node, this n8n workflow guarantees seamless data interaction.

How it Works

The process begins when a customer sends a message, activating the WhatsApp n8n trigger.


  1. Initialization and State Check: The n8n workflow uses the Initialization node to prepare data. It then queries the PostgreSQL database via the Get Bot Status n8n node to retrieve the user's current status (e.g., waiting for a date, waiting for a name).

  2. Flow Definition: The Define Flow switch routes the conversation. If the status is 'START', the user is welcomed via the Starts n8n node, and the status is updated to ensure the next message is processed in context. If the status is related to 'BOOKING', the n8n workflow proceeds to validate the user's input.

  3. Command Execution: The Commands switch handles main menu navigation or initiates the reservation process by querying Get Work Days from PostgreSQL.

  4. Date Selection: The n8n workflow checks if the requested date is correct using an If n8n node. If valid, it merges available working days and uses the Request Date WhatsApp n8n node to prompt the user. The bot status is then updated to 'BOOKING'.

  5. Time and Slot Allocation: Upon receiving the date, the n8n workflow inserts a preliminary booking (Add Book), updates the date and status using a PostgreSQL n8n node, retrieves available Get Work Hours, and asks the user to select a time slot using Request Time.

  6. Customer Details & Validation: Once the time is selected, the flow updates the hour. A critical Phone validation1 n8n node ensures the input is correct. If valid, the phone number is updated, and the customer is prompted for their name via the Request Name WhatsApp n8n node.

  7. Final Booking: After receiving the name, the Update Name n8n node finalizes the reservation details in the database. The customer receives a page booking success message, and the bot status is updated to 'BOOKED' and finally 'PAYMENTS', enabling a subsequent payment flow within this flexible n8n workflow structure.

Installation Guide


  1. Import the n8n workflow: Copy the provided JSON code and import it directly into your n8n instance using the 'New' -> 'Import from JSON' function.

  2. WhatsApp Credentials: You must set up a WhatsApp Business API credential (or equivalent provider) for the WhatsApp Trigger and all WhatsApp messaging n8n node instances. This connection is vital for the n8n workflow.

  3. PostgreSQL Setup: Configure a credential for PostgreSQL. This n8n workflow relies heavily on specific tables to store user state, working hours, working days, and booking information. Ensure your database tables match the expected schema used by the postgres n8n node operations (e.g., Get Bot Status, Update Date AND Status).

  4. Activation: Activate the n8n workflow. The WhatsApp Trigger will now listen for incoming messages to initiate the automated reservation sequence using this powerful n8n template.

Node Details


  • WhatsApp Trigger (33d1bfa8): The essential starting n8n trigger. It listens for incoming WhatsApp messages, initiating the entire n8n workflow execution upon user contact.

  • PostgreSQL (Get Bot Status, 946b34a4): Used extensively for state management. This n8n node retrieves the current conversational status of the user (e.g., 'START', 'BOOKING') to ensure the n8n workflow handles sequential input correctly.

  • Switch (Define Flow, 8e174865): The primary routing mechanism and core logic flow control component. It determines the correct execution path based on the user's current status retrieved from the PostgreSQL n8n node.

  • PostgreSQL (Add Book, fa7159a9): Inserts a new preliminary reservation record into the database once the booking process starts, crucial for maintaining data integrity throughout the n8n workflow.

  • If (Phone validation1, f7c5056a): A critical If n8n node that enforces data quality by validating the format of the phone number provided by the user before updating the booking record.

  • WhatsApp (page booking success, 1deb7b7c): The final messaging n8n node in the booking sequence, used to send a confirmation message to the customer after the reservation is successfully recorded by the n8n workflow.

Related n8n Workflows

Paid

Nodes: 9 Nodes
Updated: December 26 2025
View all
Created by
Andrew
Andrew

Analyst-Developer

Featured*