WhatsApp Chat Analyzer
January 12, 2026 · View on GitHub
Overview
The WhatsApp Chat Analyzer is a web-based application that allows users to upload WhatsApp chat logs in .txt format and analyze them. The application processes the chat data and generates insights such as average reply times, message counts, and more. Additionally, users can upload CSV or Excel files to further analyze the data and download a psychological report on the chat participants.
Features
- Upload WhatsApp chat logs in
.txtformat for analysis. - Upload CSV/Excel files for advanced analysis.
- Download processed chat data in CSV format.
- Generate psychological reports from CSV/Excel data.
- Responsive design and clean user interface using Bootstrap.
- Includes validation for file types before uploading.
Tech Stack
- Backend: Flask (Python)
- Frontend: HTML, CSS, JavaScript, jQuery, Bootstrap
- Processing: Pandas for CSV/Excel data manipulation
- Deployment: Gunicorn, Heroku
- AI Integration: OpenAI GPT-4 API for human psychology report generation
Installation
- Clone the repository:
git clone https://github.com/onurcangnc/whatsapp_chat_analyzer.git
cd whatsapp_chat_analyzer
- Install dependencies:
pip install -r requirements.txt
- Set up environment variables:
Create a .env file in the project root. You can start from .env.example and define:
FLASK_SECRET_KEY=your_secret_key
OPENAI_API_KEY=your_openai_api_key
FLASK_RUN_HOST=127.0.0.1
FLASK_RUN_PORT=5000
OPENAI_RPM_LIMIT=3
CHAT_CHUNK_MAX_CHARS=8000
REPORT_CACHE_DIR=report_cache
- Run the app locally:
flask run
The app will be available at http://127.0.0.1:5000/
You can override the bind host and port when running via python app.py:
FLASK_RUN_HOST=0.0.0.0 FLASK_RUN_PORT=8080 python app.py
You can also configure OpenAI pacing to respect your RPM limits:
OPENAI_RPM_LIMIT=3 CHAT_CHUNK_MAX_CHARS=8000 python app.py
- Deploy on Heroku:
Use the Procfile provided for deployment on Heroku.
heroku create
git push heroku master
Usage
-
Uploading a WhatsApp chat log:
- Browse and select a
.txtfile containing a WhatsApp chat export. - Once uploaded, the chat log will be processed and analyzed.
- Browse and select a
-
Download CSV:
- After processing the chat log, you can download the analyzed data as a CSV file.
-
Generating Psychological Report:
- You can also upload CSV/Excel files to generate psychological reports about the chat participants.
Supported Export Formats
- Desktop export:
[dd/mm/yyyy, HH:MM:SS] Sender: message(also acceptsdd.mm.yyyy). - Mobile export:
m/d/yy, HH:MM - Sender: message(system lines without a sender are supported).
File Structure
app.py: Contains the Flask server logic and routes.requirements.txt: Lists the Python dependencies required for the project.Procfile: Configuration for deploying on Heroku.static/: Contains static files such as custom CSS (style.css) and JavaScript (script.js).templates/: Contains HTML templates such as index.html.
Contributing
Feel free to fork the project, open issues, and submit pull requests. For major changes, please open an issue first to discuss what you would like to change.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Authors
Original Author: Onurcan Genç
Fixes and enhancements: Steve Clement