
Key Metrics
Project Overview
Executive Summary
DevDoz is a specialized software engineering and automation agency based in Lahore, Pakistan (focusing on ERPNext, Frappe, n8n automation, AI, and custom web/SaaS). As website traffic scaled across diverse service inquiries, prospective clients required round-the-clock discovery and qualification. To replace friction-heavy static contact forms and eliminate lost after-hours leads, I architected and deployed an autonomous AI sales and lead qualification chatbot on the DevDoz website using n8n, OpenAI gpt-4o-mini, n8n Data Tables, Google Sheets, and Gmail.
Business Context & Challenges
DevDoz receives inquiries with diverse technical scopes: ERPNext implementations, custom automation, web applications, and staff augmentation. Prior to the AI chatbot deployment, the agency encountered five key friction points: (1) After-hours lead loss with no 24/7 live chat availability; (2) High drop-off on static contact forms that felt like tedious paperwork; (3) Inadequate initial lead context (names/emails alone provided zero insight into project scope or fit); (4) Lack of lead scoring and prioritization; and (5) Delayed human hand-off when visitors were ready for direct consultation.
Key Objectives
- Deploy a high-speed public web chat trigger operating in asynchronous response mode
- Engineer an AI sales agent using OpenAI gpt-4o-mini with a 20-message memory buffer
- Enforce dual-payload structured JSON output (visitor reply + 19 internal lead fields)
- Implement an automated internal lead scoring rubric (Hot: 80–100, Warm: 50–79, Cold: 0–49)
- Build a tokenized 10-second activity debounce using n8n Data Tables to prevent duplicate writes
- Automate continuous lead profile upserts into Google Sheets acting as a lightweight CRM
- Establish real-time team alert dispatch via Gmail and WhatsApp upon human hand-off requests
System Architecture
The solution is architected as an event-driven automation workflow orchestrated in n8n:
- Public Chat Trigger & Fast Dispatch: Webhook chat widget captures visitor messages alongside pre-chat metadata and returns instant conversational replies via 'respond via node' mode without waiting for downstream database sync.
- AI Agent & Memory Core: Powered by OpenAI gpt-4o-mini with a 20-message conversational memory buffer and custom system prompts tailored to DevDoz's service catalog, guidelines, and qualification logic.
- Structured JSON Parser: Every AI turn forces a JSON object containing user-facing
replytext and 19 structuredleadattributes (contact info, service, current systems, budget, timeline, score, priority, status, and summary). - Activity Token Debounce: Session execution token is recorded in n8n Data Tables followed by a 10-second wait. Only the latest active execution proceeds, consolidating multi-message bursts into a single database write.
- Storage & Notification Layer: Deduplicated upserts to Google Sheets matched on Lead ID (chat session ID), followed by conditional branch evaluation to trigger instant formatted Gmail notifications and WhatsApp routing when human assistance is requested.
Role-Based Access & Security
Engineered with strict isolation between public visitor interactions and internal business operations. Website visitors interact exclusively with a sandboxed, client-facing web chat widget with zero direct exposure to backend API keys, Google Sheets, or internal CRM systems. Lead datasets, conversational transcripts, and scoring metrics are routed and stored in protected Google Sheets accessible only to authenticated DevDoz team members, while high-priority notification webhooks are secured through authorized Gmail API connections.
Automated Workflows & Logic
Multi-branch asynchronous automation in n8n: Incoming chats trigger parallel workflows where the visitor receives an immediate response while lead extraction, scoring, and debounce validation execute in the background. The tokenized debounce mechanism interrogates n8n Data Tables after a 10-second silence window, ensuring that only the most complete conversational state is saved to Google Sheets. Furthermore, when the AI identifies an explicit request for human contact, automated Gmail dispatches transmit the full lead profile, transcript summary, and contact details directly to the engineering and sales team.
UI/UX & Design System
Engineered a natural, consultative conversational persona reflecting DevDoz's engineering excellence. The chatbot avoids robotic openers ('Thanks', 'Noted', 'Perfect —'), delivers concise 1–2 sentence responses, asks one qualifying question at a time to prevent cognitive overload, gently steers pricing queries toward scope discovery, and seamlessly provides DevDoz's verified WhatsApp contact (+92 324 2401582) for direct human connection.
Business Impact
- Achieved 24/7 autonomous lead capture and qualification across international time zones
- Automated extraction of 19 structured lead data points per conversation
- Eliminated duplicate CRM writes via smart 10-second tokenized activity debouncing
- Enabled instant team triage with automated Hot/Warm/Cold lead scoring
- Reduced lead-to-human response time through instant Gmail alerts and direct WhatsApp routing
Key Outcome
"Achieved 24/7 autonomous lead capture, 100% deduplicated CRM synchronization, instant lead scoring, and drastically reduced lead-to-human response time via automated Gmail and WhatsApp alerts."