Skip to Content

Marrut

AI-Powered Order Processing Through Conversational Chat

Contact us

Overview / About

Marrut is an n8n automation workflow powering a mobile chat application that turns natural-language messages into structured service orders. Users simply describe what they need in a chat interface -- the system leverages OpenAI's GPT-4o to parse their intent, identify the requested services, and automatically create orders in a PostgreSQL database. From restaurant meals to pharmacy pickups, every request is understood, logged, and fulfilled without manual intervention.

Problem

Ordering services through traditional apps requires navigating menus, filling forms, and following rigid UI flows for each service category. For businesses offering multiple service types, this means building and maintaining separate order interfaces. Users want to just say what they need; businesses want orders to land cleanly in their database.

Solution

Replace complex order forms with a single conversational interface. An n8n automation workflow receives chat messages via webhook, passes them through GPT-4o for intent extraction, and routes the structured data into PostgreSQL -- handling user registration, intent logging, order splitting, and error handling in one seamless pipeline.

Key Features

  • Natural language order processing -- users type orders in plain text, the AI does the rest
  • Multi-service support in a single message -- one chat message can contain orders for restaurant, pharmacy, playground, ticket, and repair services simultaneously
  • Automatic user management -- new users are registered on-the-fly; returning users are recognized by phone number
  • Intent detection and logging -- every message is analyzed, classified, and stored with confidence scores for analytics
  • Order splitting and normalization -- multi-item orders are decomposed into individual trackable order records
  • Robust error handling -- graceful fallbacks for unparseable messages with clear error responses
  • AI-proof parsing -- handles variable LLM output formats (raw arrays vs. wrapped objects) without breaking

Tech Stack

  • n8n (workflow automation engine)
  • OpenAI API / GPT-4o (natural language understanding)
  • PostgreSQL (relational database)
  • Webhook API (REST endpoint for mobile app integration)
  • JavaScript / Node.js (data transformation logic within n8n)

How It Works

  1. Webhook Receives Message -- The mobile app sends the user's chat message (with customer name and phone number) to the n8n webhook endpoint via POST request
  2. User Upsert -- The workflow inserts or updates the user record in PostgreSQL using an UPSERT query, ensuring returning customers are recognized by phone number
  3. AI Intent Extraction -- The message is sent to GPT-4o with a strict system prompt that acts as a Data Extraction Engine, identifying service types (restaurant, pharmacy, playground, ticket, repair) and extracting item details, quantities, and notes
  4. Intent Logging -- The detected intent and confidence score are logged to the Intents table for analytics and audit trails
  5. Normalize and Split -- A JavaScript code node parses the LLM output, handles format variations, and splits multi-service orders into individual order items
  6. Error Check -- A conditional node routes valid orders forward and sends error responses back for unparseable or non-order messages
  7. Order Creation -- Each service order is inserted into the Orders table with the correct service reference, details, and a "pending" status
  8. Response -- The webhook responds with a success or error JSON message back to the mobile app

Results / Outcomes

  • End-to-end order processing from natural language chat to database record in a single automated pipeline
  • Supports 5 distinct service categories parsed from free-text input
  • Handles multi-item, multi-service orders within a single user message
  • Automatic user registration eliminates onboarding friction
  • Intent logging with confidence scores enables data-driven service improvements
  • Resilient to LLM output format variations through defensive parsing logic

My Role

  • Designed the complete n8n automation workflow architecture from webhook intake to database insertion
  • Engineered the GPT-4o system prompt for reliable service intent extraction with structured JSON output
  • Built the PostgreSQL database schema with tables for Users, Services, Orders, Intents, and ServiceReviews
  • Implemented AI-proof parsing logic to handle variable LLM response formats without pipeline failures
  • Created the data normalization and order-splitting code for multi-service message handling
  • Configured the error handling flow with conditional routing and meaningful error responses