0504.1.mp4
WhatsApp AI Automation is a portfolio-grade customer service assistant for WhatsApp. It combines a Baileys WhatsApp client, an Express API, a Prisma/PostgreSQL data layer, Groq LLM responses, and a Next.js dashboard shell.
Status: active MVP. The backend message loop, AI pipeline, Prisma schema, seed data, and dashboard foundation are implemented. Some admin dashboard features are still planned.
- WhatsApp message ingestion with Baileys QR login
- AI responses through Groq Llama models
- RAG-lite FAQ retrieval from PostgreSQL
- Human handoff detection with configurable keywords
- Conversation and message persistence with Prisma
- Multi-business data model foundation
- Next.js dashboard foundation with Clerk authentication
| Layer | Technology |
|---|---|
| API | Node.js, Express, TypeScript |
| Baileys | |
| AI | Groq SDK, Llama 3.1 |
| Database | PostgreSQL, Supabase, Prisma |
| Web | Next.js 14, Tailwind CSS, Clerk |
| Quality | Node test runner, TypeScript, GitHub Actions |
apps/
api/ Express API, WhatsApp client, AI pipeline, Prisma schema
web/ Next.js dashboard
packages/
shared-types/
docs/ Architecture notes, roadmap, interview explanations
- Node.js 18 or newer
- PostgreSQL database, local or Supabase
- Groq API key
- WhatsApp account for QR pairing
- Install dependencies:
npm install- Copy environment variables:
cp .env.example .env- Fill the required values:
DATABASE_URL="postgresql://postgres:password@localhost:5432/whatsapp_ai"
GROQ_API_KEY="your_groq_key_here"- Generate Prisma Client:
npm run prisma:generate- Apply your database schema and seed demo data:
npm run seed- Start the API:
npm run dev --workspace=@wa-automation/api-
Scan the QR code shown in the terminal to connect WhatsApp.
-
Start the web dashboard in another terminal:
npm run dev --workspace=@wa-automation/webThe seed script creates:
- A default demo business with ID
default - AI settings for Groq
- FAQ examples for opening hours, location, and menu recommendations
- A sample conversation with inbound and outbound messages
This matches the current API code path, which uses businessId = "default" for incoming WhatsApp messages.
npm run typecheck
npm test
npm run build
npm run prisma:generate
npm run seedDo not commit .env, WhatsApp session folders, QR screenshots, phone numbers, or real customer conversations.
Baileys stores WhatsApp credentials locally. This repo ignores .wa-auth/, auth/, and auth_info_baileys/. If a session file was committed before, remove it from Git tracking and reconnect WhatsApp to generate a fresh session.
- Admin API endpoints for conversation and FAQ management
- Dashboard integration with live API data
- FAQ CRUD UI
- Analytics for message volume, handoff rate, and FAQ usage
- Queue-based message processing for production workloads
- Optional pgvector retrieval for larger knowledge bases
- Deployment guide for Railway, Vercel, and Supabase
MIT