whatsapp-web-cli 0.1.0
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.
- package/LICENSE +21 -0
- package/README.md +178 -0
- package/dist/wwa.js +343016 -0
- package/package.json +50 -0
- package/skills/whatsapp-cli/SKILL.md +112 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026
|
|
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.
|
package/README.md
ADDED
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
# WhatsApp Web CLI
|
|
2
|
+
|
|
3
|
+
`wwa` is a local WhatsApp Web CLI for agents and scripts. It uses `whatsapp-web.js`, persists auth locally, exposes JSON-friendly commands, and keeps realtime state in a local daemon.
|
|
4
|
+
|
|
5
|
+
## Requirements
|
|
6
|
+
|
|
7
|
+
- Node.js 22+
|
|
8
|
+
- Bun 1.3+ for local install/build tasks
|
|
9
|
+
- ffmpeg for `wwa send audio --voice` / `wwa reply audio --voice` conversion when the input is not already OGG/Opus
|
|
10
|
+
- macOS/Linux with a local Chromium/Puppeteer-compatible environment
|
|
11
|
+
- A WhatsApp account that can link WhatsApp Web
|
|
12
|
+
|
|
13
|
+
The package is managed and built with Bun, but the published `wwa` binary runs on Node. This keeps `whatsapp-web.js`/Puppeteer on the runtime they support best.
|
|
14
|
+
|
|
15
|
+
## Install
|
|
16
|
+
|
|
17
|
+
From a published package:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install -g whatsapp-web-cli
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
or:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
bun install -g whatsapp-web-cli
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
From this local folder:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
bun install
|
|
33
|
+
bun run build
|
|
34
|
+
bun link
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Then run the command you actually need:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
wwa chat-search "Name" --json
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
If WhatsApp is not logged in, data commands return a JSON object like:
|
|
44
|
+
|
|
45
|
+
```json
|
|
46
|
+
{
|
|
47
|
+
"ok": false,
|
|
48
|
+
"ready": false,
|
|
49
|
+
"message": "You need to login. Run `wwa auth login --image --json`.",
|
|
50
|
+
"nextCommand": "wwa auth login --image --json"
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Run that login command, render/open the returned `imagePath`, and scan it in
|
|
55
|
+
WhatsApp > Linked Devices. After scanning, run the original command again:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
wwa auth login --image --json
|
|
59
|
+
wwa chat-search "Name" --json
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
There is no required `doctor` or `ready` step in normal usage. Data commands
|
|
63
|
+
auto-start the daemon and wait for readiness after auth is scanned.
|
|
64
|
+
|
|
65
|
+
## Common Flow
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
wwa chat-search "Gardelin" --json
|
|
69
|
+
wwa message-search "Aaah" --chat <chatId> --json
|
|
70
|
+
wwa unread --limit 20 --json
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Common Commands
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
wwa daemon start --json
|
|
77
|
+
wwa daemon stop --json
|
|
78
|
+
wwa daemon status --json
|
|
79
|
+
|
|
80
|
+
wwa auth login --image --json
|
|
81
|
+
wwa auth status --json
|
|
82
|
+
wwa auth logout --json
|
|
83
|
+
|
|
84
|
+
wwa ready --wait 120 --json
|
|
85
|
+
wwa doctor --json
|
|
86
|
+
|
|
87
|
+
wwa chat-search "name or text" --json
|
|
88
|
+
wwa message-search "message text" --limit-chats 20 --messages-per-chat 50 --json
|
|
89
|
+
wwa message-search "message text" --chat <chatId> --json
|
|
90
|
+
|
|
91
|
+
wwa unread --limit 20 --json
|
|
92
|
+
wwa unread messages --limit-chats 10 --messages-per-chat 5 --json
|
|
93
|
+
wwa chats list --unread --limit 20 --json
|
|
94
|
+
|
|
95
|
+
wwa messages list --chat <chatId> --limit 50 --json
|
|
96
|
+
wwa events list --since 24h --json
|
|
97
|
+
wwa events next --chat <chatId> --incoming --timeout 120 --json
|
|
98
|
+
wwa events tail --chat <chatId> --incoming --jsonl
|
|
99
|
+
wwa media save --message <messageId> --json
|
|
100
|
+
wwa transcribe --message <messageId> --json
|
|
101
|
+
wwa transcribe --file ./audio.oga --json
|
|
102
|
+
wwa tts --text "Mensagem em voz natural." --out /tmp/voice.mp3 --json
|
|
103
|
+
wwa tts --text "Mensagem em voz natural." --to <chatId> --json
|
|
104
|
+
wwa send text --to <chatId> --body "..."
|
|
105
|
+
wwa send media --to <chatId> --file ./image.png --caption "..."
|
|
106
|
+
wwa send audio --to <chatId> --file ./note.ogg --voice
|
|
107
|
+
wwa reply text --message <messageId> --body "..."
|
|
108
|
+
wwa reply media --message <messageId> --file ./file.pdf --as-document
|
|
109
|
+
wwa reply audio --message <messageId> --file ./note.ogg --voice
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
`events tail` follows new events from the end of the log by default. Use
|
|
113
|
+
`--replay` only when you intentionally want to replay stored history before
|
|
114
|
+
following new events.
|
|
115
|
+
|
|
116
|
+
`events next` is the best primitive for agents that need to answer live
|
|
117
|
+
messages. It waits for one matching event, prints it, and exits. It also starts
|
|
118
|
+
from the end of the event log by default, so agents do not accidentally answer
|
|
119
|
+
old messages unless `--replay` is explicitly provided.
|
|
120
|
+
|
|
121
|
+
Media commands send existing local files only. Classification and reply drafting
|
|
122
|
+
belong in a higher-level agent workflow.
|
|
123
|
+
When `--voice` is used with an MP3, AIFF, WAV, or other non-OGG audio file,
|
|
124
|
+
`wwa` converts it to OGG/Opus with `ffmpeg` before sending.
|
|
125
|
+
|
|
126
|
+
## OpenAI TTS Workflow
|
|
127
|
+
|
|
128
|
+
For higher-quality voice notes, use `wwa tts` instead of macOS `say`. It calls
|
|
129
|
+
OpenAI text-to-speech with `gpt-4o-mini-tts` and voice `nova`, writes an MP3
|
|
130
|
+
locally, then optionally sends it as a WhatsApp voice note.
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
wwa tts --text "Mensagem em voz natural." --out /tmp/voice.mp3 --voice nova --json
|
|
134
|
+
wwa tts --text "Mensagem em voz natural." --to <chatId> --json
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
The command reads `OPENAI_API_KEY` from `.env.local`, `.env`, or the process
|
|
138
|
+
environment.
|
|
139
|
+
|
|
140
|
+
## OpenAI Transcription Workflow
|
|
141
|
+
|
|
142
|
+
To transcribe WhatsApp audio without hand-normalizing file extensions:
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
wwa transcribe --message <messageId> --json
|
|
146
|
+
wwa transcribe --file ~/.wwa/default/media/audio.oga --json
|
|
147
|
+
wwa transcribe --message <messageId> --to <chatId> --json
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
The command saves media when given a message ID, renames WhatsApp `.oga` voice
|
|
151
|
+
notes to `.ogg` for OpenAI compatibility, and uses `gpt-4o-mini-transcribe` by
|
|
152
|
+
default.
|
|
153
|
+
|
|
154
|
+
## Runtime Data
|
|
155
|
+
|
|
156
|
+
The default profile stores runtime state under:
|
|
157
|
+
|
|
158
|
+
```text
|
|
159
|
+
~/.wwa/default/
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
Auth persists across daemon restarts in:
|
|
163
|
+
|
|
164
|
+
```text
|
|
165
|
+
~/.wwa/default/auth/
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
You should only need to scan a QR again if WhatsApp invalidates the linked device, you run `wwa auth logout`, or the auth folder is removed/corrupted.
|
|
169
|
+
|
|
170
|
+
## Codex Skill
|
|
171
|
+
|
|
172
|
+
The generic skill lives at:
|
|
173
|
+
|
|
174
|
+
```text
|
|
175
|
+
skills/whatsapp-cli/SKILL.md
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
It teaches agents to use the CLI directly, without MCP, and keeps transcription/classification workflows outside the low-level CLI.
|