A powerful WhatsApp chatbot built with Next.js that provides automated customer service, order processing, and business automation.
- AI-Powered Conversations: Uses OpenAI GPT-4 for natural language processing
- Order Management: Handles complete order workflow from service selection to payment
- Customer Data Collection: Stores and retrieves customer information
- Google Sheets Integration: Syncs data with Google Sheets for order tracking
- Xata Database: Persistent storage for conversations and order states
- WhatsApp Integration: Connects with WhatsApp via API for messaging
- Multi-language Support: Responds in Bahasa Indonesia and English
- Frontend: Next.js 14, TypeScript, Tailwind CSS
- Backend: Next.js API Routes
- AI: OpenAI GPT-4
- Database: Xata (PostgreSQL)
- Storage: Google Sheets API
- Messaging: WhatsApp Business API
- Deployment: Vercel
- Clone the repository:
git clone https://github.com/yeheskieltame/chatbot-wa.git
cd chatbot-wa
- Install dependencies:
npm install
- Set up environment variables:
cp .env.example .env.local
- Configure required environment variables:
OPENAI_API_KEY=your_openai_key
XATA_API_KEY=your_xata_key
GOOGLE_SHEETS_CREDENTIALS=your_google_credentials
WHATSAPP_API_KEY=your_whatsapp_key
- Run the development server:
npm run dev
-
Create a Google Sheet with these tabs:
- Profile
- LAYANAN (Services)
- PORTOFOLIO
- TESTIMONI (Testimonials)
- SKILLS
- SOSIAL MEDIA
- FAQ
- ORDER
- Customers
-
Enable Google Sheets API and share the sheet with your service account
- Create tables in Xata:
- conversations (fields: sessionId, messages)
- order_states (fields: sessionId, stage, service, customNotes, price, customerData, paymentMethod)
- Start the chatbot:
npm run dev
- Connect to WhatsApp:
- Use a WhatsApp Business API provider
- Set the webhook URL to your deployed endpoint
- Chatbot Commands:
- "Order" - Start a new service order
- "Help" - Get assistance
- "Status" - Check order status
(Add screenshots of the chatbot in action here)
This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.