Inspiration
Small and local food businesses often face significant friction managing peak-hour customer inquiries, menu questions, and order placements alongside daily kitchen operations. High-end POS automation and proprietary CRM solutions are usually expensive and rigid.
I set out to build a lightweight, open-source prototype for HS Restaurant that proves how conversational AI and low-code workflow automation can deliver a seamless, WhatsApp-style customer ordering experience at zero tooling cost.
How I Built It
The architecture functions as an event-driven conversational interface connected directly to a cloud database:
- Workflow Orchestration: Powered by a self-hosted instance of n8n running on Docker to handle logic routing, context preservation, and API communication.
- LLM Engine: Integrated the Google Gemini API to understand unstructured natural language, parse multi-step requests, and correct minor user typos (e.g., mapping burgur to burger).
- Conversational Memory: Configured a sliding context window that retains the previous $N = 10$ messages to enable smooth multi-turn interactions (gathering Customer Name $\rightarrow$ Food Item $\rightarrow$ Quantity).
- Database & Management: Linked directly to Google Sheets serving as a Hotel Management System (HMS) with three interconnected tabs:
Inventory: Tracks available stock in real time.Orders: Dynamically logs customer names, item selections, quantities, timestamps, and order statuses.FAQ: Stores a structured knowledge base to automatically resolve customer questions.
Challenges I Faced
- Real-Time Inventory Validation: Ensuring the workflow accurately verifies available stock before confirming any order. The system enforces the condition:
$$Q_{\text{requested}} \le Q_{\text{available}}$$
If an item is out of stock or requested in excess, the workflow gracefully notifies the user and asks for an updated quantity without dropping conversational context.
- Dialogue State Handling: Managing conversational flow when users provide incomplete details or switch topics mid-order without causing errors in the parameter-extraction chain.
- Template Sanitization: Packaging and cleaning the exported workflow JSON so all Google Sheets credentials, Sheet IDs, and API keys were replaced with reusable placeholders for the open-source community.
What I Learned
- How to combine low-code orchestration engines (n8n) with LLMs (Gemini API) to extract clean, structured JSON from natural language conversations.
- How to leverage Google Sheets as a functional, low-latency relational database for rapid business automation prototyping.
- Best practices in designing deterministic fallback logic within AI-driven conversational workflows.
Built With
- chatbot
- docker
- google-gemini-api
- google-sheets-api
- javascript
- json
- llm
- n8n
- prompt
- workflow-automation