whatsapp-pi 1.0.47 → 1.0.49
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/README.md +44 -21
- package/package.json +1 -1
- package/src/i18n.ts +710 -0
- package/src/services/audio.service.ts +4 -3
- package/src/services/baileys-console-filter.ts +7 -5
- package/src/services/incoming-media.service.ts +17 -16
- package/src/services/incoming-message.resolver.ts +46 -25
- package/src/services/message.sender.ts +21 -15
- package/src/services/recents.service.ts +2 -2
- package/src/services/session.manager.ts +85 -30
- package/src/services/whatsapp-pi.logger.ts +6 -2
- package/src/services/whatsapp.service.ts +42 -37
- package/src/ui/menu.handler.ts +253 -118
- package/src/ui/message-detail.view.ts +9 -8
- package/src/ui/message-reply.view.ts +9 -8
- package/whatsapp-pi.ts +33 -18
package/README.md
CHANGED
|
@@ -8,15 +8,18 @@ A WhatsApp integration extension for the **[Pi Coding Agent](https://github.com/
|
|
|
8
8
|
|
|
9
9
|
[](https://github.com/RaphaCastelloes/whatsapp-pi)
|
|
10
10
|
|
|
11
|
-
Pi is a powerful agentic AI coding assistant that operates in your terminal. This extension
|
|
11
|
+
Pi is a powerful agentic AI coding assistant that operates in your terminal. This extension lets you chat and pair-program with your Pi agent through WhatsApp, with message filtering, allowed contacts/groups, recents/history browsing, message detail/reply, group-only binding, and reliable message delivery.
|
|
12
12
|
|
|
13
13
|
## Features
|
|
14
14
|
|
|
15
15
|
- **Manual WhatsApp Connection**: QR code-based authentication with session persistence
|
|
16
|
-
- **
|
|
16
|
+
- **Allowed Contacts**: Control which phone numbers can interact with Pi
|
|
17
17
|
- Add contacts with optional names for easy identification
|
|
18
|
-
- View ignored numbers (not
|
|
19
|
-
- Manage aliases and print allowed
|
|
18
|
+
- View ignored numbers (not yet allowed) and add them when needed
|
|
19
|
+
- Manage aliases and print allowed contacts from the menu
|
|
20
|
+
- **Allowed Groups**: Control which WhatsApp groups can interact with Pi
|
|
21
|
+
- Add group JIDs with optional aliases
|
|
22
|
+
- Only groups in Allowed Groups are processed by the agent
|
|
20
23
|
- **Recents & History**: Browse recent conversations, inspect full message history, and reply from message detail view
|
|
21
24
|
- **Reliable Messaging**: Queue-based message sending with retry logic
|
|
22
25
|
- **TUI Integration**: Menu-driven interface for managing connections, contacts, and recent chats
|
|
@@ -45,18 +48,25 @@ To enable PDF reading capabilities (required for the agent to process documents)
|
|
|
45
48
|
pi install npm:whatsapp-pi
|
|
46
49
|
```
|
|
47
50
|
|
|
48
|
-
2. Start Pi
|
|
51
|
+
2. Start Pi:
|
|
49
52
|
```bash
|
|
50
53
|
pi
|
|
51
54
|
```
|
|
52
55
|
|
|
53
|
-
|
|
56
|
+
3. Open `/whatsapp` and choose **Connect / Reconnect WhatsApp**.
|
|
57
|
+
- QR appears only on first pair or after logoff.
|
|
58
|
+
|
|
59
|
+
4. Add the chat you will use with Pi to **Allowed Contacts** or **Allowed Groups**.
|
|
60
|
+
|
|
61
|
+
5. Send a message from that allowed chat to Pi.
|
|
62
|
+
- Pi replies in same thread.
|
|
63
|
+
- Use **Recents** only to browse history or reply manually.
|
|
64
|
+
|
|
65
|
+
After first pairing, you can start Pi with auto-connect enabled:
|
|
54
66
|
```bash
|
|
55
67
|
pi --whatsapp-pi-online
|
|
56
68
|
```
|
|
57
69
|
|
|
58
|
-
3. Use the menu to connect WhatsApp and manage allowed/blocked numbers
|
|
59
|
-
|
|
60
70
|
## Development / Testing
|
|
61
71
|
|
|
62
72
|
If you are developing or testing the extension locally, you can clone the repository from [GitHub](https://github.com/RaphaCastelloes/whatsapp-pi):
|
|
@@ -83,6 +93,20 @@ To test startup auto-connect locally after you have already paired WhatsApp:
|
|
|
83
93
|
pi -e whatsapp-pi.ts --whatsapp-pi-online
|
|
84
94
|
```
|
|
85
95
|
|
|
96
|
+
## How It Works
|
|
97
|
+
|
|
98
|
+
- Pi processes **incoming** messages only from allowed contacts or allowed groups.
|
|
99
|
+
- **Recents** is history browser, not trigger.
|
|
100
|
+
- **Send Message** and `send_wa_message` are outbound only.
|
|
101
|
+
- If you message yourself, WhatsApp may show sent/read ticks, but that does not guarantee Pi will treat it as a trigger.
|
|
102
|
+
|
|
103
|
+
## WhatsApp Numbers and JIDs
|
|
104
|
+
|
|
105
|
+
- Contacts use phone format in UI: `+5511999999999`
|
|
106
|
+
- Internally, contacts map to JIDs like `5511999999999@s.whatsapp.net`
|
|
107
|
+
- Groups use JIDs like `120363012345@g.us`
|
|
108
|
+
- Recents may show normalized values from WhatsApp, so use **Print Contact** / **Print Group JID** and aliases to avoid confusion.
|
|
109
|
+
|
|
86
110
|
## Commands
|
|
87
111
|
|
|
88
112
|
- `/whatsapp` - Open the WhatsApp management menu
|
|
@@ -92,28 +116,27 @@ pi -e whatsapp-pi.ts --whatsapp-pi-online
|
|
|
92
116
|
- **Disconnect WhatsApp** - Stop WhatsApp connection
|
|
93
117
|
- **Logoff (Delete Session)** - Remove all credentials and session data
|
|
94
118
|
- **Recents** - Open recent conversations, view history, and reply
|
|
95
|
-
- **Allowed
|
|
96
|
-
- **
|
|
119
|
+
- **Allowed Contacts** - Manage contacts that can interact with Pi
|
|
120
|
+
- **Allowed Groups** - Manage WhatsApp groups that can interact with Pi
|
|
121
|
+
|
|
122
|
+
### Allowed Contacts Management
|
|
123
|
+
- **Add Contact** - Add a new contact to the allowed contacts list (format: +5511999999999)
|
|
124
|
+
- **Select a contact** - Open a submenu with **History**, **Send Message**, **Print Contact**, alias actions, **Remove Contact**, and **Back**
|
|
125
|
+
- **Back** - Return to main menu
|
|
97
126
|
|
|
98
|
-
### Allowed
|
|
99
|
-
- **Add
|
|
100
|
-
- **Select a
|
|
127
|
+
### Allowed Groups Management
|
|
128
|
+
- **Add Group** - Add a WhatsApp group JID to the allowed groups list (format: 120363012345@g.us)
|
|
129
|
+
- **Select a group** - Open a submenu with **History**, **Send Message**, **Print Group JID**, alias actions, **Remove Group**, and **Back**
|
|
101
130
|
- **Back** - Return to main menu
|
|
102
131
|
|
|
103
132
|
### Recents Management
|
|
104
133
|
- **History** - Open full message history for that conversation
|
|
105
134
|
- **Send Message** - Send a new message without Pi suffix
|
|
106
135
|
- **Reply** - Open message detail, then press `R` to reply
|
|
107
|
-
- **Allow
|
|
136
|
+
- **Allow Contact / Allow Group** - Move a recent sender into the appropriate allowed list
|
|
108
137
|
- **Remove Alias** - Clear saved alias for that sender
|
|
109
138
|
- **Back** - Return to main menu
|
|
110
139
|
|
|
111
|
-
### Blocked Numbers Management
|
|
112
|
-
- **View List** - See all numbers that have been ignored (not in allow list)
|
|
113
|
-
- **Allow** - Move a blocked number to the allowed list
|
|
114
|
-
- **Delete** - Remove a number from the blocked list
|
|
115
|
-
- **Back** - Return to main menu
|
|
116
|
-
|
|
117
140
|
## Project Structure
|
|
118
141
|
|
|
119
142
|
```
|
|
@@ -138,7 +161,7 @@ npm test
|
|
|
138
161
|
### Recent Feature Updates (2026-05)
|
|
139
162
|
|
|
140
163
|
- **Auto-Connect Support**: Use the `--whatsapp-pi-online` flag to connect on startup when credentials already exist.
|
|
141
|
-
- **Group-Only Mode**: Use `--whatsapp-group <jid>` to bind Pi to a single WhatsApp group.
|
|
164
|
+
- **Group-Only Mode**: Use `--whatsapp-group <jid>` to bind Pi to a single WhatsApp group. The group must also be present in Allowed Groups.
|
|
142
165
|
- **Recents Store**: Recent conversations and message history are persisted in `~/.pi/whatsapp-pi/recents/recents.json`.
|
|
143
166
|
- **Message Detail / Reply**: Open a message from history to inspect full content and reply with `R`.
|
|
144
167
|
- **Media Support**: Images are forwarded for vision analysis, audio is transcribed with Whisper, and documents are saved under `./.pi-data/whatsapp/documents/`.
|