Skip to content

FaaizaKarim/AI-Lead_Qualifier

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

14 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

image image image image image image image lead8 lead9 image image

πŸ€– AI Lead Qualifier Agent

An AI-powered Sales Development Representative that lives on your website, qualifies visitors, and books meetings β€” automatically.

Built with: Grok AI (xAI) Β· Calendly Β· SQLite Β· React + Vite Β· Node.js + Express


πŸš€ Quick Start

1. Clone and install

# Backend
cd backend
npm install

# Frontend
cd ../frontend
npm install

2. Configure backend

cd backend
cp .env.example .env

Edit .env and fill in:

  • openRouter_API_KEY β€” get free at console.x.ai
  • openrouter_MODEL β€” use grok-3-mini (free tier)
  • DASHBOARD_API_KEY β€” any secret string for dashboard auth
  • CALENDLY_BOOKING_URL β€” your Calendly scheduling link
  • CALENDLY_API_KEY β€” optional, enables personalized booking links

3. Start backend

cd backend
npm run dev
# β†’ API running at http://localhost:3001

4. Start frontend

cd frontend
npm run dev
# β†’ Dashboard at http://localhost:5173

πŸ“ File Structure

ai-lead-qualifier/
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ app.js                  ← Express entry point
β”‚   β”‚   β”œβ”€β”€ routes/
β”‚   β”‚   β”‚   β”œβ”€β”€ chat.js             ← POST /api/chat (Grok AI)
β”‚   β”‚   β”‚   β”œβ”€β”€ leads.js            ← GET/DELETE /api/leads
β”‚   β”‚   β”‚   └── meetings.js         ← POST /api/meetings/book
β”‚   β”‚   β”œβ”€β”€ services/
β”‚   β”‚   β”‚   β”œβ”€β”€ grokService.js      ← Grok API + system prompt
β”‚   β”‚   β”‚   β”œβ”€β”€ qualifierService.js ← BANT extraction + scoring
β”‚   β”‚   β”‚   β”œβ”€β”€ meetingService.js   ← Calendly integration
β”‚   β”‚   β”‚   └── emailService.js     ← Booking confirmation emails
β”‚   β”‚   β”œβ”€β”€ models/
β”‚   β”‚   β”‚   β”œβ”€β”€ Lead.js             ← Lead DB operations
β”‚   β”‚   β”‚   └── Conversation.js     ← Chat history DB operations
β”‚   β”‚   β”œβ”€β”€ middleware/
β”‚   β”‚   β”‚   β”œβ”€β”€ auth.js             ← API key protection
β”‚   β”‚   β”‚   └── cors.js             ← CORS for embeds
β”‚   β”‚   └── db/
β”‚   β”‚       β”œβ”€β”€ database.js         ← SQLite connection
β”‚   β”‚       └── migrations.js       ← Table setup
β”‚   └── .env.example
β”‚
β”œβ”€β”€ frontend/
β”‚   └── src/
β”‚       β”œβ”€β”€ components/
β”‚       β”‚   β”œβ”€β”€ ChatWidget.jsx      ← Floating chat bubble
β”‚       β”‚   β”œβ”€β”€ ChatWindow.jsx      ← Full chat UI
β”‚       β”‚   β”œβ”€β”€ Dashboard.jsx       ← Stats + lead management
β”‚       β”‚   β”œβ”€β”€ Sidebar.jsx         ← Lead list with filters
β”‚       β”‚   β”œβ”€β”€ LeadCard.jsx        ← Lead detail + transcript
β”‚       β”‚   β”œβ”€β”€ QualPanel.jsx       ← BANT score breakdown
β”‚       β”‚   └── MeetingPanel.jsx    ← Booking status
β”‚       β”œβ”€β”€ pages/
β”‚       β”‚   β”œβ”€β”€ Home.jsx            ← Main dashboard page
β”‚       β”‚   └── EmbedPage.jsx       ← Standalone widget page
β”‚       β”œβ”€β”€ hooks/
β”‚       β”‚   β”œβ”€β”€ useChat.js          ← Chat state management
β”‚       β”‚   └── useLeads.js         ← Lead data fetching
β”‚       └── utils/
β”‚           └── scoring.js          ← Score colors + helpers
β”‚
└── embed/
    └── widget.js                   ← One-line embed script

πŸ”Œ API Endpoints

Method Endpoint Auth Description
POST /api/chat None Send message, get AI response
GET /api/chat/session/:id None Get conversation transcript
GET /api/leads API Key List all leads
GET /api/leads/stats API Key Dashboard stats
GET /api/leads/:id API Key Lead detail + history
DELETE /api/leads/:id API Key Delete a lead
POST /api/meetings/book None Trigger booking for session
POST /api/meetings/webhook None Calendly webhook receiver
GET /api/meetings API Key List all booked meetings

🌐 Embed on any website

Paste before </body>:

<script src="https://your-domain.com/widget.js" data-api="https://your-domain.com/api" async></script>

Works on: Webflow, WordPress, Wix, Shopify, custom HTML β€” anywhere.


πŸ’° Pricing Tiers (suggested)

Plan Price Features
Starter $49/mo 1 site Β· 100 leads/mo Β· Basic chat
Growth ⭐ $149/mo AI qualification · Calendly booking · Email follow-ups
Pro $399/mo Multi-site Β· Advanced scoring Β· Team dashboard

10 Growth customers = $1,490 MRR β€” you need zero code changes to get there.


πŸ›  Tech Stack

  • AI: Grok (xAI free API) β€” grok-3-mini
  • Backend: Node.js, Express, better-sqlite3
  • Frontend: React 18, Vite, React Router
  • Database: SQLite (zero setup, file-based)
  • Booking: Calendly API
  • Email: Nodemailer (Gmail SMTP)
  • Embed: Vanilla JS widget (~3kb)

About

AI-powered Sales Development Representative that lives on your website qualifies visitors using BANT scoring, books meetings via Calendly, and manages leads through an admin dashboard. Built with Grok AI, Node.js, React & SQLite.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors