miaw-core 1.2.5 → 1.6.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/CHANGELOG.md +101 -1
- package/README.md +4 -4
- package/bin/miaw-cli.ts +6 -0
- package/dist/cli/commands/commands-index.d.ts +1 -1
- package/dist/cli/commands/commands-index.d.ts.map +1 -1
- package/dist/cli/commands/commands-index.js +1 -1
- package/dist/cli/commands/commands-index.js.map +1 -1
- package/dist/cli/commands/index.d.ts.map +1 -1
- package/dist/cli/commands/index.js +46 -3
- package/dist/cli/commands/index.js.map +1 -1
- package/dist/cli/commands/send.d.ts +35 -0
- package/dist/cli/commands/send.d.ts.map +1 -1
- package/dist/cli/commands/send.js +83 -0
- package/dist/cli/commands/send.js.map +1 -1
- package/dist/cli/repl.d.ts +1 -0
- package/dist/cli/repl.d.ts.map +1 -1
- package/dist/cli/repl.js +18 -3
- package/dist/cli/repl.js.map +1 -1
- package/dist/cli/utils/session.d.ts +2 -0
- package/dist/cli/utils/session.d.ts.map +1 -1
- package/dist/cli/utils/session.js +1 -0
- package/dist/cli/utils/session.js.map +1 -1
- package/dist/client/MiawClient.d.ts +134 -1
- package/dist/client/MiawClient.d.ts.map +1 -1
- package/dist/client/MiawClient.js +562 -23
- package/dist/client/MiawClient.js.map +1 -1
- package/dist/handlers/MessageHandler.d.ts.map +1 -1
- package/dist/handlers/MessageHandler.js +11 -4
- package/dist/handlers/MessageHandler.js.map +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/types/baileys.d.ts +4 -1
- package/dist/types/baileys.d.ts.map +1 -1
- package/dist/types/baileys.js.map +1 -1
- package/dist/types/index.d.ts +133 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js.map +1 -1
- package/dist/utils/proxy-agent.d.ts +35 -0
- package/dist/utils/proxy-agent.d.ts.map +1 -0
- package/dist/utils/proxy-agent.js +73 -0
- package/dist/utils/proxy-agent.js.map +1 -0
- package/docs/BAILEYS_MIGRATION_v7.md +2 -0
- package/docs/BAILEYS_VS_MIAW_COMPARISON.md +30 -29
- package/docs/CLI.md +7 -0
- package/docs/LID_RESOLUTION.md +60 -6
- package/docs/MIGRATION.md +39 -3
- package/docs/TEST_COVERAGE_ANALYSIS.md +3 -1
- package/docs/USAGE.md +173 -1
- package/package.json +20 -18
- package/sessions-cli/.cli_history +10 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# Baileys vs Miaw Core - Comprehensive Feature Comparison
|
|
2
2
|
|
|
3
|
-
**Last Updated:**
|
|
4
|
-
**Baileys Version:** 7.0.0-
|
|
5
|
-
**Miaw Core Version:** 1.
|
|
3
|
+
**Last Updated:** June 26, 2026
|
|
4
|
+
**Baileys Version:** 7.0.0-rc13
|
|
5
|
+
**Miaw Core Version:** 1.6.0
|
|
6
6
|
|
|
7
7
|
## Overview
|
|
8
8
|
|
|
@@ -42,7 +42,7 @@ This document provides a comprehensive comparison between [Baileys](https://gith
|
|
|
42
42
|
| Feature | Baileys | Miaw Core | Notes |
|
|
43
43
|
| ---------------------------------------- | ------- | --------- | ------------------------------------- |
|
|
44
44
|
| **QR Code Authentication** | ✅ | ✅ | Miaw emits `qr` event |
|
|
45
|
-
| **Pairing Code (Phone Number)** | ✅ |
|
|
45
|
+
| **Pairing Code (Phone Number)** | ✅ | ✅ | `usePairingCode` + `phoneNumber` (v1.6.0) |
|
|
46
46
|
| **Session Persistence (Multi-file)** | ✅ | ✅ | `AuthHandler` manages automatically |
|
|
47
47
|
| **Session Persistence (Single-file)** | ✅ | ❌ | Multi-file only in Miaw |
|
|
48
48
|
| **Session Persistence (External Store)** | ✅ | ❌ | Redis, MongoDB, etc. |
|
|
@@ -53,7 +53,7 @@ This document provides a comprehensive comparison between [Baileys](https://gith
|
|
|
53
53
|
| **Multiple Instances** | ✅ | ✅ | Full support in both |
|
|
54
54
|
| **Browser Config** | ✅ | 🔶 | Fixed browser config in Miaw |
|
|
55
55
|
| **Custom Logger** | ✅ | ✅ | Pino-based in both |
|
|
56
|
-
| **Proxy Support** | ✅ |
|
|
56
|
+
| **Proxy Support** | ✅ | ✅ | HTTP/SOCKS via `proxyUrl` config (v1.3.0) |
|
|
57
57
|
| **WebSocket Options** | ✅ | ❌ | Custom WS configuration |
|
|
58
58
|
|
|
59
59
|
---
|
|
@@ -66,7 +66,7 @@ This document provides a comprehensive comparison between [Baileys](https://gith
|
|
|
66
66
|
| -------------------------- | ------- | --------- | -------------------------------------- |
|
|
67
67
|
| **Send Text** | ✅ | ✅ | `sendText()` |
|
|
68
68
|
| **Send with Quote/Reply** | ✅ | ✅ | `options.quoted` |
|
|
69
|
-
| **Send with Mentions** | ✅ |
|
|
69
|
+
| **Send with Mentions** | ✅ | ✅ | `mentions` option (v1.6.0) |
|
|
70
70
|
| **Send with Link Preview** | ✅ | 🔶 | Auto-generated in Baileys |
|
|
71
71
|
| **Send Extended Text** | ✅ | ❌ | Bold, italic, strikethrough, monospace |
|
|
72
72
|
|
|
@@ -80,7 +80,7 @@ This document provides a comprehensive comparison between [Baileys](https://gith
|
|
|
80
80
|
| **Send Voice Note (PTT)** | ✅ | ✅ | `options.ptt: true` |
|
|
81
81
|
| **Send Video Note (PTV)** | ✅ | ✅ | `options.ptv: true` |
|
|
82
82
|
| **Send Document** | ✅ | ✅ | `sendDocument()` |
|
|
83
|
-
| **Send Sticker** | ✅ |
|
|
83
|
+
| **Send Sticker** | ✅ | ✅ | `sendSticker()` (v1.6.0) |
|
|
84
84
|
| **Send GIF** | ✅ | ✅ | `options.gifPlayback: true` |
|
|
85
85
|
| **View Once (Image/Video)** | ✅ | ✅ | `options.viewOnce: true` |
|
|
86
86
|
| **Media from URL** | ✅ | ✅ | Pass URL string |
|
|
@@ -92,11 +92,11 @@ This document provides a comprehensive comparison between [Baileys](https://gith
|
|
|
92
92
|
|
|
93
93
|
| Feature | Baileys | Miaw Core | Notes |
|
|
94
94
|
| -------------------------- | ------- | --------- | -------------------------------------- |
|
|
95
|
-
| **Send Location** | ✅ |
|
|
95
|
+
| **Send Location** | ✅ | ✅ | `sendLocation()` (v1.6.0) |
|
|
96
96
|
| **Send Live Location** | ✅ | ❌ | Live location sharing |
|
|
97
|
-
| **Send Contact (vCard)** | ✅ |
|
|
98
|
-
| **Send Multiple Contacts** | ✅ |
|
|
99
|
-
| **Send Poll** | ✅ |
|
|
97
|
+
| **Send Contact (vCard)** | ✅ | ✅ | `sendContact()` (v1.6.0) |
|
|
98
|
+
| **Send Multiple Contacts** | ✅ | ✅ | `sendContact()` array (v1.6.0) |
|
|
99
|
+
| **Send Poll** | ✅ | ✅ | `sendPoll()` (v1.6.0) |
|
|
100
100
|
| **Send Product** | ✅ | ❌ | Product message |
|
|
101
101
|
| **Send Event** | ✅ | ❌ | Event/calendar messages |
|
|
102
102
|
| **Send Group Invite** | ✅ | ❌ | Group invite message |
|
|
@@ -130,7 +130,7 @@ This document provides a comprehensive comparison between [Baileys](https://gith
|
|
|
130
130
|
| **Message Delete Event** | ✅ | ✅ | `message_delete` event |
|
|
131
131
|
| **Message Reaction Event** | ✅ | ✅ | `message_reaction` event |
|
|
132
132
|
| **History Sync** | ✅ | 🔶 | Chats/contacts synced to stores |
|
|
133
|
-
| **Poll Updates** | ✅ |
|
|
133
|
+
| **Poll Updates** | ✅ | ✅ | `poll_vote` event (v1.6.0) |
|
|
134
134
|
| **Receipt Events** | ✅ | ❌ | Delivery/read receipts |
|
|
135
135
|
| **Call Events** | ✅ | ❌ | Incoming/outgoing calls |
|
|
136
136
|
| **Label Association Events** | ✅ | ❌ | Label add/remove events |
|
|
@@ -183,7 +183,7 @@ This document provides a comprehensive comparison between [Baileys](https://gith
|
|
|
183
183
|
| **Delete Chat** | ✅ | ❌ | Delete entire chat |
|
|
184
184
|
| **Clear Chat** | ✅ | ❌ | Clear all messages |
|
|
185
185
|
| **Disappearing Messages** | ✅ | ❌ | Set ephemeral timer |
|
|
186
|
-
| **Fetch Message History** | ✅ |
|
|
186
|
+
| **Fetch Message History** | ✅ | ✅ | `loadMoreMessages()` |
|
|
187
187
|
| **Chat Modify** | ✅ | 🔶 | Used internally |
|
|
188
188
|
|
|
189
189
|
---
|
|
@@ -393,7 +393,7 @@ This document provides a comprehensive comparison between [Baileys](https://gith
|
|
|
393
393
|
| --------------------------------- | ------- | --------- | ----------------------------------- |
|
|
394
394
|
| **JID Encoding/Decoding** | ✅ | 🔶 | `MessageHandler.formatPhoneToJid()` |
|
|
395
395
|
| **Check JID Type** | ✅ | 🔶 | Group/user/newsletter/etc. |
|
|
396
|
-
| **LID to JID Resolution** | ✅ | ✅ | `resolveLidToJid()`
|
|
396
|
+
| **LID to JID Resolution** | ✅ | ✅ | `resolveLidToJid()` + async/bulk/reverse via native store (v1.5.0) |
|
|
397
397
|
| **Get Phone from JID** | ✅ | ✅ | `getPhoneFromJid()` |
|
|
398
398
|
| **Generate Message ID** | ✅ | ❌ | Custom message IDs |
|
|
399
399
|
| **Download Content from Message** | ✅ | ✅ | `downloadMedia()` |
|
|
@@ -421,11 +421,11 @@ This document provides a comprehensive comparison between [Baileys](https://gith
|
|
|
421
421
|
|
|
422
422
|
| Category | Baileys Features | Miaw Core Implemented | Coverage |
|
|
423
423
|
| ------------------------- | ---------------- | --------------------- | -------- |
|
|
424
|
-
| **Connection & Auth** | 14 |
|
|
425
|
-
| **Sending Messages** | 33 |
|
|
426
|
-
| **Receiving & Events** | 17 |
|
|
424
|
+
| **Connection & Auth** | 14 | 12 | 86% |
|
|
425
|
+
| **Sending Messages** | 33 | 25 | 76% |
|
|
426
|
+
| **Receiving & Events** | 17 | 13 | 76% |
|
|
427
427
|
| **Media** | 4 | 2 | 50% |
|
|
428
|
-
| **Chat Management** | 11 |
|
|
428
|
+
| **Chat Management** | 11 | 6 | 55% |
|
|
429
429
|
| **User & Contacts** | 10 | 8 | 80% |
|
|
430
430
|
| **Profile Management** | 5 | 5 | 100% |
|
|
431
431
|
| **Group Management** | 18 | 14 | 78% |
|
|
@@ -439,7 +439,7 @@ This document provides a comprehensive comparison between [Baileys](https://gith
|
|
|
439
439
|
| **Calls** | 5 | 0 | 0% |
|
|
440
440
|
| **Utilities** | 7 | 4 | 57% |
|
|
441
441
|
| **Low-Level** | 6 | 0 | 0% |
|
|
442
|
-
| **TOTAL** | ~175 | ~
|
|
442
|
+
| **TOTAL** | ~175 | ~120 | ~69% |
|
|
443
443
|
|
|
444
444
|
### What Miaw Core Focuses On
|
|
445
445
|
|
|
@@ -455,16 +455,17 @@ Miaw Core prioritizes the features that **90% of WhatsApp bots actually need**:
|
|
|
455
455
|
|
|
456
456
|
### What Miaw Core Doesn't Implement (Yet)
|
|
457
457
|
|
|
458
|
-
These are
|
|
458
|
+
These are all backed by methods that exist in Baileys 7.0.0-rc13 and can be wrapped. Ordered by the prioritized backlog (see **[ROADMAP.md → Not-Yet-Implemented Baileys Features](./ROADMAP.md)**):
|
|
459
459
|
|
|
460
|
-
1. ❌ **
|
|
461
|
-
2. ❌ **
|
|
462
|
-
3. ❌ **
|
|
463
|
-
4. ❌ **
|
|
464
|
-
5. ❌ **
|
|
465
|
-
6. ❌ **
|
|
466
|
-
7. ❌ **
|
|
467
|
-
8. ❌ **
|
|
460
|
+
1. ❌ **Chat Management** _(priority)_ - archive, pin, mute, clear, delete chat, star/unstar messages (`chatModify`)
|
|
461
|
+
2. ❌ **Rich Messages** _(priority)_ - location, contact/vCard, poll (+ vote decoding), sticker, group-invite, pin-in-chat, `@mentions`
|
|
462
|
+
3. ❌ **Privacy & Blocklist** - block/unblock, get blocklist, 10 privacy setters (`fetchBlocklist`, `updateBlockStatus`, `update*Privacy`)
|
|
463
|
+
4. ❌ **Group Admin & Disappearing** - announce/restrict, join-approval, member-add mode, ephemeral (`groupSettingUpdate`, `groupRequest*`, `groupToggleEphemeral`)
|
|
464
|
+
5. ❌ **Calls** - reject call, call events, call links (`rejectCall`, `createCallLink`)
|
|
465
|
+
6. ❌ **Business Extras** - update business profile, cover photo, order details, quick replies
|
|
466
|
+
7. ❌ **Status/Stories** - post to `status@broadcast`
|
|
467
|
+
8. ❌ **Communities** - full `community*` layer (largest surface)
|
|
468
|
+
9. 🔶 **Interactive Messages** - buttons/lists/templates deprecated by WhatsApp (low value)
|
|
468
469
|
|
|
469
470
|
---
|
|
470
471
|
|
|
@@ -519,4 +520,4 @@ These are deliberately excluded or planned for future:
|
|
|
519
520
|
|
|
520
521
|
---
|
|
521
522
|
|
|
522
|
-
_This analysis was
|
|
523
|
+
_This analysis was last updated on June 27, 2026, based on Baileys v7.0.0-rc13 and Miaw Core v1.6.0._
|
package/docs/CLI.md
CHANGED
|
@@ -91,6 +91,7 @@ These flags work with any command:
|
|
|
91
91
|
|------|-------------|---------|
|
|
92
92
|
| `--instance-id <id>` | Specify instance ID | `default` |
|
|
93
93
|
| `--session-path <path>` | Session directory path | `./sessions-cli` |
|
|
94
|
+
| `--proxy <url>` | Proxy URL (http, https, socks4, socks5) | - |
|
|
94
95
|
| `--json` | Output as JSON instead of tables | - |
|
|
95
96
|
| `--debug` | Enable verbose logging | - |
|
|
96
97
|
| `--help` | Show help message | - |
|
|
@@ -104,6 +105,12 @@ npx miaw-cli --instance-id my-bot get profile
|
|
|
104
105
|
# Custom session path
|
|
105
106
|
npx miaw-cli --session-path ./my-sessions get contacts
|
|
106
107
|
|
|
108
|
+
# Connect through a SOCKS5 proxy
|
|
109
|
+
npx miaw-cli --proxy socks5://proxy.example.com:1080 get groups
|
|
110
|
+
|
|
111
|
+
# Connect through an HTTP proxy with auth
|
|
112
|
+
npx miaw-cli --proxy http://user:pass@proxy.example.com:8080 send text 6281234567890 "Hello"
|
|
113
|
+
|
|
107
114
|
# JSON output
|
|
108
115
|
npx miaw-cli get groups --json
|
|
109
116
|
|
package/docs/LID_RESOLUTION.md
CHANGED
|
@@ -39,6 +39,34 @@ const phone = client.getPhoneFromJid("42877077966917@lid");
|
|
|
39
39
|
client.registerLidMapping("42877077966917@lid", "6281234567890@s.whatsapp.net");
|
|
40
40
|
```
|
|
41
41
|
|
|
42
|
+
#### Native-store resolution (Baileys rc13, v1.5.0+)
|
|
43
|
+
|
|
44
|
+
The synchronous methods above are **cache-only**. For misses, these async
|
|
45
|
+
methods additionally consult Baileys' native LID store
|
|
46
|
+
(`signalRepository.lidMapping`), which can perform a server/USync-backed lookup
|
|
47
|
+
and **back-fills** our cache on success. They require an active connection.
|
|
48
|
+
|
|
49
|
+
```typescript
|
|
50
|
+
// Async resolve — cache first, then the native store on a miss
|
|
51
|
+
const jid = await client.resolveLidToJidAsync("42877077966917@lid");
|
|
52
|
+
const phone = await client.getPhoneFromJidAsync("42877077966917@lid");
|
|
53
|
+
|
|
54
|
+
// Bulk: cache hits served locally; misses sent in ONE native query
|
|
55
|
+
const map = await client.resolveLidsToPhones([
|
|
56
|
+
"42877077966917@lid",
|
|
57
|
+
"11111111111111@lid",
|
|
58
|
+
]);
|
|
59
|
+
// => { "42877077966917@lid": "6281234567890", "11111111111111@lid": null }
|
|
60
|
+
|
|
61
|
+
// Reverse: phone number -> LID (also seeds the local cache)
|
|
62
|
+
const lid = await client.getLidForPhone("6281234567890");
|
|
63
|
+
// => "42877077966917@lid" or null
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
> Inbound messages already use this fallback automatically: if a sender's
|
|
67
|
+
> `@lid` is not yet cached, the native store is consulted while resolving
|
|
68
|
+
> `senderPhone`.
|
|
69
|
+
|
|
42
70
|
## Sources of LID Mappings
|
|
43
71
|
|
|
44
72
|
The LID cache is populated from multiple sources:
|
|
@@ -52,7 +80,25 @@ The LID cache is populated from multiple sources:
|
|
|
52
80
|
| `contacts.update` | Contact updates with LID changes |
|
|
53
81
|
| `chats.upsert` | New chats with LID information |
|
|
54
82
|
| `chats.update` | Chat updates with LID changes |
|
|
55
|
-
| `messages.upsert` | Message sender LID mappings |
|
|
83
|
+
| `messages.upsert` | Message sender LID mappings (from the rc13 key alt fields — see below) |
|
|
84
|
+
|
|
85
|
+
#### Baileys rc13 key/field changes
|
|
86
|
+
|
|
87
|
+
Baileys v7 (rc10+) reworked how the phone (PN) and LID identifiers are carried.
|
|
88
|
+
miaw-core reads the modern fields and falls back to the legacy ones for older
|
|
89
|
+
session data:
|
|
90
|
+
|
|
91
|
+
| Source object | Phone (PN) field | LID field |
|
|
92
|
+
|---------------|------------------|-----------|
|
|
93
|
+
| `Contact` | `phoneNumber` (replaces the removed `jid`) | `lid` |
|
|
94
|
+
| `Chat` (`proto.IConversation`) | `pnJid` | `lidJid` |
|
|
95
|
+
| Message `key` | `remoteJidAlt` (DMs) / `participantAlt` (groups), with `addressingMode` = `lid`\|`pn` | `remoteJid` / `participant` when those are `@lid` |
|
|
96
|
+
|
|
97
|
+
For each inbound message, whichever side of the (`remoteJid`, `remoteJidAlt`) and
|
|
98
|
+
(`participant`, `participantAlt`) pairs is a `@lid` is mapped to the `@s.whatsapp.net`
|
|
99
|
+
side, so `senderPhone` resolves even for privacy-masked senders. The legacy
|
|
100
|
+
`senderPn` / `participantPn` / `senderLid` key fields are no longer set by Baileys
|
|
101
|
+
and are kept only as a fallback.
|
|
56
102
|
|
|
57
103
|
### 2. Persisted Storage
|
|
58
104
|
|
|
@@ -203,12 +249,18 @@ client.on("message", (message) => {
|
|
|
203
249
|
|
|
204
250
|
## Future Improvements
|
|
205
251
|
|
|
206
|
-
|
|
252
|
+
**Implemented in v1.5.0** — miaw-core now adopts Baileys 7.0.0-rc13's native LID infrastructure:
|
|
253
|
+
|
|
254
|
+
- ✅ **Native LID store** — `resolveLidToJidAsync()` / `getPhoneFromJidAsync()` fall back to `signalRepository.lidMapping.getPNForLID()` (server/USync-backed) on cache misses, back-filling the local cache. The inbound message path uses this automatically for `senderPhone`.
|
|
255
|
+
- ✅ **`lidPnMappings` ingestion** — the dedicated LID↔PN array on `messaging-history.set` is consumed during history sync.
|
|
256
|
+
- ✅ **Bulk + reverse resolution** — `resolveLidsToPhones([...])` (via `getPNsForLIDs`) and `getLidForPhone()` (via `getLIDForPN`).
|
|
257
|
+
|
|
258
|
+
> `signalRepository.migrateSession(pn → lid)` is **not** wrapped: Baileys already calls it internally (`enableAutoSessionRecreation` defaults to `true`), so a manual wrapper would be redundant.
|
|
259
|
+
|
|
260
|
+
Potential further enhancements:
|
|
207
261
|
|
|
208
|
-
1. **
|
|
209
|
-
2. **
|
|
210
|
-
3. **User notification**: Alert users when important contacts have unresolved LIDs
|
|
211
|
-
4. **Bulk resolution**: API to resolve multiple LIDs in a single call
|
|
262
|
+
1. **User notification**: Alert users when important contacts have unresolved LIDs
|
|
263
|
+
2. **Proactive seeding**: Resolve all unresolved store LIDs via the native store on connect
|
|
212
264
|
|
|
213
265
|
## Related Files
|
|
214
266
|
|
|
@@ -224,3 +276,5 @@ Potential enhancements to LID resolution:
|
|
|
224
276
|
| v1.1.0 | Added LID persistence to file |
|
|
225
277
|
| v1.1.1 | Fixed CLI group participants LID display |
|
|
226
278
|
| v1.1.2 | Fixed `getContactProfile()` LID resolution |
|
|
279
|
+
| v1.4.1 | Baileys 7.0.0-rc13: read `Contact.phoneNumber` / `Chat.pnJid` and message-key `remoteJidAlt` / `participantAlt` (rc10 removed `Contact.jid`; rc13 no longer sets `senderPn` / `senderLid`) |
|
|
280
|
+
| v1.5.0 | Adopt the rc13 native LID store: async/bulk/reverse resolvers (`resolveLidToJidAsync`, `getPhoneFromJidAsync`, `resolveLidsToPhones`, `getLidForPhone`) + `lidPnMappings` history ingestion |
|
package/docs/MIGRATION.md
CHANGED
|
@@ -4,6 +4,7 @@ This guide helps you migrate between versions of Miaw Core.
|
|
|
4
4
|
|
|
5
5
|
## Table of Contents
|
|
6
6
|
|
|
7
|
+
- [v1.4.0 to v1.4.1](#v140-to-v141)
|
|
7
8
|
- [v1.1.x to v1.2.0](#v11x-to-v120)
|
|
8
9
|
- [v1.0.x to v1.1.0](#v10x-to-v110)
|
|
9
10
|
- [v0.9.x to v1.0.0](#v09x-to-v100)
|
|
@@ -13,6 +14,40 @@ This guide helps you migrate between versions of Miaw Core.
|
|
|
13
14
|
|
|
14
15
|
---
|
|
15
16
|
|
|
17
|
+
## v1.4.0 to v1.4.1
|
|
18
|
+
|
|
19
|
+
**Status:** Released — 2026-06-26
|
|
20
|
+
**Breaking Changes:** None ✅
|
|
21
|
+
|
|
22
|
+
v1.4.1 upgrades the Baileys dependency from `7.0.0-rc.9` to `7.0.0-rc13` (the latest
|
|
23
|
+
release). It is a drop-in upgrade — no application code changes are required.
|
|
24
|
+
|
|
25
|
+
### What changed
|
|
26
|
+
|
|
27
|
+
- **Baileys `7.0.0-rc.9` → `7.0.0-rc13`** (pinned exactly). Brings security fixes
|
|
28
|
+
(GHSA-qvv5-jq5g-4cgg, a protocolMessage parse-regression fix), performance and
|
|
29
|
+
stability work, and libsignal published to the npm registry.
|
|
30
|
+
- **LID → phone resolution updated for the rc10+ field changes.** Baileys rc10
|
|
31
|
+
removed `Contact.jid` (now `Contact.phoneNumber`) and rc13 stopped setting
|
|
32
|
+
`senderPn` / `participantPn` / `senderLid` on message keys (now `remoteJidAlt` /
|
|
33
|
+
`participantAlt` + `addressingMode`). miaw-core reads the modern fields, so
|
|
34
|
+
`senderPhone` keeps resolving for privacy-masked (`@lid`) senders. See
|
|
35
|
+
[LID_RESOLUTION.md](./LID_RESOLUTION.md).
|
|
36
|
+
|
|
37
|
+
### Do I need to change anything?
|
|
38
|
+
|
|
39
|
+
No. The public API is unchanged, and persisted `lid-mappings.json` files remain
|
|
40
|
+
compatible.
|
|
41
|
+
|
|
42
|
+
### Known issue
|
|
43
|
+
|
|
44
|
+
- Newsletter **creation** may return `success` with an empty `newsletterId` on rc13:
|
|
45
|
+
Baileys currently fails to parse the create response (`invalid mex newsletter
|
|
46
|
+
notification content`) even though the newsletter is created server-side. Tracked
|
|
47
|
+
upstream.
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
16
51
|
## v1.1.x to v1.2.0
|
|
17
52
|
|
|
18
53
|
**Status:** Code Quality Release (TBD)
|
|
@@ -466,9 +501,10 @@ If you encounter issues during migration:
|
|
|
466
501
|
|
|
467
502
|
## Version Compatibility
|
|
468
503
|
|
|
469
|
-
| Miaw Core | Node.js | Baileys
|
|
470
|
-
| --------- | -------- |
|
|
471
|
-
| 1.
|
|
504
|
+
| Miaw Core | Node.js | Baileys | Status |
|
|
505
|
+
| --------- | -------- | ---------- | -------------------- |
|
|
506
|
+
| 1.4.1 | >=18.0.0 | 7.0.0-rc13 | Stable |
|
|
507
|
+
| 1.0.0 | >=18.0.0 | 6.7.21+ | Stable (Coming Soon) |
|
|
472
508
|
| 0.9.x | >=18.0.0 | 6.7.21+ | Stable |
|
|
473
509
|
| 0.8.x | >=18.0.0 | 6.7.21+ | Stable |
|
|
474
510
|
| 0.7.x | >=18.0.0 | 6.7.21+ | Stable |
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
# MiawClient Test Coverage Analysis
|
|
2
2
|
|
|
3
|
-
**Generated:** January 2, 2026
|
|
3
|
+
**Generated:** January 2, 2026 · **Last reviewed:** June 26, 2026 (Baileys 7.0.0-rc13, miaw-core v1.4.1)
|
|
4
4
|
**Source Files Analyzed:**
|
|
5
5
|
|
|
6
6
|
- `src/client/MiawClient.ts` - Main client implementation
|
|
7
7
|
- `tests/interactive-test.ts` - Interactive manual test suite
|
|
8
8
|
|
|
9
|
+
> **Note:** The figures below reflect the 92-method API surface as of v1.4.1. The not-yet-implemented Baileys features tracked in [ROADMAP.md → Not-Yet-Implemented Baileys Features](./ROADMAP.md#not-yet-implemented-baileys-features-prioritized) (chat management, rich messages, privacy/blocklist, etc.) are **not** counted here and will need coverage as they land. A full regeneration of this table is out of scope for the rc13 docs refresh.
|
|
10
|
+
|
|
9
11
|
## Summary
|
|
10
12
|
|
|
11
13
|
| Category | Total Methods | Covered | Coverage |
|
package/docs/USAGE.md
CHANGED
|
@@ -26,6 +26,7 @@ This document covers all current capabilities of Miaw Core. It will be updated a
|
|
|
26
26
|
- [Receiving Messages](#receiving-messages)
|
|
27
27
|
- [Connection Management](#connection-management)
|
|
28
28
|
- [Multiple Instances](#multiple-instances)
|
|
29
|
+
- [Proxy Support](#proxy-support)
|
|
29
30
|
- [Session Management](#session-management)
|
|
30
31
|
- [Event Reference](#event-reference)
|
|
31
32
|
- [Error Handling](#error-handling)
|
|
@@ -93,6 +94,10 @@ const client = new MiawClient({
|
|
|
93
94
|
maxReconnectAttempts: 10, // Default: Infinity
|
|
94
95
|
reconnectDelay: 5000, // Default: 3000 (ms)
|
|
95
96
|
|
|
97
|
+
// Proxy configuration (v1.3.0+)
|
|
98
|
+
proxy: "socks5://proxy.example.com:1080", // Proxy URL string
|
|
99
|
+
// or: proxy: { url: "http://proxy:8080", username: "user", password: "pass" }
|
|
100
|
+
|
|
96
101
|
// Advanced timeout configurations
|
|
97
102
|
stuckStateTimeout: 30000, // Default: 30000 (ms)
|
|
98
103
|
qrGracePeriod: 30000, // Default: 30000 (ms)
|
|
@@ -115,6 +120,9 @@ const client = new MiawClient({
|
|
|
115
120
|
| `qrGracePeriod` | `number` | `30000` | QR code grace period |
|
|
116
121
|
| `qrScanTimeout` | `number` | `60000` | QR code scan timeout |
|
|
117
122
|
| `connectionTimeout` | `number` | `120000` | Connection establishment timeout |
|
|
123
|
+
| `proxy` | `string \| ProxyConfig` | _none_ | Proxy URL or config object (see [Proxy Support](#proxy-support)) |
|
|
124
|
+
| `agent` | `Agent` | _none_ | Custom WebSocket agent (advanced, overrides proxy) |
|
|
125
|
+
| `fetchAgent` | `unknown` | _none_ | Custom fetch dispatcher (advanced, overrides proxy) |
|
|
118
126
|
|
|
119
127
|
## Authentication
|
|
120
128
|
|
|
@@ -133,6 +141,26 @@ client.on("qr", (qr) => {
|
|
|
133
141
|
});
|
|
134
142
|
```
|
|
135
143
|
|
|
144
|
+
### Pairing Code Authentication (v1.6.0)
|
|
145
|
+
|
|
146
|
+
Connect by entering an 8-character code in WhatsApp (Linked Devices → Link with
|
|
147
|
+
phone number) instead of scanning a QR — ideal for headless/server deploys. QR
|
|
148
|
+
emission is suppressed in this mode.
|
|
149
|
+
|
|
150
|
+
```typescript
|
|
151
|
+
const client = new MiawClient({
|
|
152
|
+
instanceId: "bot1",
|
|
153
|
+
usePairingCode: true,
|
|
154
|
+
phoneNumber: "6281234567890", // international format, no '+'
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
client.on("pairing_code", (code) => {
|
|
158
|
+
console.log("Enter this code in WhatsApp:", code); // e.g. "ABCD1234"
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
await client.connect();
|
|
162
|
+
```
|
|
163
|
+
|
|
136
164
|
### Session Persistence
|
|
137
165
|
|
|
138
166
|
After first authentication, the session is automatically saved and reused:
|
|
@@ -226,6 +254,46 @@ client.on("message", async (msg) => {
|
|
|
226
254
|
});
|
|
227
255
|
```
|
|
228
256
|
|
|
257
|
+
### Mentions (groups)
|
|
258
|
+
|
|
259
|
+
```typescript
|
|
260
|
+
// @mention members in a group (also reference them as @<number> in the text)
|
|
261
|
+
await client.sendText(groupJid, "Hi @6281234567890!", {
|
|
262
|
+
mentions: ["6281234567890"],
|
|
263
|
+
});
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
### Rich Message Types (v1.6.0)
|
|
267
|
+
|
|
268
|
+
```typescript
|
|
269
|
+
// Location
|
|
270
|
+
await client.sendLocation("6281234567890", -6.2, 106.8, {
|
|
271
|
+
name: "Jakarta",
|
|
272
|
+
address: "Indonesia",
|
|
273
|
+
});
|
|
274
|
+
|
|
275
|
+
// Contact card(s) — pass one object or an array
|
|
276
|
+
await client.sendContact("6281234567890", {
|
|
277
|
+
fullName: "John Doe",
|
|
278
|
+
phone: "6285555555555",
|
|
279
|
+
organization: "Acme Inc",
|
|
280
|
+
});
|
|
281
|
+
|
|
282
|
+
// Sticker (WebP — file path, URL, or Buffer)
|
|
283
|
+
await client.sendSticker("6281234567890", "./sticker.webp");
|
|
284
|
+
|
|
285
|
+
// Poll (>= 2 options; selectableCount defaults to 1)
|
|
286
|
+
await client.sendPoll("6281234567890", "Lunch?", ["Pizza", "Sushi"], {
|
|
287
|
+
selectableCount: 1,
|
|
288
|
+
});
|
|
289
|
+
|
|
290
|
+
// Read poll votes (aggregated tally)
|
|
291
|
+
client.on("poll_vote", (vote) => {
|
|
292
|
+
console.log(vote.pollMessageId, vote.results);
|
|
293
|
+
// results: [{ option: "Pizza", voters: ["...@s.whatsapp.net"] }, ...]
|
|
294
|
+
});
|
|
295
|
+
```
|
|
296
|
+
|
|
229
297
|
## Media Messages
|
|
230
298
|
|
|
231
299
|
### Send Image
|
|
@@ -1232,6 +1300,98 @@ bot1.on("message", (msg) => console.log("Bot 1:", msg.text));
|
|
|
1232
1300
|
bot2.on("message", (msg) => console.log("Bot 2:", msg.text));
|
|
1233
1301
|
```
|
|
1234
1302
|
|
|
1303
|
+
## Proxy Support
|
|
1304
|
+
|
|
1305
|
+
_Added in v1.3.0_
|
|
1306
|
+
|
|
1307
|
+
Each MiawClient instance can connect through a proxy for IP rotation, geographic distribution, or privacy. Supports HTTP, HTTPS, SOCKS4, and SOCKS5 proxies.
|
|
1308
|
+
|
|
1309
|
+
### Basic Proxy Usage
|
|
1310
|
+
|
|
1311
|
+
```typescript
|
|
1312
|
+
import { MiawClient } from "miaw-core";
|
|
1313
|
+
|
|
1314
|
+
// Using a proxy URL string
|
|
1315
|
+
const client = new MiawClient({
|
|
1316
|
+
instanceId: "bot-1",
|
|
1317
|
+
proxy: "socks5://proxy.example.com:1080",
|
|
1318
|
+
});
|
|
1319
|
+
|
|
1320
|
+
// Using a ProxyConfig object (with separate auth)
|
|
1321
|
+
const client2 = new MiawClient({
|
|
1322
|
+
instanceId: "bot-2",
|
|
1323
|
+
proxy: {
|
|
1324
|
+
url: "http://proxy.example.com:8080",
|
|
1325
|
+
username: "user",
|
|
1326
|
+
password: "pass",
|
|
1327
|
+
},
|
|
1328
|
+
});
|
|
1329
|
+
|
|
1330
|
+
await client.connect(); // Connects through the proxy
|
|
1331
|
+
```
|
|
1332
|
+
|
|
1333
|
+
### Proxy Info
|
|
1334
|
+
|
|
1335
|
+
```typescript
|
|
1336
|
+
// Get current proxy info (credentials masked)
|
|
1337
|
+
const info = client.getProxyInfo();
|
|
1338
|
+
// { url: "socks5://proxy.example.com:1080/", protocol: "socks5" }
|
|
1339
|
+
```
|
|
1340
|
+
|
|
1341
|
+
### Multiple Instances with Different Proxies
|
|
1342
|
+
|
|
1343
|
+
```typescript
|
|
1344
|
+
const instances = [
|
|
1345
|
+
{ id: "us-bot", proxy: "socks5://us-proxy.example.com:1080" },
|
|
1346
|
+
{ id: "eu-bot", proxy: "socks5://eu-proxy.example.com:1080" },
|
|
1347
|
+
{ id: "asia-bot", proxy: "http://asia-proxy.example.com:8080" },
|
|
1348
|
+
];
|
|
1349
|
+
|
|
1350
|
+
for (const { id, proxy } of instances) {
|
|
1351
|
+
const client = new MiawClient({
|
|
1352
|
+
instanceId: id,
|
|
1353
|
+
sessionPath: "./sessions",
|
|
1354
|
+
proxy,
|
|
1355
|
+
});
|
|
1356
|
+
await client.connect();
|
|
1357
|
+
}
|
|
1358
|
+
```
|
|
1359
|
+
|
|
1360
|
+
### Custom Agent (Advanced)
|
|
1361
|
+
|
|
1362
|
+
For advanced use cases, you can pass your own agents directly instead of a proxy URL:
|
|
1363
|
+
|
|
1364
|
+
```typescript
|
|
1365
|
+
import { HttpsProxyAgent } from "https-proxy-agent";
|
|
1366
|
+
|
|
1367
|
+
const client = new MiawClient({
|
|
1368
|
+
instanceId: "advanced-bot",
|
|
1369
|
+
agent: new HttpsProxyAgent("http://proxy:8080"), // WebSocket agent
|
|
1370
|
+
fetchAgent: myCustomDispatcher, // undici Dispatcher for media
|
|
1371
|
+
});
|
|
1372
|
+
```
|
|
1373
|
+
|
|
1374
|
+
### Proxy Validation
|
|
1375
|
+
|
|
1376
|
+
```typescript
|
|
1377
|
+
import { validateProxyConfig } from "miaw-core";
|
|
1378
|
+
|
|
1379
|
+
validateProxyConfig("socks5://proxy:1080"); // true
|
|
1380
|
+
validateProxyConfig("http://proxy:8080"); // true
|
|
1381
|
+
validateProxyConfig("ftp://invalid:21"); // false
|
|
1382
|
+
```
|
|
1383
|
+
|
|
1384
|
+
### Supported Protocols
|
|
1385
|
+
|
|
1386
|
+
| Protocol | WebSocket | Media Upload/Download |
|
|
1387
|
+
|----------|-----------|----------------------|
|
|
1388
|
+
| `http://` | Yes | Yes |
|
|
1389
|
+
| `https://` | Yes | Yes |
|
|
1390
|
+
| `socks4://` | Yes | No (direct connection) |
|
|
1391
|
+
| `socks5://` | Yes | No (direct connection) |
|
|
1392
|
+
|
|
1393
|
+
> **Note**: SOCKS proxies fully tunnel the WebSocket connection to WhatsApp. However, media uploads/downloads (which use Node.js `fetch()`) fall back to a direct connection when using SOCKS, because Node.js `fetch()` requires an undici-compatible dispatcher which doesn't support SOCKS natively. HTTP/HTTPS proxies work for both.
|
|
1394
|
+
|
|
1235
1395
|
## Session Management
|
|
1236
1396
|
|
|
1237
1397
|
### Session Storage Location
|
|
@@ -1359,10 +1519,22 @@ client.on("message", (msg) => {
|
|
|
1359
1519
|
console.log("Sender phone:", msg.senderPhone);
|
|
1360
1520
|
});
|
|
1361
1521
|
|
|
1362
|
-
// Manual LID resolution
|
|
1522
|
+
// Manual LID resolution (synchronous, cache-only)
|
|
1363
1523
|
const phoneJid = client.resolveLidToJid("123456@lid");
|
|
1364
1524
|
const phone = client.getPhoneFromJid("123456@lid");
|
|
1365
1525
|
|
|
1526
|
+
// Async resolution — falls back to Baileys' native LID store on a cache miss
|
|
1527
|
+
// (server-backed, back-fills the cache). Requires an active connection.
|
|
1528
|
+
const jid = await client.resolveLidToJidAsync("123456@lid");
|
|
1529
|
+
const phone2 = await client.getPhoneFromJidAsync("123456@lid");
|
|
1530
|
+
|
|
1531
|
+
// Bulk: resolve many LIDs in one native query (cache hits served locally)
|
|
1532
|
+
const map = await client.resolveLidsToPhones(["123456@lid", "789012@lid"]);
|
|
1533
|
+
// => { "123456@lid": "6281234567890", "789012@lid": null }
|
|
1534
|
+
|
|
1535
|
+
// Reverse: phone number -> LID
|
|
1536
|
+
const lid = await client.getLidForPhone("6281234567890"); // "123456@lid" | null
|
|
1537
|
+
|
|
1366
1538
|
// Register LID mapping (useful for persistence)
|
|
1367
1539
|
client.registerLidMapping("123456@lid", "6281234567890@s.whatsapp.net");
|
|
1368
1540
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "miaw-core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"description": "Simplified WhatsApp API wrapper for Baileys - Multiple Instance of Awesome WhatsApp",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -14,20 +14,6 @@
|
|
|
14
14
|
"bin": {
|
|
15
15
|
"miaw-cli": "./bin/miaw-cli.ts"
|
|
16
16
|
},
|
|
17
|
-
"scripts": {
|
|
18
|
-
"build": "tsc",
|
|
19
|
-
"dev": "tsc --watch",
|
|
20
|
-
"lint": "eslint src tests examples bin",
|
|
21
|
-
"lint:fix": "eslint src tests examples bin --fix",
|
|
22
|
-
"prepublishOnly": "npm run build",
|
|
23
|
-
"test": "NODE_OPTIONS='--experimental-vm-modules' jest",
|
|
24
|
-
"test:watch": "NODE_OPTIONS='--experimental-vm-modules' jest --watch",
|
|
25
|
-
"test:coverage": "NODE_OPTIONS='--experimental-vm-modules' jest --coverage",
|
|
26
|
-
"test:cli": "NODE_OPTIONS='--experimental-vm-modules' jest --testPathPattern='tests/integration/cli' --runInBand --forceExit",
|
|
27
|
-
"test:manual": "tsx tests/interactive-test.ts",
|
|
28
|
-
"test:manual:build": "npm run build && node dist/tests/interactive-test.js",
|
|
29
|
-
"cli": "tsx bin/miaw-cli.ts"
|
|
30
|
-
},
|
|
31
17
|
"keywords": [
|
|
32
18
|
"whatsapp",
|
|
33
19
|
"baileys",
|
|
@@ -43,10 +29,13 @@
|
|
|
43
29
|
},
|
|
44
30
|
"dependencies": {
|
|
45
31
|
"@hapi/boom": "^10.0.1",
|
|
46
|
-
"@whiskeysockets/baileys": "
|
|
32
|
+
"@whiskeysockets/baileys": "7.0.0-rc13",
|
|
47
33
|
"cli-table3": "^0.6.5",
|
|
34
|
+
"https-proxy-agent": "^8.0.0",
|
|
48
35
|
"pino": "^8.19.0",
|
|
49
|
-
"qrcode-terminal": "^0.12.0"
|
|
36
|
+
"qrcode-terminal": "^0.12.0",
|
|
37
|
+
"socks-proxy-agent": "^9.0.0",
|
|
38
|
+
"undici": "^7.24.0"
|
|
50
39
|
},
|
|
51
40
|
"devDependencies": {
|
|
52
41
|
"@babel/preset-env": "^7.28.5",
|
|
@@ -67,5 +56,18 @@
|
|
|
67
56
|
},
|
|
68
57
|
"engines": {
|
|
69
58
|
"node": ">=18.0.0"
|
|
59
|
+
},
|
|
60
|
+
"scripts": {
|
|
61
|
+
"build": "tsc",
|
|
62
|
+
"dev": "tsc --watch",
|
|
63
|
+
"lint": "eslint src tests examples bin",
|
|
64
|
+
"lint:fix": "eslint src tests examples bin --fix",
|
|
65
|
+
"test": "NODE_OPTIONS='--experimental-vm-modules' jest",
|
|
66
|
+
"test:watch": "NODE_OPTIONS='--experimental-vm-modules' jest --watch",
|
|
67
|
+
"test:coverage": "NODE_OPTIONS='--experimental-vm-modules' jest --coverage",
|
|
68
|
+
"test:cli": "NODE_OPTIONS='--experimental-vm-modules' jest --testPathPattern='tests/integration/cli' --runInBand --forceExit",
|
|
69
|
+
"test:manual": "tsx tests/interactive-test.ts",
|
|
70
|
+
"test:manual:build": "npm run build && node dist/tests/interactive-test.js",
|
|
71
|
+
"cli": "tsx bin/miaw-cli.ts"
|
|
70
72
|
}
|
|
71
|
-
}
|
|
73
|
+
}
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
instances
|
|
2
|
+
ls
|
|
3
|
+
instance ls
|
|
4
|
+
instances
|
|
5
|
+
devices
|
|
1
6
|
get contacts --filter 22341
|
|
2
7
|
get profile
|
|
3
8
|
group participants 120363039902323086@g.us
|
|
@@ -272,3 +277,8 @@ group get profile
|
|
|
272
277
|
group participants 120363039902323086@g.us
|
|
273
278
|
get profile
|
|
274
279
|
get contacts --filter 22341
|
|
280
|
+
devices
|
|
281
|
+
instances
|
|
282
|
+
instance ls
|
|
283
|
+
ls
|
|
284
|
+
instances
|