|
| 1 | +# PingU.RO |
1 | 2 |
|
2 | | -# 🤖 WhatsApp Chat GPT Bot (OpenAI + @open-wa/wa-automate) |
| 3 | +PingU.RO is a WhatsApp powered CRM web application that lets you manage contacts, appointments and marketing campaigns. It uses **wa-automate-nodejs** for WhatsApp messaging and **MongoDB** for persistence. |
3 | 4 |
|
4 | | -This is a lightweight WhatsApp bot that responds to private messages with financial market predictions using OpenAI's GPT-3.5 model. It uses [@open-wa/wa-automate](https://github.com/open-wa/wa-automate-nodejs) to interface with WhatsApp Web. |
| 5 | +## Features |
5 | 6 |
|
6 | | ---- |
| 7 | +- User registration with email verification |
| 8 | +- JWT based login/logout |
| 9 | +- Connect your WhatsApp account and keep the session persistent |
| 10 | +- Manage contacts individually or via CSV import |
| 11 | +- Schedule appointments with WhatsApp reminders |
| 12 | +- Create marketing campaigns sent via WhatsApp |
| 13 | +- Optional test mode to avoid sending real messages |
7 | 14 |
|
8 | | -## ⚙️ Features |
| 15 | +## Project Structure |
9 | 16 |
|
10 | | -- Auto-responds to incoming private WhatsApp messages |
11 | | -- Uses ChatGPT to provide financial insights and predictions |
12 | | -- Short, confident responses in expert tone |
13 | | - |
14 | | ---- |
| 17 | +``` |
| 18 | +/backend - Express API |
| 19 | +/frontend - React app |
| 20 | +/shared - shared interfaces |
| 21 | +/test - seed scripts |
| 22 | +``` |
15 | 23 |
|
16 | | -## 📦 Setup Instructions |
| 24 | +## Installation |
17 | 25 |
|
18 | | -### 1. Clone or download this repo |
| 26 | +### Backend |
19 | 27 |
|
20 | 28 | ```bash |
21 | | -git clone https://github.com/dumebai/whatsapp-chat-gpt.git |
22 | | -cd whatsapp-chat-gpt |
| 29 | +cd backend |
| 30 | +npm install |
23 | 31 | ``` |
24 | 32 |
|
25 | | -### 2. Install required packages |
| 33 | +### Frontend |
26 | 34 |
|
27 | 35 | ```bash |
| 36 | +cd ../frontend |
28 | 37 | npm install |
29 | 38 | ``` |
30 | 39 |
|
31 | | -### 3. Create a `.env` file |
| 40 | +## Environment Variables |
32 | 41 |
|
33 | | -Inside the root directory, create a `.env` file: |
| 42 | +Create `.env` in the project root or inside backend with the following keys (see `.env.example`): |
34 | 43 |
|
35 | 44 | ```env |
36 | | -OPENAI_API_KEY=sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |
| 45 | +WHATSAPP_SESSION_PATH=./sessions/ |
| 46 | +WHATSAPP_CHROMIUM_ARGS=--no-sandbox --disable-setuid-sandbox |
| 47 | +MONGODB_URI=mongodb+srv://user:pass@cluster.mongodb.net/dbname |
| 48 | +JWT_SECRET=supersecret |
| 49 | +JWT_EXPIRES_IN=1d |
| 50 | +SMTP_HOST=smtp.example.com |
| 51 | +SMTP_PORT=465 |
| 52 | +SMTP_USER=user@example.com |
| 53 | +SMTP_PASS=password |
| 54 | +OPENAI_API_KEY=sk-... |
| 55 | +BASE_URL=http://localhost:5000 |
| 56 | +FRONTEND_URL=http://localhost:3000 |
| 57 | +TEST_MODE=true |
37 | 58 | ``` |
38 | 59 |
|
39 | | -You can get your API key from [https://platform.openai.com/account/api-keys](https://platform.openai.com/account/api-keys) |
| 60 | +For the React frontend copy `frontend/.env.example` to `frontend/.env` and adjust the API base URL if needed. |
| 61 | + |
| 62 | +## Running in Development |
40 | 63 |
|
41 | | ---- |
| 64 | +Start the backend API: |
42 | 65 |
|
43 | | -## 🚀 Run the Bot |
| 66 | +```bash |
| 67 | +cd backend |
| 68 | +npm run dev |
| 69 | +``` |
| 70 | + |
| 71 | +In a new terminal start the frontend: |
44 | 72 |
|
45 | 73 | ```bash |
| 74 | +cd frontend |
46 | 75 | npm start |
47 | 76 | ``` |
48 | 77 |
|
49 | | -A QR code will appear in the terminal – scan it using your WhatsApp mobile app to activate the session. |
| 78 | +Scan the QR displayed in the backend terminal to connect WhatsApp. |
50 | 79 |
|
51 | | ---- |
| 80 | +## Seed Data |
52 | 81 |
|
53 | | -## 💬 Example Prompts |
| 82 | +``` |
| 83 | +npm run seed |
| 84 | +``` |
54 | 85 |
|
55 | | -- “What's your take on Bitcoin this week?” |
56 | | -- “Is it a good time to invest in Tesla?” |
57 | | -- “What's the market sentiment for Ethereum?” |
58 | | -- “Will inflation go down in the next quarter?” |
| 86 | +This creates a user `test@pingu.ro` with password `password`. |
59 | 87 |
|
60 | | ---- |
| 88 | +## Usage |
61 | 89 |
|
62 | | -## 🧠 Tech Stack |
| 90 | +1. Register a new account and verify your email |
| 91 | +2. Login to access the dashboard |
| 92 | +3. Connect your WhatsApp account via QR code |
| 93 | +4. Add contacts and schedule appointments or campaigns |
| 94 | +5. Reminders and campaign messages are sent automatically |
63 | 95 |
|
64 | | -- `@open-wa/wa-automate` – for WhatsApp automation |
65 | | -- `openai` – to communicate with GPT-3.5 |
66 | | -- `dotenv` – to securely load environment variables |
| 96 | +## Production Notes |
| 97 | + |
| 98 | +To build for production run: |
| 99 | +```bash |
| 100 | +cd frontend |
| 101 | +npm run build |
| 102 | +``` |
| 103 | +Copy the `build` folder to your preferred static host or configure your Node.js server to serve it. The backend can be started with: |
| 104 | +```bash |
| 105 | +node backend/app.js |
| 106 | +``` |
67 | 107 |
|
68 | | ---- |
69 | 108 |
|
70 | | -## 🔒 Notes |
| 109 | +- The frontend can be deployed to **Vercel**. |
| 110 | +- Any Node.js hosting supporting MongoDB can run the backend. |
| 111 | + |
| 112 | +### Docker |
| 113 | + |
| 114 | +```bash |
| 115 | +docker-compose up --build |
| 116 | +``` |
71 | 117 |
|
72 | | -- This bot only responds to **private messages**, not group chats. |
73 | | -- Make sure to **keep your OpenAI key private** and monitor usage limits to avoid unexpected charges. |
| 118 | +### CI |
74 | 119 |
|
75 | | ---- |
| 120 | +GitHub Actions validates the backend on each push by installing dependencies and checking the database connection. |
76 | 121 |
|
77 | | -## 📜 License |
| 122 | +## License |
78 | 123 |
|
79 | | -MIT – free to use, modify, and commercialize with attribution. If you find this useful, give credit or build something big with it 🚀 |
| 124 | +MIT |
0 commit comments