Skip to content

SultanAiMaster/OneClickAgent

Repository files navigation

🚀 OneClickAgent

WhatsApp-first AI business automation for Indian small businesses. 100% FREE to run.

Customer WhatsApp pe message karta hai → AI Hindi mein reply karti hai → Appointment book hoti hai → Payment collect hota hai. Sab autopilot pe.

💰 Total Running Cost: ₹0

Service Provider Cost
AI Brain Groq (LLaMA 3.1 70B) FREE
AI Fallback DeepSeek ~₹0.07/query
Voice STT Groq Whisper FREE
Voice TTS Google Cloud TTS FREE (1M chars/month)
Database Neon.tech PostgreSQL FREE (512MB)
Knowledge Base In-memory + disk FREE
Hosting Railway.app / Render FREE tier
WhatsApp Meta Cloud API FREE (1000 chats/month)

⚡ Deploy in 5 Minutes

Step 1: Get FREE API Keys (5 min)

Service Sign Up What You Get
Groq console.groq.com Free API key → GROQ_API_KEY
Neon neon.tech Free PostgreSQL → DATABASE_URL
Meta developers.facebook.com WhatsApp API → WHATSAPP_TOKEN + PHONE_NUMBER_ID

Step 2: Deploy on Railway (FREE)

  1. Push code to GitHub
  2. Go to railway.app → New Project → Deploy from GitHub
  3. Add environment variables (from .env.example)
  4. Done! Get your URL: https://your-app.railway.app

Step 3: Connect WhatsApp

  1. Meta Developer Dashboard → WhatsApp → Configuration
  2. Webhook URL: https://your-app.railway.app/webhook
  3. Verify Token: same as WHATSAPP_VERIFY_TOKEN in env
  4. Subscribe to: messages

OR: Deploy on Render (FREE)

  1. Push to GitHub
  2. render.com → New Web Service → Connect repo
  3. It auto-detects render.yaml — just add env vars
  4. Done!

OR: Run Locally

git clone <your-repo>
cd OneClickAgent
cp .env.example .env    # Fill in your keys
npm install
npx prisma generate
npx prisma migrate dev
npm run dev

🏗️ Architecture

Customer WhatsApp Message
        ↓
   Webhook (Express)
        ↓
   Agent Router (intent detection)
        ↓
   ┌─────────────┬──────────┬──────────────┐
   │ Receptionist │  Sales   │   Support    │
   │   Agent      │  Agent   │   Agent      │
   └──────┬───────┴────┬─────┴──────┬───────┘
          ↓            ↓            ↓
   AI Engine (Groq FREE → DeepSeek fallback)
          ↓
   Knowledge Base (in-memory, persisted to disk)
          ↓
   WhatsApp Reply (text + voice + buttons)

🔌 API Endpoints

Auth

Method Endpoint Description
POST /api/auth/register Register business
POST /api/auth/login Login → JWT token
GET /api/auth/profile Get profile

Dashboard (JWT required)

Method Endpoint Description
GET /api/dashboard/stats Analytics overview
GET /api/dashboard/conversations List conversations
GET /api/dashboard/conversations/:id Conversation + messages
GET /api/dashboard/customers Customer list + search
GET /api/dashboard/bookings All bookings
GET /api/dashboard/payments All payments
GET /api/dashboard/engine AI engine health

Operations (JWT required)

Method Endpoint Description
POST /api/payments/create-link Generate payment link
PATCH /api/bookings/:id/cancel Cancel booking
PATCH /api/bookings/:id/reschedule Reschedule booking
POST /api/broadcast/send Bulk WhatsApp broadcast
POST /api/broadcast/follow-ups Auto follow-ups

Knowledge Base (JWT required)

Method Endpoint Description
POST /api/knowledge/upload Upload PDF/Excel/Word
POST /api/knowledge/text Add text knowledge
GET /api/knowledge/search?q=... Search knowledge
DELETE /api/knowledge Clear all

🤖 Multi-Agent System

Agent Handles Trigger Keywords
Receptionist Greet, route, book appointments hi, namaste, book, appointment
Sales Products, pricing, payment links price, kitna, pay, Rs
Support Complaints, escalation problem, dikkat, refund, kharab

Auto-detects intent in Hindi, Hinglish, English, Tamil, Telugu. Human handoff triggers when AI confidence < 30%.

🗣️ Voice (All FREE)

  • Groq Whisper → Customer voice note → text (FREE tier)
  • Google TTS → AI reply → voice message (FREE 1M chars/month)
  • gTTS fallback → Unlimited free TTS (Python)
  • Auto voice reply when customer sends voice note

📁 Project Structure

OneClickAgent/
├── src/
│   ├── index.js                # Express server
│   ├── config/index.js         # Configuration
│   ├── engine/EngineService.js # AI brain (Groq/DeepSeek)
│   ├── agents/
│   │   ├── AgentRouter.js      # Intent → Agent
│   │   ├── ReceptionistAgent.js
│   │   ├── SalesAgent.js
│   │   └── SupportAgent.js
│   ├── services/
│   │   ├── WhatsAppService.js  # Meta Cloud API
│   │   ├── VoiceService.js     # Whisper + TTS
│   │   ├── BookingService.js   # Google Calendar
│   │   ├── PaymentService.js   # Razorpay + Stripe
│   │   ├── KnowledgeService.js # Vector search
│   │   └── BroadcastService.js # Bulk + cron
│   ├── routes/                 # 7 route files
│   ├── middleware/auth.js      # JWT auth
│   └── utils/logger.js
├── prisma/schema.prisma        # 6 DB tables
├── railway.json                # Railway deploy config
├── render.yaml                 # Render deploy config
├── docker-compose.yml          # Local Docker setup
├── Dockerfile
└── .env.example

🧪 Test Results: 33/33 Passed

Engine: 10/10 ✅  |  Agents: 10/10 ✅  |  WhatsApp: 4/4 ✅
Knowledge: 4/4 ✅  |  Auth: 4/4 ✅  |  API: 1/1 ✅

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages