pywacli 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pywacli-0.1.0/LICENSE +21 -0
- pywacli-0.1.0/PKG-INFO +268 -0
- pywacli-0.1.0/README.md +231 -0
- pywacli-0.1.0/pyproject.toml +38 -0
- pywacli-0.1.0/setup.cfg +4 -0
- pywacli-0.1.0/src/pywacli/__init__.py +1 -0
- pywacli-0.1.0/src/pywacli/cli/__init__.py +0 -0
- pywacli-0.1.0/src/pywacli/cli/__main__.py +184 -0
- pywacli-0.1.0/src/pywacli/cli/app.py +14 -0
- pywacli-0.1.0/src/pywacli/cli/config_manager.py +105 -0
- pywacli-0.1.0/src/pywacli/cli/configuration.py +621 -0
- pywacli-0.1.0/src/pywacli/cli/ui/__init__.py +0 -0
- pywacli-0.1.0/src/pywacli/cli/ui/dashboard.py +161 -0
- pywacli-0.1.0/src/pywacli/cli/ui/live_feed.py +0 -0
- pywacli-0.1.0/src/pywacli/cli/ui/media_viewer.py +242 -0
- pywacli-0.1.0/src/pywacli/cli/ui/tables.py +0 -0
- pywacli-0.1.0/src/pywacli/db/__init__.py +0 -0
- pywacli-0.1.0/src/pywacli/db/bucket_connection.py +60 -0
- pywacli-0.1.0/src/pywacli/db/database.py +554 -0
- pywacli-0.1.0/src/pywacli/db/init_db.py +20 -0
- pywacli-0.1.0/src/pywacli/db/retriver_db.py +111 -0
- pywacli-0.1.0/src/pywacli/package.json +12 -0
- pywacli-0.1.0/src/pywacli/services/__init__.py +0 -0
- pywacli-0.1.0/src/pywacli/services/baileys_service.js +415 -0
- pywacli-0.1.0/src/pywacli/services/session_manager.js +14 -0
- pywacli-0.1.0/src/pywacli/services/websocket_services.py +156 -0
- pywacli-0.1.0/src/pywacli/services/ws_server.js +87 -0
- pywacli-0.1.0/src/pywacli/utils/__init__.py +0 -0
- pywacli-0.1.0/src/pywacli/utils/bucket_utils.py +46 -0
- pywacli-0.1.0/src/pywacli/utils/local_utils.py +14 -0
- pywacli-0.1.0/src/pywacli.egg-info/PKG-INFO +268 -0
- pywacli-0.1.0/src/pywacli.egg-info/SOURCES.txt +34 -0
- pywacli-0.1.0/src/pywacli.egg-info/dependency_links.txt +1 -0
- pywacli-0.1.0/src/pywacli.egg-info/entry_points.txt +2 -0
- pywacli-0.1.0/src/pywacli.egg-info/requires.txt +5 -0
- pywacli-0.1.0/src/pywacli.egg-info/top_level.txt +1 -0
pywacli-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Mantiz
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
pywacli-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pywacli
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: WhatsApp CLI Tool built with Python and Baileys
|
|
5
|
+
Author: Prem Raj
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2026 Mantiz
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
27
|
+
|
|
28
|
+
Requires-Python: >=3.10
|
|
29
|
+
Description-Content-Type: text/markdown
|
|
30
|
+
License-File: LICENSE
|
|
31
|
+
Requires-Dist: typer>=0.12
|
|
32
|
+
Requires-Dist: rich
|
|
33
|
+
Requires-Dist: websockets
|
|
34
|
+
Requires-Dist: boto3
|
|
35
|
+
Requires-Dist: python-dotenv
|
|
36
|
+
Dynamic: license-file
|
|
37
|
+
|
|
38
|
+
# PyWacli — Python WhatsApp CLI
|
|
39
|
+
|
|
40
|
+
Real-time WhatsApp ingestion and monitoring system built with Python, [Baileys](https://github.com/WhiskeySockets/Baileys), WebSockets, SQLite, [Rich](https://github.com/Textualize/rich), and S3-compatible storage. Captures messages, edits, reactions, statuses, images, videos, and documents with a live terminal dashboard, media syncing, and conversation tracking.
|
|
41
|
+
|
|
42
|
+
## Features
|
|
43
|
+
|
|
44
|
+
- **Live Dashboard** — Real-time terminal UI with message feed and database statistics (Rich + `Live`)
|
|
45
|
+
- **WhatsApp Ingestion** — Full event capture via Baileys (messages, edits, reactions, statuses, media)
|
|
46
|
+
- **Media Storage** — Automatically sync media to S3, Cloudflare R2, or local filesystem with per-media-type filtering
|
|
47
|
+
- **Media Viewer** — Browse, inspect, and download stored media by type (image/video/document)
|
|
48
|
+
- **Interactive Setup** — Guided configuration wizard for WhatsApp connection, storage providers, DB path, dashboard theme, and logging
|
|
49
|
+
- **SQLite Database** — 7 tables: messages, edits, statuses, reactions, media, media_handshake, conversations
|
|
50
|
+
- **CLI Menu** — Simple numbered menu for all operations
|
|
51
|
+
- **Multiple Themes** — Default, Dark, and Light dashboard themes
|
|
52
|
+
|
|
53
|
+
## Architecture
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
WhatsApp (mobile)
|
|
57
|
+
|
|
|
58
|
+
| Baileys library
|
|
59
|
+
v
|
|
60
|
+
Node.js (baileys_service.js)
|
|
61
|
+
|-- Downloads media to media/ folder
|
|
62
|
+
|-- Normalizes events
|
|
63
|
+
|
|
|
64
|
+
v
|
|
65
|
+
WebSocket Server (ws_server.js :3000)
|
|
66
|
+
|
|
|
67
|
+
+---> Python Client (websocket_services.py)
|
|
68
|
+
|
|
|
69
|
+
+---> SQLite (messages, media, etc.)
|
|
70
|
+
+---> S3 / R2 / Local (media files)
|
|
71
|
+
+---> Rich Dashboard (dashboard.py)
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Prerequisites
|
|
75
|
+
|
|
76
|
+
- Python 3.10+
|
|
77
|
+
- Node.js 18+
|
|
78
|
+
- npm
|
|
79
|
+
- (Optional) Localstack or S3-compatible storage for media sync
|
|
80
|
+
|
|
81
|
+
## Installation
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
# Clone the repository
|
|
85
|
+
git clone <repo-url> && cd pywacli
|
|
86
|
+
|
|
87
|
+
# Python dependencies
|
|
88
|
+
python -m venv .venv
|
|
89
|
+
.venv\Scripts\activate # Windows
|
|
90
|
+
# source .venv/bin/activate # Linux/Mac
|
|
91
|
+
pip install -r requirements.txt
|
|
92
|
+
|
|
93
|
+
# Node.js dependencies
|
|
94
|
+
npm install
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Configuration
|
|
98
|
+
|
|
99
|
+
Run the setup wizard to configure everything interactively:
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
python main.py setup
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Or configure individual sections later via the menu.
|
|
106
|
+
|
|
107
|
+
### Configuration file location
|
|
108
|
+
|
|
109
|
+
```
|
|
110
|
+
~/.pywacli/config.json
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### Sections
|
|
114
|
+
|
|
115
|
+
| Section | Description | Defaults |
|
|
116
|
+
|---|---|---|
|
|
117
|
+
| `whatsapp` | WebSocket URL, auto-reconnect | `ws://localhost:3000`, `true` |
|
|
118
|
+
| `media_storage` | One or more storage entries (S3/R2/Local) with media type toggles | Empty |
|
|
119
|
+
| `database` | SQLite file path | `./pywacli.db` |
|
|
120
|
+
| `dashboard` | Refresh interval, theme | `1s`, `default` |
|
|
121
|
+
| `logging` | Log level, output file | `INFO`, `./pywacli.log` |
|
|
122
|
+
|
|
123
|
+
### Example media storage entry
|
|
124
|
+
|
|
125
|
+
```json
|
|
126
|
+
{
|
|
127
|
+
"store_image": true,
|
|
128
|
+
"store_video": true,
|
|
129
|
+
"store_document": true,
|
|
130
|
+
"provider": "s3",
|
|
131
|
+
"endpoint": "http://localhost:4566",
|
|
132
|
+
"access_key_id": "test",
|
|
133
|
+
"secret_access_key": "test",
|
|
134
|
+
"region": "us-east-1",
|
|
135
|
+
"bucket_name": "whatsapp-media",
|
|
136
|
+
"local_path": null,
|
|
137
|
+
"id": 1
|
|
138
|
+
}
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Usage
|
|
142
|
+
|
|
143
|
+
### Start the application
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
python main.py
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
This shows the main menu:
|
|
150
|
+
|
|
151
|
+
```
|
|
152
|
+
1 Dashboard Launch the WhatsApp dashboard
|
|
153
|
+
2 Setup Run the interactive configuration wizard
|
|
154
|
+
3 Config Open configuration menu
|
|
155
|
+
4 Run Start baileys + websocket services
|
|
156
|
+
5 Media Browse stored media
|
|
157
|
+
0 Exit Exit the application
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### CLI commands
|
|
161
|
+
|
|
162
|
+
All commands are also available directly:
|
|
163
|
+
|
|
164
|
+
| Command | Description |
|
|
165
|
+
|---|---|
|
|
166
|
+
| `python main.py dashboard` | Launch the live dashboard |
|
|
167
|
+
| `python main.py setup` | Run configuration wizard |
|
|
168
|
+
| `python main.py config` | Open configuration menu |
|
|
169
|
+
| `python main.py run` | Start baileys + websocket in separate terminals |
|
|
170
|
+
| `python main.py media` | Browse and download stored media |
|
|
171
|
+
|
|
172
|
+
Or using the module directly:
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
python -m src.cli [command]
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### Run services
|
|
179
|
+
|
|
180
|
+
Opens two new terminal windows:
|
|
181
|
+
|
|
182
|
+
```bash
|
|
183
|
+
python main.py run
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
- **Terminal 1:** `node src/services/baileys_service.js` (WhatsApp client)
|
|
187
|
+
- **Terminal 2:** `python src/services/websocket_service.py` (Event listener)
|
|
188
|
+
|
|
189
|
+
After starting, scan the QR code in the Node.js terminal with WhatsApp to connect.
|
|
190
|
+
|
|
191
|
+
### Media viewer
|
|
192
|
+
|
|
193
|
+
Browse and download stored media files:
|
|
194
|
+
|
|
195
|
+
```
|
|
196
|
+
Media Viewer
|
|
197
|
+
1 Images
|
|
198
|
+
2 Videos
|
|
199
|
+
3 Documents
|
|
200
|
+
4 All Media
|
|
201
|
+
0 Back
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
Select a media ID to view full details (type, filename, sender, timestamp, sync status) and download the file from S3 or local storage.
|
|
205
|
+
|
|
206
|
+
## Events
|
|
207
|
+
|
|
208
|
+
| Event | Description |
|
|
209
|
+
|---|---|
|
|
210
|
+
| `message.new` | New text message |
|
|
211
|
+
| `message.update` | Message edited |
|
|
212
|
+
| `message.reaction` | Emoji reaction |
|
|
213
|
+
| `status.new` | Status/story update |
|
|
214
|
+
| `conversation.new` | Unified conversation event |
|
|
215
|
+
| `media.new` | Image/video/document received |
|
|
216
|
+
|
|
217
|
+
## Database tables
|
|
218
|
+
|
|
219
|
+
| Table | Contents |
|
|
220
|
+
|---|---|
|
|
221
|
+
| `messages` | Text messages with sender metadata |
|
|
222
|
+
| `message_edits` | Edit history |
|
|
223
|
+
| `statuses` | WhatsApp status updates |
|
|
224
|
+
| `reactions` | Emoji reactions |
|
|
225
|
+
| `media` | Media metadata (type, filename, path, sender) |
|
|
226
|
+
| `media_handshake` | Per-entry sync status (success/failure reason) |
|
|
227
|
+
| `conversations` | Unified conversation log |
|
|
228
|
+
|
|
229
|
+
## Project structure
|
|
230
|
+
|
|
231
|
+
```
|
|
232
|
+
pywacli/
|
|
233
|
+
├── main.py # Entry point
|
|
234
|
+
├── package.json # Node.js dependencies
|
|
235
|
+
├── requirements.txt # Python dependencies
|
|
236
|
+
├── src/
|
|
237
|
+
├── pywacli/
|
|
238
|
+
│ ├── cli/
|
|
239
|
+
│ ├── __init__.py
|
|
240
|
+
│ ├── __main__.py # Typer CLI app & menu
|
|
241
|
+
│ ├── app.py # App orchestrator
|
|
242
|
+
│ ├── config_manager.py # ~/.pywacli/config.json management
|
|
243
|
+
│ ├── configuration.py # Interactive setup wizard
|
|
244
|
+
│ └── ui/
|
|
245
|
+
│ │ ├── dashboard.py # Live Rich dashboard
|
|
246
|
+
│ │ ├── media_viewer.py # Media browser & downloader
|
|
247
|
+
│ │ ├── tables.py # (reserved)
|
|
248
|
+
│ │ └── live_feed.py # (reserved)
|
|
249
|
+
│ ├── db/
|
|
250
|
+
│ │ ├── database.py # SQLite schema & CRUD
|
|
251
|
+
│ │ ├── init_db.py # Table initializer
|
|
252
|
+
│ │ ├── retriver_db.py # Read queries
|
|
253
|
+
│ │ └── bucket_connection.py # S3/R2 connection manager
|
|
254
|
+
│ ├── services/
|
|
255
|
+
│ │ ├── baileys_service.js # WhatsApp Baileys client
|
|
256
|
+
│ │ ├── ws_server.js # WebSocket server
|
|
257
|
+
│ │ ├── session_manager.js # Baileys socket singleton
|
|
258
|
+
│ │ └── websocket_services.py # Python WebSocket consumer
|
|
259
|
+
│ └── utils/
|
|
260
|
+
│ ├── bucket_utils.py # S3 upload/download helpers
|
|
261
|
+
│ └── local_utils.py # Local file storage
|
|
262
|
+
├── .env.example # Environment template
|
|
263
|
+
└── LICENSE # MIT
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
## License
|
|
267
|
+
|
|
268
|
+
MIT
|
pywacli-0.1.0/README.md
ADDED
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
# PyWacli — Python WhatsApp CLI
|
|
2
|
+
|
|
3
|
+
Real-time WhatsApp ingestion and monitoring system built with Python, [Baileys](https://github.com/WhiskeySockets/Baileys), WebSockets, SQLite, [Rich](https://github.com/Textualize/rich), and S3-compatible storage. Captures messages, edits, reactions, statuses, images, videos, and documents with a live terminal dashboard, media syncing, and conversation tracking.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Live Dashboard** — Real-time terminal UI with message feed and database statistics (Rich + `Live`)
|
|
8
|
+
- **WhatsApp Ingestion** — Full event capture via Baileys (messages, edits, reactions, statuses, media)
|
|
9
|
+
- **Media Storage** — Automatically sync media to S3, Cloudflare R2, or local filesystem with per-media-type filtering
|
|
10
|
+
- **Media Viewer** — Browse, inspect, and download stored media by type (image/video/document)
|
|
11
|
+
- **Interactive Setup** — Guided configuration wizard for WhatsApp connection, storage providers, DB path, dashboard theme, and logging
|
|
12
|
+
- **SQLite Database** — 7 tables: messages, edits, statuses, reactions, media, media_handshake, conversations
|
|
13
|
+
- **CLI Menu** — Simple numbered menu for all operations
|
|
14
|
+
- **Multiple Themes** — Default, Dark, and Light dashboard themes
|
|
15
|
+
|
|
16
|
+
## Architecture
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
WhatsApp (mobile)
|
|
20
|
+
|
|
|
21
|
+
| Baileys library
|
|
22
|
+
v
|
|
23
|
+
Node.js (baileys_service.js)
|
|
24
|
+
|-- Downloads media to media/ folder
|
|
25
|
+
|-- Normalizes events
|
|
26
|
+
|
|
|
27
|
+
v
|
|
28
|
+
WebSocket Server (ws_server.js :3000)
|
|
29
|
+
|
|
|
30
|
+
+---> Python Client (websocket_services.py)
|
|
31
|
+
|
|
|
32
|
+
+---> SQLite (messages, media, etc.)
|
|
33
|
+
+---> S3 / R2 / Local (media files)
|
|
34
|
+
+---> Rich Dashboard (dashboard.py)
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Prerequisites
|
|
38
|
+
|
|
39
|
+
- Python 3.10+
|
|
40
|
+
- Node.js 18+
|
|
41
|
+
- npm
|
|
42
|
+
- (Optional) Localstack or S3-compatible storage for media sync
|
|
43
|
+
|
|
44
|
+
## Installation
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
# Clone the repository
|
|
48
|
+
git clone <repo-url> && cd pywacli
|
|
49
|
+
|
|
50
|
+
# Python dependencies
|
|
51
|
+
python -m venv .venv
|
|
52
|
+
.venv\Scripts\activate # Windows
|
|
53
|
+
# source .venv/bin/activate # Linux/Mac
|
|
54
|
+
pip install -r requirements.txt
|
|
55
|
+
|
|
56
|
+
# Node.js dependencies
|
|
57
|
+
npm install
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Configuration
|
|
61
|
+
|
|
62
|
+
Run the setup wizard to configure everything interactively:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
python main.py setup
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Or configure individual sections later via the menu.
|
|
69
|
+
|
|
70
|
+
### Configuration file location
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
~/.pywacli/config.json
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Sections
|
|
77
|
+
|
|
78
|
+
| Section | Description | Defaults |
|
|
79
|
+
|---|---|---|
|
|
80
|
+
| `whatsapp` | WebSocket URL, auto-reconnect | `ws://localhost:3000`, `true` |
|
|
81
|
+
| `media_storage` | One or more storage entries (S3/R2/Local) with media type toggles | Empty |
|
|
82
|
+
| `database` | SQLite file path | `./pywacli.db` |
|
|
83
|
+
| `dashboard` | Refresh interval, theme | `1s`, `default` |
|
|
84
|
+
| `logging` | Log level, output file | `INFO`, `./pywacli.log` |
|
|
85
|
+
|
|
86
|
+
### Example media storage entry
|
|
87
|
+
|
|
88
|
+
```json
|
|
89
|
+
{
|
|
90
|
+
"store_image": true,
|
|
91
|
+
"store_video": true,
|
|
92
|
+
"store_document": true,
|
|
93
|
+
"provider": "s3",
|
|
94
|
+
"endpoint": "http://localhost:4566",
|
|
95
|
+
"access_key_id": "test",
|
|
96
|
+
"secret_access_key": "test",
|
|
97
|
+
"region": "us-east-1",
|
|
98
|
+
"bucket_name": "whatsapp-media",
|
|
99
|
+
"local_path": null,
|
|
100
|
+
"id": 1
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Usage
|
|
105
|
+
|
|
106
|
+
### Start the application
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
python main.py
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
This shows the main menu:
|
|
113
|
+
|
|
114
|
+
```
|
|
115
|
+
1 Dashboard Launch the WhatsApp dashboard
|
|
116
|
+
2 Setup Run the interactive configuration wizard
|
|
117
|
+
3 Config Open configuration menu
|
|
118
|
+
4 Run Start baileys + websocket services
|
|
119
|
+
5 Media Browse stored media
|
|
120
|
+
0 Exit Exit the application
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### CLI commands
|
|
124
|
+
|
|
125
|
+
All commands are also available directly:
|
|
126
|
+
|
|
127
|
+
| Command | Description |
|
|
128
|
+
|---|---|
|
|
129
|
+
| `python main.py dashboard` | Launch the live dashboard |
|
|
130
|
+
| `python main.py setup` | Run configuration wizard |
|
|
131
|
+
| `python main.py config` | Open configuration menu |
|
|
132
|
+
| `python main.py run` | Start baileys + websocket in separate terminals |
|
|
133
|
+
| `python main.py media` | Browse and download stored media |
|
|
134
|
+
|
|
135
|
+
Or using the module directly:
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
python -m src.cli [command]
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### Run services
|
|
142
|
+
|
|
143
|
+
Opens two new terminal windows:
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
python main.py run
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
- **Terminal 1:** `node src/services/baileys_service.js` (WhatsApp client)
|
|
150
|
+
- **Terminal 2:** `python src/services/websocket_service.py` (Event listener)
|
|
151
|
+
|
|
152
|
+
After starting, scan the QR code in the Node.js terminal with WhatsApp to connect.
|
|
153
|
+
|
|
154
|
+
### Media viewer
|
|
155
|
+
|
|
156
|
+
Browse and download stored media files:
|
|
157
|
+
|
|
158
|
+
```
|
|
159
|
+
Media Viewer
|
|
160
|
+
1 Images
|
|
161
|
+
2 Videos
|
|
162
|
+
3 Documents
|
|
163
|
+
4 All Media
|
|
164
|
+
0 Back
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
Select a media ID to view full details (type, filename, sender, timestamp, sync status) and download the file from S3 or local storage.
|
|
168
|
+
|
|
169
|
+
## Events
|
|
170
|
+
|
|
171
|
+
| Event | Description |
|
|
172
|
+
|---|---|
|
|
173
|
+
| `message.new` | New text message |
|
|
174
|
+
| `message.update` | Message edited |
|
|
175
|
+
| `message.reaction` | Emoji reaction |
|
|
176
|
+
| `status.new` | Status/story update |
|
|
177
|
+
| `conversation.new` | Unified conversation event |
|
|
178
|
+
| `media.new` | Image/video/document received |
|
|
179
|
+
|
|
180
|
+
## Database tables
|
|
181
|
+
|
|
182
|
+
| Table | Contents |
|
|
183
|
+
|---|---|
|
|
184
|
+
| `messages` | Text messages with sender metadata |
|
|
185
|
+
| `message_edits` | Edit history |
|
|
186
|
+
| `statuses` | WhatsApp status updates |
|
|
187
|
+
| `reactions` | Emoji reactions |
|
|
188
|
+
| `media` | Media metadata (type, filename, path, sender) |
|
|
189
|
+
| `media_handshake` | Per-entry sync status (success/failure reason) |
|
|
190
|
+
| `conversations` | Unified conversation log |
|
|
191
|
+
|
|
192
|
+
## Project structure
|
|
193
|
+
|
|
194
|
+
```
|
|
195
|
+
pywacli/
|
|
196
|
+
├── main.py # Entry point
|
|
197
|
+
├── package.json # Node.js dependencies
|
|
198
|
+
├── requirements.txt # Python dependencies
|
|
199
|
+
├── src/
|
|
200
|
+
├── pywacli/
|
|
201
|
+
│ ├── cli/
|
|
202
|
+
│ ├── __init__.py
|
|
203
|
+
│ ├── __main__.py # Typer CLI app & menu
|
|
204
|
+
│ ├── app.py # App orchestrator
|
|
205
|
+
│ ├── config_manager.py # ~/.pywacli/config.json management
|
|
206
|
+
│ ├── configuration.py # Interactive setup wizard
|
|
207
|
+
│ └── ui/
|
|
208
|
+
│ │ ├── dashboard.py # Live Rich dashboard
|
|
209
|
+
│ │ ├── media_viewer.py # Media browser & downloader
|
|
210
|
+
│ │ ├── tables.py # (reserved)
|
|
211
|
+
│ │ └── live_feed.py # (reserved)
|
|
212
|
+
│ ├── db/
|
|
213
|
+
│ │ ├── database.py # SQLite schema & CRUD
|
|
214
|
+
│ │ ├── init_db.py # Table initializer
|
|
215
|
+
│ │ ├── retriver_db.py # Read queries
|
|
216
|
+
│ │ └── bucket_connection.py # S3/R2 connection manager
|
|
217
|
+
│ ├── services/
|
|
218
|
+
│ │ ├── baileys_service.js # WhatsApp Baileys client
|
|
219
|
+
│ │ ├── ws_server.js # WebSocket server
|
|
220
|
+
│ │ ├── session_manager.js # Baileys socket singleton
|
|
221
|
+
│ │ └── websocket_services.py # Python WebSocket consumer
|
|
222
|
+
│ └── utils/
|
|
223
|
+
│ ├── bucket_utils.py # S3 upload/download helpers
|
|
224
|
+
│ └── local_utils.py # Local file storage
|
|
225
|
+
├── .env.example # Environment template
|
|
226
|
+
└── LICENSE # MIT
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
## License
|
|
230
|
+
|
|
231
|
+
MIT
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=69", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "pywacli"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "WhatsApp CLI Tool built with Python and Baileys"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = { file = "LICENSE" }
|
|
12
|
+
|
|
13
|
+
authors = [
|
|
14
|
+
{ name = "Prem Raj" }
|
|
15
|
+
]
|
|
16
|
+
|
|
17
|
+
dependencies = [
|
|
18
|
+
"typer>=0.12",
|
|
19
|
+
"rich",
|
|
20
|
+
"websockets",
|
|
21
|
+
"boto3",
|
|
22
|
+
"python-dotenv",
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
[project.scripts]
|
|
26
|
+
pywacli = "pywacli.cli.__main__:app"
|
|
27
|
+
|
|
28
|
+
[tool.setuptools]
|
|
29
|
+
package-dir = { "" = "src" }
|
|
30
|
+
|
|
31
|
+
[tool.setuptools.packages.find]
|
|
32
|
+
where = ["src"]
|
|
33
|
+
|
|
34
|
+
# Bundle the Node.js service scripts and their manifest inside the wheel so
|
|
35
|
+
# the installed package can locate them via importlib.resources, and so
|
|
36
|
+
# `pywacli init` can run `npm install` against the shipped package.json.
|
|
37
|
+
[tool.setuptools.package-data]
|
|
38
|
+
pywacli = ["services/*.js", "package.json"]
|
pywacli-0.1.0/setup.cfg
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.1.0"
|
|
File without changes
|