From Chat Widget to Conversation Platform: Our Technical Journey

·12 min

We didn't set out to build a conversational AI platform. We started with a simple chat widget. Here's how we evolved from a weekend project to infrastructure serving 15,000 production applications.


The Beginning: A Simple Chat Widget


Early 2024 - The first version was embarrassingly simple:


javascript
// Literally the entire first version

It worked for exactly one use case: answering FAQs on our own website. But customers started asking if they could use it too.


Phase 1: Multi-Tenancy (Q1 2024)


The first real feature request: "Can I use this on my website?"


The challenge: Every customer needed:

  • Their own knowledge base
  • Their own branding (colors, logo, copy)
  • Their own subdomain
  • Isolation from other customers' data
  • What we built:

  • Added appId to every request
  • Created a configuration table in PostgreSQL
  • Built a simple admin panel
  • Added API keys for authentication
  • What we learned:

  • Multi-tenancy is harder than it looks
  • Data isolation is critical (one SQL typo could leak customer data)
  • Configuration needs versioning (customers want to test changes before going live)
  • By the end of Q1, we had 12 paying customers.


    Phase 2: Customization (Q2 2024)


    Customers wanted to customize everything:


    "Can we change the button color?"

    "Can we add our logo?"

    "Can we customize the welcome message?"

    "Can we position it on the left instead of right?"


    The problem with our approach:

    javascript
    // This quickly became unmaintainable
    if (appId === 'customer1') {
      buttonColor = 'blue';
    } else if (appId === 'customer2') {
      buttonColor = 'red';
      position = 'left';
    } else if (appId === 'customer3') {
      // ... you get the idea
    }
    

    The solution: Configuration-driven UI

    json
    {
      "appId": "customer1",
      "theme": {
        "primaryColor": "#0066cc",
        "position": "bottom-right",
        "logo": "https://cdn.customer1.com/logo.png"
      },
      "behavior": {
        "welcomeMessage": "Hi! How can I help?",
        "placeholder": "Type your message...",
        "autoOpen": false
      }
    }
    

    Every visual element became configurable. Customers could customize their chat widget without us writing code.


    Phase 3: Beyond Text (Mid-2024)


    "Can the bot show buttons?"

    "Can it display product cards?"

    "Can users upload images?"


    We realized conversations aren't just text. They're rich, interactive experiences.


    The architecture shift:


    Old approach: Strings everywhere

    javascript
    response = "Here are your options: A, B, or C"
    

    New approach: Structured message format

    javascript
    response = {
      type: 'message',
      content: 'Here are your options:',
      components: [
        { type: 'button', label: 'Option A', action: 'select_a' },
        { type: 'button', label: 'Option B', action: 'select_b' },
        { type: 'button', label: 'Option C', action: 'select_c' }
      ]
    }
    

    This opened up everything:

  • Buttons
  • Card carousels
  • Forms
  • Calendar pickers
  • File uploads
  • Custom React components
  • Phase 4: The Great Rewrite (Q2-Q3 2024)


    By mid-2024, we had a problem. Our codebase was:

  • A monolithic Express.js server
  • PostgreSQL database hitting scaling limits
  • No real-time capabilities (just polling)
  • Single AWS EC2 instance (scary)
  • We were adding features faster than we could stabilize the platform. Downtime was increasing. Customer complaints were growing.


    Decision: Rewrite the entire backend.


    New architecture:

  • AWS Lambda - serverless, auto-scaling, no servers to manage
  • DynamoDB - single-digit millisecond latency at any scale
  • API Gateway WebSockets - true real-time, two-way communication
  • EventBridge - event-driven architecture
  • S3 + CloudFront - static assets at the edge
  • The migration:

    1. Built new system alongside old one

    2. Migrated one customer at a time

    3. Ran both systems in parallel for 2 months

    4. Verified data consistency

    5. Shut down old system by end of Q3


    The result:

  • 10x faster responses (500ms → 50ms)
  • 99.9% uptime (from 97%)
  • Unlimited scaling (we stopped worrying about load)
  • Monthly AWS costs decreased (yes, decreased!)
  • Phase 5: The Platform Emerges (Q3 2024)


    With stable infrastructure, we could finally think bigger than a chat widget.


    Customers were asking:

  • "Can I build a voice assistant with this?"
  • "Can this power our Slack bot?"
  • "Can we use this for automated phone support?"
  • "Can it send proactive messages?"
  • We realized: we're not building a chat widget. We're building a conversational AI platform.


    What changed:


    1. Input methods beyond web chat

  • SMS (Twilio integration)
  • Voice (phone calls via Twilio)
  • Slack
  • Microsoft Teams
  • Custom channels via webhooks
  • 2. Output destinations beyond UI

  • Send emails
  • Create calendar events
  • Update CRM records
  • Post to social media
  • Trigger webhooks
  • 3. Conversation flows

  • Multi-turn conversations with state
  • Branching logic
  • Fallbacks and error handling
  • Human handoff
  • 4. Developer tools

  • REST API for everything
  • SDKs (JavaScript, Python, Ruby)
  • CLI tool
  • Comprehensive documentation
  • Postman collections
  • Phase 6: AI Integration (Q3 2024)


    When ChatGPT launched, customers immediately asked: "Can you integrate this?"


    The challenge: We had been using rule-based conversation flows. AI required a completely different approach.


    Old way: Rule-based

    javascript
    if (message.includes('price') || message.includes('cost')) {
      return "Our pricing starts at $29/month";
    }
    

    New way: LLM-powered

    javascript
    const context = {
      knowledgeBase: loadKnowledgeBase(appId),
      conversationHistory: getHistory(conversationId),
      availableTools: ['check_price', 'book_demo', 'send_email']
    };
    
    const response = await openai.chat.completions.create({
      model: "gpt-4",
      messages: buildPrompt(message, context),
      tools: context.availableTools
    });
    

    What we built:

  • Knowledge base ingestion - customers upload docs, we embed and index them
  • Retrieval-augmented generation - AI answers from customer's own content
  • Tool calling - AI can execute functions (book meeting, check status, send email)
  • Prompt management - version and test prompts without code changes
  • Cost tracking - every AI call tracked and attributed to customer
  • By August 2024:

  • 78% of our conversations used AI
  • Average response quality increased (measured by customer satisfaction)
  • Customers could launch complex assistants in minutes instead of months
  • Phase 7: Scale (Recent Months)


    With AI capabilities, growth exploded:

  • Early 2024: 1,200 applications
  • Q2 2024: 5,000 applications
  • July 2024: 10,000 applications
  • September 2024: 15,000 applications
  • New challenges:


    1. LLM Costs Were Crushing Us

    Every conversation = API calls = money


    Solution:

  • Intelligent caching (20% cost reduction)
  • Prompt compression (15% cost reduction)
  • Model selection per task (30% cost reduction)
  • Usage-based pricing to customers
  • 2. Latency Was Increasing

    More customers = more database queries = slower responses


    Solution:

  • Edge caching with CloudFront
  • DynamoDB DAX for caching
  • Background processing for non-critical tasks
  • Connection pooling and request batching
  • 3. Support Was Unsustainable

    More customers = more support tickets


    Solution:

  • Built comprehensive documentation
  • Added in-app tutorials
  • Created community forum
  • Launched AI-powered support bot (dogfooding our own platform)
  • 4. Features Were Diverging

    Enterprise customers wanted features free tier didn't need


    Solution:

  • Feature flags per tier (Free, Pro, Enterprise)
  • Gradual rollout system
  • A/B testing framework
  • Customer-specific feature flags for beta testing
  • Today: September 2024


    The platform today:

  • 15,000+ applications across 90 countries
  • 3.2M conversations/day (350% growth year-over-year)
  • 50+ integrations (Slack, Teams, Twilio, Salesforce, etc.)
  • 99.94% uptime over the last 12 months
  • <100ms average response time
  • The tech stack:

  • Frontend: React, Next.js, Tailwind CSS
  • Backend: AWS Lambda (Node.js), API Gateway
  • Database: DynamoDB, PostgreSQL (for complex queries)
  • Real-time: API Gateway WebSockets
  • AI: OpenAI, Anthropic, Google, custom models
  • Monitoring: CloudWatch, Datadog, Sentry
  • CI/CD: GitHub Actions, AWS CDK
  • The team:

  • 12 engineers
  • 4 product/design
  • 3 customer success
  • 2 operations
  • Key Lessons


    1. Start Simple, Then Evolve

    Don't try to build the perfect architecture on day one. Build for today's needs, but design for tomorrow's changes.


    2. Listen to Customers

    Every major feature came from customer requests. We built what people actually needed, not what we thought was cool.


    3. Architecture Matters

    The rewrite in mid-2024 was painful but necessary. Bad architecture compounds over time.


    4. Invest in Developer Experience

    Great docs, easy onboarding, and helpful error messages turn users into advocates.


    5. Scale is a Feature

    Being able to handle 15,000 apps is a competitive advantage. Customers don't want to worry about scaling.


    6. Dogfood Everything

    We use our own platform for our support bot, sales assistant, and internal tools. This forces us to fix pain points.


    What's Next


    We're working on:

  • Agent orchestration - multiple AI agents working together
  • Voice-first experiences - beyond text conversations
  • Proactive conversations - reach out before users ask
  • Conversation analytics - understand what's working
  • White-label platform - customers can rebrand and resell

Want to Build With Us?


For developers:

Read our docs | Try our API


For businesses:

See pricing | Talk to us


---


*Questions about our technical decisions? Email us at hello@ilq.ai*