An intelligent WhatsApp chatbot powered by an AI backend to provide relevant and contextual responses. This project uses a two-part architecture: a WhatsApp bot frontend built with Node.js and an AI backend built with Python and FastAPI.
Repositori ini juga berisi tugas akhir dengan judul:
Pengembangan Chatbot AI Berbasis Large Language Model (LLM) LangChain dengan Retrieval-Augmented Generation (RAG) pada Customer Service di PT. Telemedia Prima Nusantara
| Penulis | Moh Wildan Haikhal |
| Institusi | Politeknik Negeri Sriwijaya |
| Program | D-IV Manajemen Informatika |
| Tahun | 2025 |
This project consists of two main services working together:
-
WhatsApp Bot (Node.js):
- Located in the
whatsapp-bot/directory. - Uses the Baileys library to connect to WhatsApp.
- It's responsible for receiving incoming messages, sending replies, and handling basic interactions like greetings or static info.
- For complex questions, the bot forwards them to the AI backend via an API request.
- Located in the
-
AI Backend (Python):
- Located in the root directory.
- Built with FastAPI to provide an API endpoint (
/chat). - Uses LangChain and models from OpenAI to understand and process natural language questions.
- Leverages FAISS CPU as a vector store for relevant information retrieval (Retrieval-Augmented Generation - RAG) from available data.
- Quick Greeting Responses: Handles common greetings directly at the bot level for efficiency.
- Static Info: Provides quick answers for common questions like addresses or technician contacts.
- AI Processing (RAG): Forwards complex questions to the Python backend for context-aware, data-driven answers.
- History Logging: Saves conversation history for each user.
- Media Handling: Saves media files sent by users.
| Component | Technology |
|---|---|
| WhatsApp Bot | |
| AI Backend | |
| Deployment |
Ensure you have Python 3.8+ installed.
-
Clone the repository:
git clone https://github.com/akariwill/Chatbot-AI.git cd chatbot-ai -
Create and activate a virtual environment:
python -m venv venv source venv/bin/activate # On Windows, use `venv\Scripts\activate`
-
Install Python dependencies:
pip install -r requirements.txt
-
Set up environment variables:
- Create a
.envfile in the root directory. - Add your
OPENAI_API_KEYto this file:
OPENAI_API_KEY="sk-..." - Create a
-
Run the FastAPI server:
uvicorn app:app --host 0.0.0.0 --port 8000
The AI server is now running at
http://localhost:8000.
Ensure you have Node.js v16+ installed.
-
Navigate to the bot directory:
cd whatsapp-bot -
Install Node.js dependencies:
npm install
-
Run the bot:
npm start
- A QR code will appear in the terminal.
- Scan the QR code with your WhatsApp mobile app (Link a device).
Once both services are running, your bot will be active and ready to respond to messages on WhatsApp.
chatbot-ai/
├── index.html # Website tugas akhir (isi skripsi dalam HTML)
├── Research.pdf # Dokumen lengkap skripsi (PDF)
├── extract_images_from_pdf.py website
├── website/
│ ├── css/
│ ├── javascript/
│ └── img/
│ └── research/
├── whatsapp-bot/ # WhatsApp Bot Frontend (Node.js)
│ ├── index.js
│ ├── package.json
│ └── auth_info/ # (Auto-generated, ignored by Git)
├── app.py # Entry point for the AI server (FastAPI)
├── main.py # Core chatbot logic (LangChain)
├── requirements.txt # Python dependencies
├── Dockerfile # Configuration for containerization
├── assets/
│ └── Data/ # Data for RAG
└── ...
This project is licensed under the MIT License.
If you have any questions or feedback, feel free to contact me on Discord wildanjr_ or Instagram akariwill.

