Hi everyone! I want to share an AI-powered Telegram booking architecture I built for beauty salons using self-hosted n8n, PostgreSQL, and Google Gemini.
The Core Engineering Challenge
Many AI booking assistants fail in production because LLMs can hallucinate relative dates (“next Friday”) or register double-bookings.
To solve this, I applied a strict separation of concerns: The LLM is responsible ONLY for natural language intent extraction, while deterministic code (n8n JS nodes) and SQL queries handle all calendar logic and validations.
Key System Features
- Deterministic Scheduling: Relative dates are resolved in JavaScript (Luxon) rather than trusted to the LLM.
- Atomic Slot Validation: Every booking request checks salon working hours, master availability, and existing appointments in PostgreSQL at the SQL level before confirmation.
- Session Memory & Timeout: Manages draft bookings per chat with automatic 10-minute session expiration.
- Background Jobs: Hourly scheduled workflows send 24h/1h Telegram reminders and collect post-service feedback ratings (1–5
).
Architecture Overview (4 Workflows)
-
AI Booking Agent [Main Flow]: Telegram triggers, session routing, Gemini NLU processing, intent parsing.
-
DB_Helper_Saloon [Internal Webhook]: Centralized database sub-workflow for checking availability, fetching services, and writing bookings.
-
Background Reminders: Cron job for pre-appointment notifications.
-
Feedback Collector: Cron job for post-visit surveys.
Tech Stack
- Orchestration: n8n (self-hosted Docker on VPS)
- Database & CRM: PostgreSQL (schema:
ai_agent_booking) + NocoDB interface - AI Model: Google Gemini (
gemini-2.5-flash) via LangChain Node - Interface: Telegram Bot API
Feel free to check out live demonstrations and system details on my portfolio: My Portfolio Landing Page
I’d love to hear your thoughts on this architecture! How do you usually handle LLM intent validation in your n8n workflows?

