miaw-core 0.9.0 → 1.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/CHANGELOG.md +167 -0
- package/README.md +132 -11
- package/babel.config.js +2 -2
- package/dist/client/MiawClient.d.ts +111 -9
- package/dist/client/MiawClient.d.ts.map +1 -1
- package/dist/client/MiawClient.js +1136 -546
- package/dist/client/MiawClient.js.map +1 -1
- package/dist/handlers/AuthHandler.d.ts +5 -0
- package/dist/handlers/AuthHandler.d.ts.map +1 -1
- package/dist/handlers/AuthHandler.js +21 -10
- package/dist/handlers/AuthHandler.js.map +1 -1
- package/dist/handlers/MessageHandler.d.ts +1 -1
- package/dist/handlers/MessageHandler.d.ts.map +1 -1
- package/dist/handlers/MessageHandler.js +21 -25
- package/dist/handlers/MessageHandler.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -7
- package/dist/index.js.map +1 -1
- package/dist/types/index.d.ts +129 -24
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +4 -7
- package/dist/types/index.js.map +1 -1
- package/docs/API_STABILITY_REVIEW.md +316 -0
- package/docs/BAILEYS_MIGRATION_v7.md +220 -0
- package/docs/BAILEYS_VS_MIAW_COMPARISON.md +522 -0
- package/docs/MIGRATION.md +307 -0
- package/docs/TEST_COVERAGE_ANALYSIS.md +256 -0
- package/{USAGE.md → docs/USAGE.md} +68 -11
- package/eslint.config.js +22 -0
- package/package.json +23 -6
- package/tsconfig.json +6 -5
- package/tsconfig.test.json +3 -1
- package/dist/utils/storage.d.ts +0 -25
- package/dist/utils/storage.d.ts.map +0 -1
- package/dist/utils/storage.js +0 -60
- package/dist/utils/storage.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,11 +5,141 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [1.1.0] - 2026-01-02
|
|
9
|
+
|
|
10
|
+
**Baileys v7 Migration** - ESM-only release with improved session stability
|
|
11
|
+
|
|
12
|
+
### BREAKING CHANGES
|
|
13
|
+
|
|
14
|
+
- **ESM-only** - Package now uses `"type": "module"`. CommonJS `require()` is no longer supported.
|
|
15
|
+
- **Node.js >= 18.0.0** required
|
|
16
|
+
|
|
17
|
+
### Fixed
|
|
18
|
+
|
|
19
|
+
- **Session reconnection issue** - Fixed bug where app couldn't reconnect after QR scan and restart without re-pairing
|
|
20
|
+
- Includes fixes from Baileys v7: #1735, #1822, #1663, #1697
|
|
21
|
+
|
|
22
|
+
### Changed
|
|
23
|
+
|
|
24
|
+
- **Baileys** upgraded from v6.7.21 to v7.0.0-rc.9
|
|
25
|
+
- TypeScript target updated to ES2022
|
|
26
|
+
- All imports now use `.js` extensions for ESM compatibility
|
|
27
|
+
- Node.js built-in imports use `node:` prefix
|
|
28
|
+
|
|
29
|
+
### Migration
|
|
30
|
+
|
|
31
|
+
For users upgrading from v1.0.x:
|
|
32
|
+
|
|
33
|
+
```typescript
|
|
34
|
+
// No code changes needed if already using ESM imports
|
|
35
|
+
import { MiawClient } from "miaw-core";
|
|
36
|
+
|
|
37
|
+
// If using CommonJS, migrate to ESM:
|
|
38
|
+
// Before (CommonJS - no longer supported):
|
|
39
|
+
// const { MiawClient } = require('miaw-core');
|
|
40
|
+
|
|
41
|
+
// After (ESM):
|
|
42
|
+
import { MiawClient } from "miaw-core";
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Ensure your `package.json` has `"type": "module"` or use `.mjs` file extension.
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## [1.0.0] - 2025-12-24
|
|
50
|
+
|
|
51
|
+
**First Stable Release!** 🎉
|
|
52
|
+
|
|
53
|
+
This is the first stable release of Miaw Core. After 9 pre-releases, the API is now stable and ready for production use.
|
|
54
|
+
|
|
55
|
+
### Stability Guarantee
|
|
56
|
+
|
|
57
|
+
- **No breaking changes** in v1.x.x releases
|
|
58
|
+
- New features will be additive only
|
|
59
|
+
- Deprecations will be marked at least 1 minor version before removal
|
|
60
|
+
- Migration guides provided for any breaking changes in v2.x
|
|
61
|
+
|
|
62
|
+
### What's New Since v0.9.1
|
|
63
|
+
|
|
64
|
+
#### LID Cache Management
|
|
65
|
+
|
|
66
|
+
- `getLidCacheSize()` - Get current LID to JID cache size
|
|
67
|
+
- `clearLidCache()` - Clear the LID cache
|
|
68
|
+
- `getLidMappings()` - Returns `Record<string, string>` instead of `Map`
|
|
69
|
+
|
|
70
|
+
#### Resource Cleanup
|
|
71
|
+
|
|
72
|
+
- `dispose()` - Properly clean up resources before shutdown
|
|
73
|
+
- Recommended to call on process exit for clean session save
|
|
74
|
+
|
|
75
|
+
#### Performance Improvements
|
|
76
|
+
|
|
77
|
+
- LID mappings now use LRU cache with max size of 1000 entries
|
|
78
|
+
- Automatic eviction of least recently used mappings
|
|
79
|
+
- Improved memory management for long-running bots
|
|
80
|
+
|
|
81
|
+
### API Surface
|
|
82
|
+
|
|
83
|
+
81 public methods across 10 categories:
|
|
84
|
+
|
|
85
|
+
- Core Client (7 methods)
|
|
86
|
+
- Messaging (6 methods)
|
|
87
|
+
- Media (5 methods)
|
|
88
|
+
- Contact Info (5 methods)
|
|
89
|
+
- Group Management (11 methods)
|
|
90
|
+
- Profile Management (4 methods)
|
|
91
|
+
- Label Operations (5 methods, Business only)
|
|
92
|
+
- Catalog Operations (5 methods, Business only)
|
|
93
|
+
- Newsletter Operations (17 methods)
|
|
94
|
+
- Contact Management (2 methods)
|
|
95
|
+
- LID Mapping (6 methods)
|
|
96
|
+
- UX Features (6 methods)
|
|
97
|
+
|
|
98
|
+
### Documentation
|
|
99
|
+
|
|
100
|
+
- API Stability Review (`docs/API_STABILITY_REVIEW.md`)
|
|
101
|
+
- Comprehensive examples (11 basic + 2 real-world examples)
|
|
102
|
+
- Migration guide with version compatibility matrix
|
|
103
|
+
- Complete type definitions with TypeScript strict mode
|
|
104
|
+
|
|
105
|
+
### Testing
|
|
106
|
+
|
|
107
|
+
- 68 unit tests (100% passing)
|
|
108
|
+
- 144 integration tests (require WhatsApp authentication)
|
|
109
|
+
- Full test coverage for all API methods
|
|
110
|
+
|
|
111
|
+
### Known Changes from v0.9.x
|
|
112
|
+
|
|
113
|
+
- `getLidMappings()` now returns `Record<string, string>` instead of `Map`
|
|
114
|
+
- Use `Object.entries()` or Object methods instead of Map methods
|
|
115
|
+
|
|
116
|
+
## [0.9.1] - 2025-12-24
|
|
117
|
+
|
|
118
|
+
### Added
|
|
119
|
+
|
|
120
|
+
#### Examples
|
|
121
|
+
|
|
122
|
+
- `01-basic-bot.ts` - Core client, QR authentication, echo bot (v0.1.0)
|
|
123
|
+
- `02-media-bot.ts` - Media sending and downloading (v0.2.0)
|
|
124
|
+
- `03-message-context.ts` - Reply, edit, delete, reactions (v0.3.0)
|
|
125
|
+
- `04-validation-social.ts` - Number validation, contact/group info (v0.4.0)
|
|
126
|
+
- `05-ux-polish.ts` - Read receipts, typing, presence (v0.5.0)
|
|
127
|
+
- `06-advanced-messaging.ts` - Reactions, forward, edit, delete (v0.6.0)
|
|
128
|
+
- `07-group-management.ts` - Full group admin features (v0.7.0)
|
|
129
|
+
- `08-profile-management.ts` - Profile picture, name, status (v0.8.0)
|
|
130
|
+
- `09-business-social.ts` - Labels, catalog, newsletter, contacts (v0.9.0)
|
|
131
|
+
- `examples/README.md` - Examples overview and usage guide
|
|
132
|
+
|
|
133
|
+
### Changed
|
|
134
|
+
|
|
135
|
+
- Updated README.md with v0.9.0 capabilities and changelog link
|
|
136
|
+
|
|
8
137
|
## [0.9.0] - 2025-12-24
|
|
9
138
|
|
|
10
139
|
### Added
|
|
11
140
|
|
|
12
141
|
#### Label Operations (WhatsApp Business only)
|
|
142
|
+
|
|
13
143
|
- `addLabel()` - Create or edit labels
|
|
14
144
|
- `addChatLabel()` - Add a label to a chat
|
|
15
145
|
- `removeChatLabel()` - Remove a label from a chat
|
|
@@ -20,6 +150,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
20
150
|
- `Label`, `LabelOperationResult` types
|
|
21
151
|
|
|
22
152
|
#### Catalog/Product Operations (WhatsApp Business only)
|
|
153
|
+
|
|
23
154
|
- `getCatalog()` - Fetch product catalog with pagination support
|
|
24
155
|
- `getCollections()` - Fetch catalog collections
|
|
25
156
|
- `createProduct()` - Add new products to catalog
|
|
@@ -28,6 +159,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
28
159
|
- `Product`, `ProductCollection`, `ProductCatalog`, `ProductOperationResult`, `ProductOptions` types
|
|
29
160
|
|
|
30
161
|
#### Newsletter/Channel Operations
|
|
162
|
+
|
|
31
163
|
- `createNewsletter()` - Create WhatsApp channels/newsletters
|
|
32
164
|
- `getNewsletterMetadata()` - Get newsletter information
|
|
33
165
|
- `followNewsletter()` - Follow/subscribe to newsletters
|
|
@@ -49,11 +181,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
49
181
|
- `NewsletterMetadata`, `NewsletterMessage`, `NewsletterMessagesResult`, `NewsletterOperationResult`, `NewsletterSubscriptionInfo` types
|
|
50
182
|
|
|
51
183
|
#### Contact Management
|
|
184
|
+
|
|
52
185
|
- `addOrEditContact()` - Add or update contacts
|
|
53
186
|
- `removeContact()` - Remove contacts
|
|
54
187
|
- `ContactData`, `ContactOperationResult` types
|
|
55
188
|
|
|
56
189
|
#### Tests
|
|
190
|
+
|
|
57
191
|
- Integration tests for all v0.9.0 features (`12-business-features.test.ts`, `13-newsletter-features.test.ts`)
|
|
58
192
|
|
|
59
193
|
## [0.8.0] - 2025-12-21
|
|
@@ -61,14 +195,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
61
195
|
### Added
|
|
62
196
|
|
|
63
197
|
- **Profile Picture Management**
|
|
198
|
+
|
|
64
199
|
- `updateProfilePicture()` - Update your own profile picture (file path, URL, or Buffer)
|
|
65
200
|
- `removeProfilePicture()` - Remove your profile picture
|
|
66
201
|
|
|
67
202
|
- **Profile Information**
|
|
203
|
+
|
|
68
204
|
- `updateProfileName()` - Update your display name (push name)
|
|
69
205
|
- `updateProfileStatus()` - Update your "About" text
|
|
70
206
|
|
|
71
207
|
- **New Types**
|
|
208
|
+
|
|
72
209
|
- `ProfileOperationResult` - Result type for profile operations (success/error)
|
|
73
210
|
|
|
74
211
|
- **Integration Tests**
|
|
@@ -79,31 +216,37 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
79
216
|
### Added
|
|
80
217
|
|
|
81
218
|
- **Group Creation**
|
|
219
|
+
|
|
82
220
|
- `createGroup()` - Create new WhatsApp groups with initial participants
|
|
83
221
|
- Returns `CreateGroupResult` with group JID and metadata
|
|
84
222
|
|
|
85
223
|
- **Participant Management**
|
|
224
|
+
|
|
86
225
|
- `addParticipants()` - Add members to a group (requires admin)
|
|
87
226
|
- `removeParticipants()` - Remove members from a group (requires admin)
|
|
88
227
|
- `leaveGroup()` - Leave a group
|
|
89
228
|
- Returns `ParticipantOperationResult[]` with status for each participant
|
|
90
229
|
|
|
91
230
|
- **Admin Management**
|
|
231
|
+
|
|
92
232
|
- `promoteToAdmin()` - Promote members to group admin
|
|
93
233
|
- `demoteFromAdmin()` - Demote admins to regular members
|
|
94
234
|
|
|
95
235
|
- **Group Settings**
|
|
236
|
+
|
|
96
237
|
- `updateGroupName()` - Change group name/subject
|
|
97
238
|
- `updateGroupDescription()` - Set or clear group description
|
|
98
239
|
- `updateGroupPicture()` - Change group profile picture
|
|
99
240
|
|
|
100
241
|
- **Group Invites**
|
|
242
|
+
|
|
101
243
|
- `getGroupInviteLink()` - Get group invite link (https://chat.whatsapp.com/...)
|
|
102
244
|
- `revokeGroupInvite()` - Revoke current link and get new one
|
|
103
245
|
- `acceptGroupInvite()` - Join group via invite code or URL
|
|
104
246
|
- `getGroupInviteInfo()` - Preview group info before joining
|
|
105
247
|
|
|
106
248
|
- **New Types**
|
|
249
|
+
|
|
107
250
|
- `ParticipantOperationResult` - Result of add/remove/promote/demote operations
|
|
108
251
|
- `CreateGroupResult` - Result of group creation with metadata
|
|
109
252
|
- `GroupOperationResult` - Generic success/error result for group operations
|
|
@@ -117,13 +260,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
117
260
|
### Added
|
|
118
261
|
|
|
119
262
|
- **Send Reactions**
|
|
263
|
+
|
|
120
264
|
- `sendReaction()` - Send emoji reactions to messages (e.g., '❤️', '👍')
|
|
121
265
|
- `removeReaction()` - Remove your reaction from a message
|
|
122
266
|
|
|
123
267
|
- **Forward Messages**
|
|
268
|
+
|
|
124
269
|
- `forwardMessage()` - Forward any message to another chat
|
|
125
270
|
|
|
126
271
|
- **Edit Messages**
|
|
272
|
+
|
|
127
273
|
- `editMessage()` - Edit your own messages (within WhatsApp's 15-minute window)
|
|
128
274
|
|
|
129
275
|
- **Delete Messages**
|
|
@@ -135,21 +281,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
135
281
|
### Added
|
|
136
282
|
|
|
137
283
|
- **Read Receipts**
|
|
284
|
+
|
|
138
285
|
- `markAsRead()` - Mark messages as read (send read receipt)
|
|
139
286
|
- Returns boolean indicating success
|
|
140
287
|
|
|
141
288
|
- **Typing & Recording Indicators**
|
|
289
|
+
|
|
142
290
|
- `sendTyping()` - Send "typing..." indicator to a chat
|
|
143
291
|
- `sendRecording()` - Send "recording audio..." indicator
|
|
144
292
|
- `stopTyping()` - Stop typing/recording indicator (send paused state)
|
|
145
293
|
- Works with both individual contacts and groups
|
|
146
294
|
|
|
147
295
|
- **Presence Management**
|
|
296
|
+
|
|
148
297
|
- `setPresence()` - Set bot's online/offline status ('available' or 'unavailable')
|
|
149
298
|
- `subscribePresence()` - Subscribe to contact's presence updates
|
|
150
299
|
- `presence` event - Emitted when subscribed contact's presence changes
|
|
151
300
|
|
|
152
301
|
- **New Types**
|
|
302
|
+
|
|
153
303
|
- `PresenceStatus` - Union type for 'available' | 'unavailable'
|
|
154
304
|
- `PresenceUpdate` - Presence notification data (jid, status, lastSeen)
|
|
155
305
|
|
|
@@ -161,20 +311,24 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
161
311
|
### Added
|
|
162
312
|
|
|
163
313
|
- **Contact Validation**
|
|
314
|
+
|
|
164
315
|
- `checkNumber()` - Verify if phone number is on WhatsApp
|
|
165
316
|
- `checkNumbers()` - Batch check multiple phone numbers
|
|
166
317
|
- Returns `CheckNumberResult` with exists flag and JID
|
|
167
318
|
|
|
168
319
|
- **Contact Information**
|
|
320
|
+
|
|
169
321
|
- `getContactInfo()` - Fetch contact info including status
|
|
170
322
|
- `getBusinessProfile()` - Get business account profile details
|
|
171
323
|
- `getProfilePicture()` - Get profile picture URL (supports low/high res)
|
|
172
324
|
|
|
173
325
|
- **Group Information**
|
|
326
|
+
|
|
174
327
|
- `getGroupInfo()` - Fetch group metadata (name, description, settings)
|
|
175
328
|
- `getGroupParticipants()` - List all group members with roles
|
|
176
329
|
|
|
177
330
|
- **New Types**
|
|
331
|
+
|
|
178
332
|
- `CheckNumberResult` - Result of number validation
|
|
179
333
|
- `ContactInfo` - Contact information structure
|
|
180
334
|
- `BusinessProfile` - Business profile data
|
|
@@ -190,23 +344,28 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
190
344
|
### Added
|
|
191
345
|
|
|
192
346
|
- **Reply to Messages (Quoted)**
|
|
347
|
+
|
|
193
348
|
- All send methods now support `quoted` option
|
|
194
349
|
- Pass `MiawMessage` to reply to specific messages
|
|
195
350
|
- Works with `sendText()`, `sendImage()`, `sendDocument()`, `sendVideo()`, `sendAudio()`
|
|
196
351
|
|
|
197
352
|
- **Edit Notifications**
|
|
353
|
+
|
|
198
354
|
- `message_edit` event when messages are edited
|
|
199
355
|
- `MessageEdit` type with messageId, chatId, newText, editTimestamp
|
|
200
356
|
|
|
201
357
|
- **Delete Notifications**
|
|
358
|
+
|
|
202
359
|
- `message_delete` event when messages are deleted/revoked
|
|
203
360
|
- `MessageDelete` type with messageId, chatId, fromMe, participant
|
|
204
361
|
|
|
205
362
|
- **Reactions**
|
|
363
|
+
|
|
206
364
|
- `message_reaction` event when messages receive reactions
|
|
207
365
|
- `MessageReaction` type with messageId, chatId, reactorId, emoji, isRemoval
|
|
208
366
|
|
|
209
367
|
- **New Types**
|
|
368
|
+
|
|
210
369
|
- `MessageEdit` - Edit notification data
|
|
211
370
|
- `MessageDelete` - Delete notification data
|
|
212
371
|
- `MessageReaction` - Reaction notification data
|
|
@@ -224,15 +383,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
224
383
|
### Added
|
|
225
384
|
|
|
226
385
|
- **Media Sending Methods**
|
|
386
|
+
|
|
227
387
|
- `sendImage()` - Send images with caption and view-once support
|
|
228
388
|
- `sendDocument()` - Send documents with auto-mimetype detection
|
|
229
389
|
- `sendVideo()` - Send videos with caption, GIF playback, and PTV (video notes)
|
|
230
390
|
- `sendAudio()` - Send audio with PTT (voice notes) support
|
|
231
391
|
|
|
232
392
|
- **Media Download**
|
|
393
|
+
|
|
233
394
|
- `downloadMedia()` - Download media from received messages as Buffer
|
|
234
395
|
|
|
235
396
|
- **Media Metadata**
|
|
397
|
+
|
|
236
398
|
- `MediaInfo` type with full metadata extraction
|
|
237
399
|
- Support for mimetype, fileSize, dimensions, duration
|
|
238
400
|
- PTT detection for voice notes
|
|
@@ -240,6 +402,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
240
402
|
- View-once message detection
|
|
241
403
|
|
|
242
404
|
- **New Types**
|
|
405
|
+
|
|
243
406
|
- `MediaSource` - Flexible input type (path/URL/Buffer)
|
|
244
407
|
- `SendImageOptions`, `SendDocumentOptions`, `SendVideoOptions`, `SendAudioOptions`
|
|
245
408
|
- `MediaInfo` - Media metadata interface
|
|
@@ -262,22 +425,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
262
425
|
### Added
|
|
263
426
|
|
|
264
427
|
- **Core Client**
|
|
428
|
+
|
|
265
429
|
- `MiawClient` class with event-driven architecture
|
|
266
430
|
- Connection management with auto-reconnection
|
|
267
431
|
- Session persistence using Baileys multi-file auth state
|
|
268
432
|
- Multiple instance support with isolated sessions
|
|
269
433
|
|
|
270
434
|
- **Messaging**
|
|
435
|
+
|
|
271
436
|
- `sendText()` - Send text messages to individuals and groups
|
|
272
437
|
- Message normalization with `MiawMessage` format
|
|
273
438
|
- Support for @s.whatsapp.net, @lid, @g.us JID formats
|
|
274
439
|
|
|
275
440
|
- **LID Support**
|
|
441
|
+
|
|
276
442
|
- Handle WhatsApp's @lid privacy format
|
|
277
443
|
- LID to phone number mapping
|
|
278
444
|
- `resolveLidToJid()`, `getPhoneFromJid()`, `registerLidMapping()`
|
|
279
445
|
|
|
280
446
|
- **Events**
|
|
447
|
+
|
|
281
448
|
- `qr` - QR code for authentication
|
|
282
449
|
- `ready` - Client connected and ready
|
|
283
450
|
- `message` - Incoming message received
|
package/README.md
CHANGED
|
@@ -1,13 +1,37 @@
|
|
|
1
1
|
# Miaw Core
|
|
2
2
|
|
|
3
|
-
**Multiple Instance of
|
|
3
|
+
**Multiple Instance of Awesome WhatsApp** - A simplified WhatsApp API wrapper for Baileys
|
|
4
4
|
|
|
5
5
|
Miaw Core abstracts away the complexity of Baileys, providing a clean, simple API for building WhatsApp bots and automation tools. It handles all the painful parts: session management, QR codes, reconnection logic, and message parsing.
|
|
6
6
|
|
|
7
|
+
> **Now powered by Baileys v7.0.0** - Full support for the latest WhatsApp Web features including newsletters/channels
|
|
8
|
+
|
|
9
|
+
## Why Miaw Core vs Baileys Directly?
|
|
10
|
+
|
|
11
|
+
| Aspect | Baileys (Direct) | Miaw Core |
|
|
12
|
+
| ---------------------- | ----------------------------- | ---------------------------------- |
|
|
13
|
+
| **Learning Curve** | Steep - 150+ methods to learn | Gentle - 92 focused methods |
|
|
14
|
+
| **Setup Code** | 50-100 lines boilerplate | 10 lines to start |
|
|
15
|
+
| **Session Management** | Manual auth state handling | Automatic file-based persistence |
|
|
16
|
+
| **Reconnection** | DIY implementation | Built-in with configurable retries |
|
|
17
|
+
| **Message Format** | Complex nested structures | Normalized `MiawMessage` objects |
|
|
18
|
+
| **TypeScript** | Types available but complex | Clean, simplified types |
|
|
19
|
+
| **Multi-Instance** | Manual socket management | Instance ID-based separation |
|
|
20
|
+
|
|
21
|
+
**Choose Baileys directly** if you need low-level control, custom implementations, or access to every WhatsApp feature.
|
|
22
|
+
|
|
23
|
+
**Choose Miaw Core** if you want to build bots quickly with clean code, automatic session handling, and don't need every obscure feature.
|
|
24
|
+
|
|
25
|
+
For a detailed comparison, see [Baileys vs Miaw Core Comparison](./docs/BAILEYS_VS_MIAW_COMPARISON.md).
|
|
26
|
+
|
|
7
27
|
## Documentation
|
|
8
28
|
|
|
9
|
-
- **[Usage Guide](./USAGE.md)** - Complete guide for all current features
|
|
10
|
-
- **[
|
|
29
|
+
- **[Usage Guide](./docs/USAGE.md)** - Complete guide for all current features
|
|
30
|
+
- **[Baileys Comparison](./docs/BAILEYS_VS_MIAW_COMPARISON.md)** - Feature comparison with raw Baileys
|
|
31
|
+
- **[Migration Guide](./docs/MIGRATION.md)** - Upgrading between versions
|
|
32
|
+
- **[Test Coverage](./docs/TEST_COVERAGE_ANALYSIS.md)** - API coverage analysis
|
|
33
|
+
- **[Roadmap](./docs/ROADMAP.md)** - Feature roadmap and development plan
|
|
34
|
+
- **[Changelog](./CHANGELOG.md)** - Version history and changes
|
|
11
35
|
- **[Examples](./examples/)** - Code examples and sample bots
|
|
12
36
|
|
|
13
37
|
## Features
|
|
@@ -19,6 +43,15 @@ Miaw Core abstracts away the complexity of Baileys, providing a clean, simple AP
|
|
|
19
43
|
- **TypeScript Support** - Full type definitions for excellent IDE experience
|
|
20
44
|
- **Event-Driven** - Easy-to-use event system for messages and connection states
|
|
21
45
|
- **Normalized Messages** - Simplified message format, no more complex Baileys structures
|
|
46
|
+
- **Business Features** - Label operations, product catalog, newsletter/channels (WhatsApp Business)
|
|
47
|
+
- **Contact Management** - Add, edit, and remove contacts
|
|
48
|
+
- **Group Management** - Full admin capabilities for groups
|
|
49
|
+
- **Profile Management** - Customize bot profile picture, name, and status
|
|
50
|
+
|
|
51
|
+
## Requirements
|
|
52
|
+
|
|
53
|
+
- **Node.js** >= 18.0.0
|
|
54
|
+
- **ESM** - This package is ESM-only (uses `"type": "module"`)
|
|
22
55
|
|
|
23
56
|
## Installation
|
|
24
57
|
|
|
@@ -59,11 +92,69 @@ client.on("message", async (message) => {
|
|
|
59
92
|
await client.connect();
|
|
60
93
|
```
|
|
61
94
|
|
|
62
|
-
For more examples and detailed usage, see the [Usage Guide](./USAGE.md).
|
|
95
|
+
For more examples and detailed usage, see the [Usage Guide](./docs/USAGE.md).
|
|
96
|
+
|
|
97
|
+
## Testing
|
|
98
|
+
|
|
99
|
+
### Manual Interactive Testing
|
|
100
|
+
|
|
101
|
+
Test all 92 API methods interactively:
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
# Show available test groups
|
|
105
|
+
npm run test:manual
|
|
106
|
+
|
|
107
|
+
# Run specific test groups
|
|
108
|
+
npm run test:manual all # All tests
|
|
109
|
+
npm run test:manual messaging # Messaging tests only
|
|
110
|
+
npm run test:manual newsletter # Newsletter tests only
|
|
111
|
+
npm run test:manual business # Business features only
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
**Available test groups:**
|
|
115
|
+
|
|
116
|
+
| Group | Description | Methods |
|
|
117
|
+
| ------------ | ------------------------------- | ------- |
|
|
118
|
+
| `core` | Connection, lifecycle | 6 |
|
|
119
|
+
| `get` | Fetch contacts, groups, chats | 6 |
|
|
120
|
+
| `messaging` | Send/receive, reactions, edit | 12 |
|
|
121
|
+
| `contacts` | Check numbers, contact info | 7 |
|
|
122
|
+
| `group` | Create, manage participants | 13 |
|
|
123
|
+
| `profile` | Update picture, name, status | 4 |
|
|
124
|
+
| `business` | Labels, catalog (Business only) | 10 |
|
|
125
|
+
| `newsletter` | Channels, subscriptions | 6 |
|
|
126
|
+
| `ux` | Typing, presence, read receipts | 5 |
|
|
127
|
+
|
|
128
|
+
**Features:**
|
|
129
|
+
|
|
130
|
+
- Auto-connects using existing session (skips QR if already authenticated)
|
|
131
|
+
- Tracks test results with pass/fail/skip status
|
|
132
|
+
- Generates summary report with timestamps
|
|
133
|
+
- Pre-loads test configuration from `.env.test`
|
|
63
134
|
|
|
64
|
-
|
|
135
|
+
See [Test Coverage Analysis](./docs/TEST_COVERAGE_ANALYSIS.md) for detailed coverage report.
|
|
136
|
+
|
|
137
|
+
### Unit & Integration Tests
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
# Run all tests
|
|
141
|
+
npm test
|
|
142
|
+
|
|
143
|
+
# Run in watch mode
|
|
144
|
+
npm run test:watch
|
|
145
|
+
|
|
146
|
+
# Generate coverage report
|
|
147
|
+
npm run test:coverage
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## Current Capabilities (v1.1.0)
|
|
151
|
+
|
|
152
|
+
Built on **Baileys v7.0.0-rc.9** - the latest WhatsApp Web protocol implementation.
|
|
153
|
+
|
|
154
|
+
### Core Features
|
|
65
155
|
|
|
66
156
|
- ✅ Send and receive text messages
|
|
157
|
+
- ✅ Send/receive media (images, videos, audio, documents)
|
|
67
158
|
- ✅ QR code authentication
|
|
68
159
|
- ✅ Session persistence
|
|
69
160
|
- ✅ Auto-reconnection
|
|
@@ -72,7 +163,37 @@ For more examples and detailed usage, see the [Usage Guide](./USAGE.md).
|
|
|
72
163
|
- ✅ TypeScript support
|
|
73
164
|
- ✅ Error handling
|
|
74
165
|
|
|
75
|
-
|
|
166
|
+
### Advanced Messaging
|
|
167
|
+
|
|
168
|
+
- ✅ Reply/quote messages
|
|
169
|
+
- ✅ Edit own messages
|
|
170
|
+
- ✅ Delete messages
|
|
171
|
+
- ✅ Message reactions
|
|
172
|
+
- ✅ Forward messages
|
|
173
|
+
|
|
174
|
+
### Group Management
|
|
175
|
+
|
|
176
|
+
- ✅ Create groups
|
|
177
|
+
- ✅ Add/remove participants
|
|
178
|
+
- ✅ Promote/demote admins
|
|
179
|
+
- ✅ Group invite links
|
|
180
|
+
- ✅ Update group settings
|
|
181
|
+
|
|
182
|
+
### Profile Management
|
|
183
|
+
|
|
184
|
+
- ✅ Update profile picture
|
|
185
|
+
- ✅ Remove profile picture
|
|
186
|
+
- ✅ Update profile name
|
|
187
|
+
- ✅ Update profile status
|
|
188
|
+
|
|
189
|
+
### Business & Social
|
|
190
|
+
|
|
191
|
+
- ✅ Label operations (WhatsApp Business)
|
|
192
|
+
- ✅ Product catalog management (WhatsApp Business)
|
|
193
|
+
- ✅ Newsletter/channel operations (create, send, manage)
|
|
194
|
+
- ✅ Contact management (add, edit, remove)
|
|
195
|
+
|
|
196
|
+
See [ROADMAP.md](./docs/ROADMAP.md) for planned features.
|
|
76
197
|
|
|
77
198
|
## What Miaw Core Abstracts
|
|
78
199
|
|
|
@@ -99,9 +220,9 @@ miaw-core/
|
|
|
99
220
|
│ ├── types/ # TypeScript definitions
|
|
100
221
|
│ ├── utils/ # Storage utilities
|
|
101
222
|
│ └── index.ts # Public API exports
|
|
223
|
+
├── docs/ # Documentation
|
|
102
224
|
├── examples/ # Usage examples
|
|
103
|
-
├──
|
|
104
|
-
├── ROADMAP.md # Feature roadmap
|
|
225
|
+
├── tests/ # Unit and integration tests
|
|
105
226
|
└── README.md # This file
|
|
106
227
|
```
|
|
107
228
|
|
|
@@ -109,7 +230,7 @@ miaw-core/
|
|
|
109
230
|
|
|
110
231
|
Contributions are welcome! To contribute:
|
|
111
232
|
|
|
112
|
-
1. Check [ROADMAP.md](./ROADMAP.md) for planned features
|
|
233
|
+
1. Check [ROADMAP.md](./docs/ROADMAP.md) for planned features
|
|
113
234
|
2. Open an issue to discuss your idea
|
|
114
235
|
3. Fork the repository
|
|
115
236
|
4. Create a feature branch
|
|
@@ -127,8 +248,8 @@ MIT
|
|
|
127
248
|
|
|
128
249
|
## Credits
|
|
129
250
|
|
|
130
|
-
Built on top of [@whiskeysockets/baileys](https://github.com/WhiskeySockets/Baileys)
|
|
251
|
+
Built on top of [@whiskeysockets/baileys](https://github.com/WhiskeySockets/Baileys) v7.0.0-rc.9
|
|
131
252
|
|
|
132
253
|
---
|
|
133
254
|
|
|
134
|
-
**Version:**
|
|
255
|
+
**Version:** 1.1.0 | **Baileys:** 7.0.0-rc.9 | **Status:** Stable | **Updated:** 2026-01-03
|
package/babel.config.js
CHANGED