xspacesocket 1.3.0 → 1.3.2
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 +696 -0
- package/README.md +62 -6
- package/package.json +8 -9
- package/poster.webp +0 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,696 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## v1.3.1 (2026-11-24)
|
|
4
|
+
|
|
5
|
+
- **jimp 0.16.3 bundled** — jimp is now a regular dependency (exact `0.16.3`), so it installs automatically with the package. This is the version that uploads a full profile picture; newer jimp versions cannot.
|
|
6
|
+
- **Published dependencies fixed** — 1.3.0 was published with no dependencies listed in the registry metadata, so `npm install` did not pull the library's dependencies. 1.3.1 declares all 15 dependencies.
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
## v1.3.0 (2026-11-22)
|
|
10
|
+
|
|
11
|
+
Polls and poll voting, channel status and polls, app-state controls, view-once recovery, native interactive buttons, and the upstream catch-up from WhiskeySockets/Baileys.
|
|
12
|
+
|
|
13
|
+
- **Polls and poll voting** — quiz and timed polls, poll add-option, poll update passthrough, and `sendPollVote` with the LID voter-id fix.
|
|
14
|
+
- **Channels** — channel status publishing and management, channel poll voting, scheduled posts, status responses, view receipts, and directory search.
|
|
15
|
+
- **App-state** — pin chats and messages, personal and close-friends status, privacy controls, automatic sync-key resolve on connect, and pin safety for non-existent messages.
|
|
16
|
+
- **View-once** — V2 envelope and the recovery helpers `downloadViewOnceMessage` and `extractViewOnceMedia`.
|
|
17
|
+
- **Native interactive buttons** — `cta_url`, `cta_copy`, `quick_reply`, `single_select`, `cta_call`.
|
|
18
|
+
- **Member tag, sticker packs, group status** — member tag text and `group-participants.update`, sticker pack publisher/cover/hash, link preview on group statuses, and `sendGroupHistory`.
|
|
19
|
+
- **Upstream catch-up** — 20 PRs and 2 merged fixes from WhiskeySockets/Baileys.
|
|
20
|
+
|
|
21
|
+
## Unreleased
|
|
22
|
+
|
|
23
|
+
### View once recovery (2026-11-21)
|
|
24
|
+
|
|
25
|
+
The bot's `.vvsave` command proved that view once media can be recovered
|
|
26
|
+
once the connection uses an Android browser identity — but the unwrap and
|
|
27
|
+
download logic lived in the bot. The fork now carries it, so any bot can
|
|
28
|
+
recover a view once with one call instead of reimplementing the unwrap:
|
|
29
|
+
|
|
30
|
+
- **`downloadViewOnceMessage(message, type, options, ctx?)`** unwraps a view
|
|
31
|
+
once message and downloads its media. When the media arrived with a media
|
|
32
|
+
key but no URL/directPath, it first asks the sender's device to re-serve
|
|
33
|
+
it via `ctx.reuploadRequest` (`sock.updateMediaMessage`) — previously
|
|
34
|
+
`downloadMediaMessage` threw before it could reupload when there was no
|
|
35
|
+
URL at all. Throws a Boom (400) when the message is not view once media,
|
|
36
|
+
or when it has no URL and no reupload was supplied.
|
|
37
|
+
- **`extractViewOnceMedia(content)`** is the pure unwrap + detect step: it
|
|
38
|
+
peels disappearing-message and view once wrappers (V1, V2, V2Extension,
|
|
39
|
+
nested, plus documentWithCaptionMessage) and returns the inner media, its
|
|
40
|
+
kind (`image` / `video` / `audio` / `document` / `ptv`) and whether it is
|
|
41
|
+
view once. It also counts document view once and a bare media message
|
|
42
|
+
carrying the `viewOnce` flag — cases `isViewOnceMessage` (the send-path
|
|
43
|
+
check, unchanged) does not cover.
|
|
44
|
+
|
|
45
|
+
Bot-side stays bot-side: the browser identity choice, where the original
|
|
46
|
+
message comes from (store / quoted copy), and where the recovered media is
|
|
47
|
+
sent.
|
|
48
|
+
|
|
49
|
+
### Contacts: add, edit and remove
|
|
50
|
+
|
|
51
|
+
The contact controls were in the socket from the start but never listed
|
|
52
|
+
here — they are the ones the bot's contact commands use:
|
|
53
|
+
|
|
54
|
+
- **`sock.addOrEditContact(jid, contact)`** saves or updates a WhatsApp
|
|
55
|
+
contact for a JID. `contact` carries the name (`fullName` /
|
|
56
|
+
`firstName`) and the LID/phone JIDs; the contact is saved in WhatsApp
|
|
57
|
+
only, not in the phone's address book. Sent as a contact sync patch.
|
|
58
|
+
- **`sock.removeContact(jid)`** removes a WhatsApp contact (a contact
|
|
59
|
+
sync patch with a null contact).
|
|
60
|
+
|
|
61
|
+
### Pin safety and poll vote in LID-addressed groups (2026-11-21)
|
|
62
|
+
|
|
63
|
+
- **Pin safety:** `sock.pinMessage(jid, key, duration?)` now refuses to
|
|
64
|
+
pin a message that is not in the chat — the message is looked up in
|
|
65
|
+
the store first, and a missing message (or one that belongs to another
|
|
66
|
+
chat) is refused instead of sent. Pinning a message that does not exist
|
|
67
|
+
got an account flagged, so the pin is only sent after the message is
|
|
68
|
+
found.
|
|
69
|
+
- **Poll vote in LID-addressed groups:** `sock.sendPollVote(...)` now
|
|
70
|
+
uses the bot's LID as the voter id when the poll is LID-addressed
|
|
71
|
+
(creator JID, participant or addressing mode is a LID); otherwise it
|
|
72
|
+
uses the phone JID as before. Receivers decrypt a vote with the voter
|
|
73
|
+
id from the vote message's key, so the wrong form made the vote
|
|
74
|
+
undecryptable and it never counted — the send still succeeded, which is
|
|
75
|
+
how the 2026-11-21 "Alice" poll showed a vote sent but stayed 0/0.
|
|
76
|
+
|
|
77
|
+
### Poll voting (2026-11-21)
|
|
78
|
+
|
|
79
|
+
No Baileys had a simple way to vote on a poll — every fork could only send a
|
|
80
|
+
vote that was already encrypted. The fork can now vote by option name:
|
|
81
|
+
|
|
82
|
+
- **`sock.sendPollVote(jid, pollCreationMessageKey, options, pollInfo)`**
|
|
83
|
+
encrypts the vote and sends it through the raw `pollUpdateMessage`
|
|
84
|
+
passthrough. `options` is one option name or a list of them;
|
|
85
|
+
`pollInfo.messageSecret` is the poll creation message's
|
|
86
|
+
`messageContextInfo.messageSecret`, and `pollInfo.creatorJid` defaults
|
|
87
|
+
to the author of the creation key. The fork does not look the creation
|
|
88
|
+
message up in any store.
|
|
89
|
+
- **`encryptPollVote(vote, ctx)`** (`src/Utils/process-message.ts`) is the
|
|
90
|
+
exact mirror of `decryptPollVote`: the same two-step HMAC-SHA256 key
|
|
91
|
+
derivation from the creation message's secret, AES-256-GCM with a random
|
|
92
|
+
12-byte IV and a 16-byte tag, over a `PollVoteMessage` of SHA-256 option
|
|
93
|
+
hashes — verified by round-trip tests against `decryptPollVote`.
|
|
94
|
+
- The receive side is unchanged: incoming votes are still not decrypted
|
|
95
|
+
live (the commented-out block stays as it is).
|
|
96
|
+
|
|
97
|
+
### Channel status publishing & management (2026-11-21)
|
|
98
|
+
|
|
99
|
+
Channel statuses can now be published and managed from the socket:
|
|
100
|
+
|
|
101
|
+
- **Send:** `sock.newsletterSendStatus(jid, content, options?)` posts a text, image, video or audio status to a channel and returns the server id (`newsletterStatusServerId`) to use for reactions and pins. Image/video statuses can be marked as a question (`question: true`) or as AI-generated content (`aiContent: true`); a question can be answered with `interactionType: 'question_response'` plus `parentServerId`.
|
|
102
|
+
- **React:** `sock.newsletterReactStatus(jid, serverId, emoji | null)` reacts to a status, or removes the reaction with `null`.
|
|
103
|
+
- **Revoke:** `sock.newsletterRevokeStatus(jid, statusId)` deletes a published status.
|
|
104
|
+
- **Fetch:** `sock.newsletterFetchStatus(jid, { count, before?, after? })` lists published statuses, paginated by server id.
|
|
105
|
+
|
|
106
|
+
### Polls: quiz, timed, add-option, vote passthrough (2026-11-21)
|
|
107
|
+
|
|
108
|
+
Poll creation now covers the newer poll shapes, all verified against the
|
|
109
|
+
app's own proto fields (PollCreationMessage fields 9-11, PollAddOptionMessage
|
|
110
|
+
field 121):
|
|
111
|
+
|
|
112
|
+
- **Quiz polls:** `poll: { pollType: 1, correctAnswer }` sends a quiz poll
|
|
113
|
+
(single-select only; the correct answer must be one of the values).
|
|
114
|
+
- **Timed polls:** `poll: { endTime, hideParticipantName, allowAddOption }`
|
|
115
|
+
sets the closing time (unix seconds, must be in the future), hides voter
|
|
116
|
+
names, and lets participants add their own options.
|
|
117
|
+
- **Add an option:** `sock.sendMessage(jid, { pollAddOption: { pollCreationMessageKey, option } })`
|
|
118
|
+
adds one option to an existing poll (the option hash is derived the same way
|
|
119
|
+
vote aggregation matches options). A raw `pollAddOptionMessage` passes
|
|
120
|
+
through untouched.
|
|
121
|
+
- **Vote update:** a raw `pollUpdateMessage` (pre-encrypted vote) passes
|
|
122
|
+
through untouched for callers that encrypted the vote themselves.
|
|
123
|
+
- **Alias:** `selectableOptionsCount` is accepted alongside the historic
|
|
124
|
+
`selectableCount` (the proto name wins if both are given).
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
### Fresh sessions resolve on their own (2026-11-20)
|
|
128
|
+
|
|
129
|
+
- **Fixed:** chat actions that need synced state (archive, pin, clear, status audience) now work on a freshly connected session without a manual step.
|
|
130
|
+
|
|
131
|
+
### Privacy, pins and statuses fixed (2026-11-20)
|
|
132
|
+
|
|
133
|
+
Several account and chat controls that did not work are now fixed:
|
|
134
|
+
|
|
135
|
+
- **Privacy settings:** `sock.updatePrivacySettings({ call, status, last, online, profile, groupadd, readreceipts, messages })` changes any combination of the eight settings in one call; each one is sent through its own privacy query and the rest are left alone.
|
|
136
|
+
- **Status audience default:** `sock.updateStatusDistributionMode(mode, userJids?)` sets the default audience for new statuses — contacts, allow list, deny list, or Close Friends (mode 3).
|
|
137
|
+
- **Pin and unpin chats:** `sock.pinChat(jid, pin?)` pins or unpins a chat; `sock.archiveChat(jid, archive, lastMessages)` archives or unarchives it.
|
|
138
|
+
- **Pin and unpin messages:** `sock.pinMessage(jid, key, duration?)` pins a message in a group or 1:1 chat (default 1 day, up to 30 days) and `sock.unpinMessage(jid, key)` removes it.
|
|
139
|
+
- **Personal status:** `sock.sendPersonalStatus(content, options?)` posts a status to `status@broadcast`.
|
|
140
|
+
- **Close Friends status:** `sock.sendCloseFriendsStatus(content, closeFriendJids, options?)` posts a status visible only to the given close friends (close-friends audience marker plus the recipient list).
|
|
141
|
+
- **Status viewing and reactions:** `sock.markStatusViewed(key, participant?)` marks a group or personal status as viewed, and `sock.reactToStatus(jid, key, emoji, statusJidList?)` reacts to a group or personal status.
|
|
142
|
+
|
|
143
|
+
### Native interactive buttons (2026-11-16)
|
|
144
|
+
|
|
145
|
+
Baileys can now send real interactive messages with native-flow buttons —
|
|
146
|
+
no third-party plugin needed. The `gifted-btns` npm package (mauricegift)
|
|
147
|
+
was checked as the reference for the mechanism, but its main file is
|
|
148
|
+
heavily obfuscated with an anti-tamper check, so it is NOT installed or run;
|
|
149
|
+
the same capability is implemented natively here, following the proven
|
|
150
|
+
chaeulso/baileys reference implementation.
|
|
151
|
+
|
|
152
|
+
- **Authoring:** `sock.sendMessage(jid, { text, footer, interactiveButtons: [...] })`
|
|
153
|
+
or the reference-style `nativeFlow` field (same shape). `interactiveButtons`
|
|
154
|
+
is an alias for `nativeFlow`.
|
|
155
|
+
- **Button kinds:** `{ id }` quick-reply, `{ copy }` copy-to-clipboard
|
|
156
|
+
(`cta_copy`), `{ url }` open link (`cta_url`, `useWebview` for an in-app
|
|
157
|
+
webview), `{ call }` dial (`cta_call`), `{ sections }` option sheet
|
|
158
|
+
(`single_select`), plus already-shaped `{ name, buttonParamsJson }` rows
|
|
159
|
+
passed through untouched. `text`/`buttonText` is the display text,
|
|
160
|
+
`icon` is upper-cased automatically. `offerText` (+ `offerUrl`,
|
|
161
|
+
`offerCode`, `offerExpiration`) adds a limited-time-offer banner and
|
|
162
|
+
`optionText` (+ `optionTitle`) a bottom sheet.
|
|
163
|
+
- **Media headers:** `image` / `video` / `document` / `location` /
|
|
164
|
+
`product` with a `caption` become the interactive header; any other media
|
|
165
|
+
(e.g. audio) is rejected with `Invalid media type for interactive message
|
|
166
|
+
header` (Boom 400). `audioFooter` attaches a voice-note footer, `bizJid`
|
|
167
|
+
/ `shopSurface` add collection / storefront headers.
|
|
168
|
+
- **Wire:** `relayMessage` auto-injects the `<biz>` binary node (mixed
|
|
169
|
+
native-flow v9, first-party-flow v2, `order_details` for
|
|
170
|
+
`review_and_pay`, product-list for `listMessage`, quality-control
|
|
171
|
+
always) whenever the message is an interactive shape, unless one is
|
|
172
|
+
already present; `addBizAttributes` on the relay options forces it
|
|
173
|
+
(secureMetaServiceLabel). `sendMessage` also adds the `bot` node
|
|
174
|
+
(`biz_bot: '1'`) for interactive messages in 1:1 chats; groups get only
|
|
175
|
+
the `biz` node.
|
|
176
|
+
- **API:** `prepareNativeFlowButtons`, `hasValidInteractiveHeader` and
|
|
177
|
+
`shouldIncludeBizBinaryNode` (Utils), `getBizBinaryNode` (WABinary), and
|
|
178
|
+
the `NativeFlowButton` / `NativeFlowButtonShorthand` /
|
|
179
|
+
`NativeFlowButtonRow` / `NativeFlowSection` types.
|
|
180
|
+
|
|
181
|
+
### Upstream catch-up (WhiskeySockets/Baileys, 2026-11-16)
|
|
182
|
+
|
|
183
|
+
Caught the fork up with upstream HEAD (bb0a87e) and 20 open upstream PRs.
|
|
184
|
+
Nothing here changes the fork's own features; these are upstream fixes
|
|
185
|
+
ported by hand (the fork is spacesocket-lineage, so no cherry-pick applies
|
|
186
|
+
cleanly).
|
|
187
|
+
|
|
188
|
+
- **Media downloads no longer fail on the `a.whatsapp.net` placeholder host**
|
|
189
|
+
(upstream a5c3ee7 / PR #2900) — some media messages carry a `url` on
|
|
190
|
+
`a.whatsapp.net`, which does not resolve, while their `directPath` is
|
|
191
|
+
valid. `extractHost` now returns `undefined` for that host so the
|
|
192
|
+
download falls back to `mmg.whatsapp.net`.
|
|
193
|
+
- **`WIN32` → `WIN_HYBRID`** in the connection validator (upstream 0af2386).
|
|
194
|
+
- **Poll result snapshot message field 114 → 115** (PR #2887) — WAProto
|
|
195
|
+
`pollResultSnapshotMessageV3` moved; proto, encoder and Message decoder
|
|
196
|
+
updated.
|
|
197
|
+
- **WhatsApp Web version bumped to `[2, 3000, 1054660005]`** (PR #2905) —
|
|
198
|
+
hardcoded fallback only; the bot fetches the live version at connect.
|
|
199
|
+
- **History-sync requests now carry `privacy_sensitive: '1'`** (PR #2853,
|
|
200
|
+
adapted — the fork routes peer-data operations through `sendPeerMessage`,
|
|
201
|
+
so the attribute is added there) or the server drops the request
|
|
202
|
+
silently. `fetchMessageHistory` also normalises `oldestMsgTimestamp`
|
|
203
|
+
(ms → s).
|
|
204
|
+
- **Pairing-code registration hardened** (PR #2872) — the link-code
|
|
205
|
+
companion-reg stanza is only processed at the `primary_hello` stage,
|
|
206
|
+
registration uses a proper nonce buffer, and a successful pairing now
|
|
207
|
+
sets `registered: true`.
|
|
208
|
+
- **Undecryptable own messages are acked, not retried** (PR #2864) — stops
|
|
209
|
+
a `<stream:error><ack/>` teardown when the bot cannot decrypt its own
|
|
210
|
+
message.
|
|
211
|
+
- **Socket close errors now include the close code/reason** (PR #2865).
|
|
212
|
+
- **Presence is only sent when the account name actually changed**
|
|
213
|
+
(PR #2789) — stops a nameless `<presence/>` marking the account online.
|
|
214
|
+
- **Auth state is written atomically** (PR #2855) — temp file + rename,
|
|
215
|
+
so a crash mid-write cannot corrupt `creds.json` and lose the session.
|
|
216
|
+
- **Community metadata accepts `<community>` or `<group>`** (PR #2808)
|
|
217
|
+
with a clear error when neither is present.
|
|
218
|
+
- **Buffered edits no longer clobber the upsert timestamp** (PR #2896).
|
|
219
|
+
- **Message receipts no longer overwrite the send timestamp** (PR #2879) —
|
|
220
|
+
receipts now arrive as a proper `message-receipt.update` event with
|
|
221
|
+
receipt/read/played timestamps.
|
|
222
|
+
- **View-once sends carry `<meta view_once="true"/>`** (PR #2837) — covers
|
|
223
|
+
retry resends too. This fixes *sending* view-once (`.toviewonce`); it
|
|
224
|
+
does not affect receiving others' view-once (`.vv`).
|
|
225
|
+
- **Retry resends no longer double-encrypt** (PR #2898) — the participant
|
|
226
|
+
is no longer added to the regular fan-out, and sessions are asserted
|
|
227
|
+
before the dedicated retry encryption.
|
|
228
|
+
- **Retry requests are charged once per accepted id** (PR #2892) — new
|
|
229
|
+
`acceptRetryIds` helper; not-from-me retry requests return early.
|
|
230
|
+
- **Sender-key map is set only from keys actually produced** (PR #2891).
|
|
231
|
+
- **Retry counts are restored, never lowered** (PR #2888) — new
|
|
232
|
+
`restoreRetryCount`; the fallback path no longer deletes the cache key
|
|
233
|
+
at the limit.
|
|
234
|
+
- **Retry resends use LID-aware addressing** (PR #2856) — new
|
|
235
|
+
`isOwnDeviceJid` / `buildRetryResendAddressing`; our own device is
|
|
236
|
+
matched by LID, not just the user part.
|
|
237
|
+
- **Media re-upload works for JSON-persisted messages** (PR #2835) —
|
|
238
|
+
media-retry keys accept a base64 string as well as a buffer, and an
|
|
239
|
+
expired link (403 with an expired `oe` signature) or a 404/410 now
|
|
240
|
+
triggers a re-upload instead of failing.
|
|
241
|
+
- **Channel statuses are acked** (PR #2883, adapted) — a contact's status
|
|
242
|
+
stanza is now acked via `sendMessageAck` when it carries no newsletter
|
|
243
|
+
payload, or the server kills the stream ~50 minutes later. Newsletter
|
|
244
|
+
statuses stay un-acked (the fork's deliberate design). The offline node
|
|
245
|
+
processor now handles the `status` type.
|
|
246
|
+
- **Newsletter media uploads use the newsletter paths** (PR #2434) —
|
|
247
|
+
`NEWSLETTER_MEDIA_PATH_MAP` (`/newsletter/newsletter-*`), server
|
|
248
|
+
thumbnail generation (`server_thumb_gen=1`) and transcoding for
|
|
249
|
+
video/gif/ptv, and the upload result returns `thumbnailDirectPath` /
|
|
250
|
+
`thumbnailSha256`; newsletter messages now carry those fields and omit
|
|
251
|
+
`url` (directPath only).
|
|
252
|
+
|
|
253
|
+
### Bug Fixes
|
|
254
|
+
|
|
255
|
+
- **Group history bundles now encrypt with the `group-history` media type** —
|
|
256
|
+
`sendGroupHistory` encrypted the bundle file as `document` media (HKDF info
|
|
257
|
+
"WhatsApp Document Keys"), but the official client uses a dedicated
|
|
258
|
+
`group-history` media type whose HKDF info is literally "Group History"
|
|
259
|
+
(WhatsApp APK 2.26.45.71, `C14030jh.java` MmsType table). The recipient's
|
|
260
|
+
phone derives the bundle keys with "Group History", so the bot's file
|
|
261
|
+
decrypted to garbage, the SHA-256 check failed and the bundle was silently
|
|
262
|
+
dropped — and the phone only creates the history notice after a successful
|
|
263
|
+
import, so no notice from the bot ever appeared (the server still acked the
|
|
264
|
+
send, and WhatsApp Web showed the raw notice). `MEDIA_HKDF_KEY_MAPPING` /
|
|
265
|
+
`MEDIA_PATH_MAP` gained a `group-history` entry, `hkdfInfoKey` returns the
|
|
266
|
+
literal "Group History" for it, and `sendGroupHistory` now encrypts and
|
|
267
|
+
uploads with that type. Nothing else in the bundle changed (Ft1 encoding,
|
|
268
|
+
bundle/notice proto fields and metadata were already correct).
|
|
269
|
+
|
|
270
|
+
- **Group member tag / role changes (`modify`) now emit `group-participants.update`** —
|
|
271
|
+
the `w:g2` `modify` notification (member tag / admin-role change, confirmed
|
|
272
|
+
as a recognised action in the official app's GroupNotificationHandler —
|
|
273
|
+
WhatsApp APK 2.26.45.71, `C1S4.java:31035`) was reduced to bare JID strings
|
|
274
|
+
in `handleGroupNotification`, and `process-message` then `JSON.parse`d each
|
|
275
|
+
param, which throws on a bare JID — so the `modify` event never fired and
|
|
276
|
+
the bot's membership-tag handler never ran. `handleGroupNotification` now
|
|
277
|
+
builds the same full participant objects as promote/demote/add
|
|
278
|
+
(`{ id, phoneNumber, lid, username, admin }`, JSON-stringified into
|
|
279
|
+
`messageStubParameters`), and the `CHANGE_NUMBER` case parses defensively
|
|
280
|
+
(bare JID falls back to `{ id }` instead of throwing). Verified with a
|
|
281
|
+
synthetic `processMessage` test: bare-JID and JSON-object params both emit
|
|
282
|
+
`group-participants.update` with action `modify` and the participant
|
|
283
|
+
attributes intact.
|
|
284
|
+
|
|
285
|
+
### Features
|
|
286
|
+
|
|
287
|
+
- **Member tag (`modify`) now carries the tag text** — `groupParticipantsUpdate`
|
|
288
|
+
gained an optional 4th `tag` argument: for the `modify` action a non-empty
|
|
289
|
+
tag is sent as a `tag` attribute on the `<participant>` node
|
|
290
|
+
(`<modify><participant jid="..." tag="TEXT"/></modify>`), matching the
|
|
291
|
+
official app's member-tag flow (WhatsApp APK 2.26.45.71: the tag is a
|
|
292
|
+
free-text label, max 30 chars, stored on the participant record
|
|
293
|
+
`C13710jB.A04`, read from group metadata via
|
|
294
|
+
`GroupParticipantsManager.getMemberTag`, and set through the group request
|
|
295
|
+
layer — `C2JZ.A00` → `C17232wK.A00`, empty text = clear). Omitting the
|
|
296
|
+
tag sends the bare modify (clear). `GroupParticipant` gained a `tag`
|
|
297
|
+
field, and `extractGroupMetadata` + `handleGroupNotification` now parse
|
|
298
|
+
`attrs.tag`, so tags set in the official app show up in group metadata
|
|
299
|
+
instead of being dropped. The official client only ever sets its OWN tag;
|
|
300
|
+
setting another member's tag is unproven and left to the live test.
|
|
301
|
+
|
|
302
|
+
- **Link preview on group statuses** (`sock.sendGroupStatus()`) — a text
|
|
303
|
+
group status containing a URL now gets the same link preview card
|
|
304
|
+
(title / description / thumbnail) a regular message would. `sendMessage`
|
|
305
|
+
already wired `getUrlInfo` into `generateWAMessage`; `sendGroupStatus`
|
|
306
|
+
did not, so statuses never got a preview. The socket's link-preview
|
|
307
|
+
config (`linkPreviewImageThumbnailWidth`,
|
|
308
|
+
`generateHighQualityLinkPreview`, HTTP `options`, `logger`) is now
|
|
309
|
+
passed through `GroupStatusDeps` and into `generateWAMessageContent`,
|
|
310
|
+
exactly like `sendMessage`. No new API: `sendGroupStatus(jid, { text:
|
|
311
|
+
'see https://example.com' })` just works.
|
|
312
|
+
|
|
313
|
+
|
|
314
|
+
- **Group history sharing** (`sock.sendGroupHistory()`) — the native
|
|
315
|
+
`messageHistoryBundle` flow WhatsApp's own client uses when an admin
|
|
316
|
+
adds a member (last 25–100 messages, E2EE). Reverse-engineered from
|
|
317
|
+
the WhatsApp Android APK: the history is an encrypted bundle file
|
|
318
|
+
(Ft1 protobuf of WebMessageInfo entries) uploaded as document media,
|
|
319
|
+
then a `messageHistoryBundle` message plus a `messageHistoryNotice`
|
|
320
|
+
record are sent into the group; the receivers' clients download,
|
|
321
|
+
decrypt and import the bundle. A standalone notice on its own is
|
|
322
|
+
dropped by the server — the bundle file is the actual history. No
|
|
323
|
+
public Baileys fork, whatsmeow or other library had implemented this
|
|
324
|
+
(re-verified Sep 2026); this is the first native implementation.
|
|
325
|
+
|
|
326
|
+
```ts
|
|
327
|
+
await sock.sendGroupHistory('120363432773315685@g.us', ['109771495633133@lid'], messages)
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
`messages` are full `proto.IWebMessageInfo` objects (key + content +
|
|
331
|
+
timestamp). The bundle is encrypted with the document media keys and
|
|
332
|
+
uploaded to `/mms/document`. Live test 2026-11-13 ~12:4x EAT (VPS,
|
|
333
|
+
baba hany → tester group, 5 messages to new member
|
|
334
|
+
109771495633133@lid): **bundle + notice both sent and visible in the
|
|
335
|
+
group** (bundle 3EB06BAF5CC794022D0095, notice 3EB0254E19B3B9BC0E7BCD,
|
|
336
|
+
directPath `/v/t62.7119-24/794138976_3019077851787904_904926531635696930`).
|
|
337
|
+
Whether the new member's client imported the history is pending the
|
|
338
|
+
user's check on his phone.
|
|
339
|
+
|
|
340
|
+
- **Delete and clear chat** (`sock.clearChat()`, `sock.deleteChat()`,
|
|
341
|
+
`sock.deleteMessage()`, `sock.deleteMessageForMe()`)
|
|
342
|
+
|
|
343
|
+
`deleteMessage(jid, key)` deletes a message for everyone (revoke; in
|
|
344
|
+
a group an admin can delete someone else's message).
|
|
345
|
+
`deleteMessageForMe(jid, key, timestamp, deleteMedia?)` deletes one
|
|
346
|
+
message for yourself only. `clearChat(jid, lastMessages)` removes
|
|
347
|
+
the WHOLE conversation — all its messages — for you, the chat stays
|
|
348
|
+
in the list; this is not deleting one message. `clearChat` takes an
|
|
349
|
+
optional third argument `{ deleteStarred: false }` to keep starred
|
|
350
|
+
messages — the app's "Clear starred messages" checkbox unticked;
|
|
351
|
+
by default starred messages are cleared too. `deleteChat(jid,
|
|
352
|
+
lastMessages)` removes the whole chat for you. The chat functions
|
|
353
|
+
are named wrappers around the existing `chatModify` app-state
|
|
354
|
+
patches (same pattern as `star`). `lastMessages` is the chat's
|
|
355
|
+
messages (at least the latest one) — the server clears everything
|
|
356
|
+
up to the last message's timestamp, so pass the latest message to
|
|
357
|
+
clear the whole conversation.
|
|
358
|
+
|
|
359
|
+
```ts
|
|
360
|
+
await sock.deleteMessage('254143947797@s.whatsapp.net', msg.key)
|
|
361
|
+
await sock.deleteMessageForMe('254143947797@s.whatsapp.net', msg.key, msg.messageTimestamp)
|
|
362
|
+
await sock.clearChat('254143947797@s.whatsapp.net', [latestMessage])
|
|
363
|
+
await sock.deleteChat('254143947797@s.whatsapp.net', [latestMessage])
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
Live test 2026-11-10 07:53 EAT (VPS, sikimo.254 → baba hany):
|
|
367
|
+
**delete for everyone works** — test message 3EB06041462A45DD1CC03B
|
|
368
|
+
sent and revoked. The other three are **blocked, not by the code**
|
|
369
|
+
(unit tests 5/5 pass, patches are well-formed) but by the session:
|
|
370
|
+
the app-state sync key (`myAppStateKeyId` AAAAAKKa) was never
|
|
371
|
+
shared to Baileys — the session was imported from CASPER-XD-ULTRA,
|
|
372
|
+
so `session/` has no `app-state-sync-key` file and `appPatch`
|
|
373
|
+
fails with `myAppStateKey ("AAAAAKKa") not present`. A full
|
|
374
|
+
`resyncAppState` + 60s wait did not make the phone share the key;
|
|
375
|
+
it is only shared when a companion links. To live-test those
|
|
376
|
+
three, Baileys needs to link via pairing code so the phone shares
|
|
377
|
+
the key. Research 2026-11-10 (online code + decompiled APK)
|
|
378
|
+
confirmed there is **no other way** to clear a chat: every library
|
|
379
|
+
uses this same app-state patch, and the app's own `ClearChatMutation`
|
|
380
|
+
matches it exactly — so the blocker is the missing key, not the
|
|
381
|
+
function.
|
|
382
|
+
|
|
383
|
+
- **Clear done on another device is now surfaced** (`chats.update` with empty `messages`)
|
|
384
|
+
|
|
385
|
+
Incoming app-state patches flow through `processSyncAction`, which
|
|
386
|
+
already emitted `deleteChatAction` as `chats.delete` and
|
|
387
|
+
`archiveChatAction` as `chats.update`, but had no branch for
|
|
388
|
+
`clearChatAction` — a clear from another device was decoded and
|
|
389
|
+
silently dropped. A `clearChatAction` now emits `chats.update` with
|
|
390
|
+
`[{ id, messages: [] }]` (the empty `messages` is the "cleared"
|
|
391
|
+
signal), gated on non-initial sync like the delete branch. Live
|
|
392
|
+
retest 2026-11-11 confirmed Baileys surfaces no discrete clear
|
|
393
|
+
event from another device — only a generic app-state `server_sync`
|
|
394
|
+
notice — so this branch also needs the app-state sync key to
|
|
395
|
+
decrypt the patch before it can fire; unit tests 3/3 pass.
|
|
396
|
+
|
|
397
|
+
- **Ask the phone for a missing app-state sync key** (`sock.requestAppStateSyncKey(keyIds)`)
|
|
398
|
+
|
|
399
|
+
Sends a peer `APP_STATE_SYNC_KEY_REQUEST` protocol message to our
|
|
400
|
+
own JID — the same shape whatsmeow sends (`appstate.go`
|
|
401
|
+
`requestAppStateKeys` via `SendPeerMessage`). Baileys already
|
|
402
|
+
handles the expected answer, `APP_STATE_SYNC_KEY_SHARE`, by storing
|
|
403
|
+
the key and emitting `creds.update` with `myAppStateKeyId`. The
|
|
404
|
+
general peer-message sender was factored out as `sock.sendPeerMessage()`
|
|
405
|
+
(the existing `sendPeerDataOperationMessage` now uses it; the TODO in
|
|
406
|
+
`messages-send.ts` calling for exactly this is resolved). Key IDs are
|
|
407
|
+
the base64 IDs Baileys uses, e.g. `['AAAAAKKZ', 'AAAAAKKa']` — the
|
|
408
|
+
rotated current key first, then the old one. Runner script
|
|
409
|
+
`request-appstate-key.js` sends the request and watches 90s for the
|
|
410
|
+
key file to appear. **Unproven, not a fix yet:** nobody has published
|
|
411
|
+
proof the phone answers this for a rotated key on an imported session,
|
|
412
|
+
and WhatsApp throttles it to one request per key per 24h — run at most
|
|
413
|
+
once a day. If no key arrives, re-linking via pairing code remains the
|
|
414
|
+
documented fix. Unit test: wire shape 2/2 pass (key bytes round-trip).
|
|
415
|
+
|
|
416
|
+
```ts
|
|
417
|
+
await sock.requestAppStateSyncKey(['AAAAAKKZ', 'AAAAAKKa'])
|
|
418
|
+
```
|
|
419
|
+
|
|
420
|
+
- **Full-image profile picture (uncropped DP)** — `generateProfilePicture`
|
|
421
|
+
now takes `options: { full?: boolean; width?; height?; quality? }`,
|
|
422
|
+
passed through `sock.updateProfilePicture(jid, content, options)`.
|
|
423
|
+
With `{ full: true }` the image goes up **as it is — no crop, no
|
|
424
|
+
padding, no background**: a JPEG within the server's limit is sent
|
|
425
|
+
byte-for-byte, anything else is converted to JPEG at quality 92.
|
|
426
|
+
WhatsApp rejects profile pictures whose longest side is over 640
|
|
427
|
+
(`not-acceptable`), so a bigger image is scaled down to fit 640
|
|
428
|
+
with the aspect ratio kept and nothing cut off. Jimp is **0.16.3**
|
|
429
|
+
(downgraded from 1.6.1 at the user's direction) and is preferred
|
|
430
|
+
over sharp for this; `extractImageThumb` was updated to the 0.16.3
|
|
431
|
+
API as well. The default (no options) is the standard Baileys
|
|
432
|
+
behaviour: 640×640 center crop, quality 50.
|
|
433
|
+
|
|
434
|
+
```ts
|
|
435
|
+
await sock.updateProfilePicture(sock.user.id, imageBuffer, { full: true })
|
|
436
|
+
```
|
|
437
|
+
|
|
438
|
+
Live-tested 2026-11-10 08:10 EAT: the user's own 1008×2304 photo
|
|
439
|
+
(IMG-20261109-WA1104.jpg) was set as sikimo.254's DP with
|
|
440
|
+
`{ full: true }` — it was scaled to 280×640 to fit the server's
|
|
441
|
+
640 limit and accepted. Earlier probes showed the 1008×2304
|
|
442
|
+
original and a 447×1024 version are both rejected
|
|
443
|
+
(`not-acceptable`), while a 280×640 version is accepted, so 640 on
|
|
444
|
+
the longest side is the server's limit. The earlier
|
|
445
|
+
contain+white-padding version was rejected by the user and replaced
|
|
446
|
+
by this.
|
|
447
|
+
|
|
448
|
+
- **Payment messages** (`sock.requestPayment()`, `sock.sendPayment()`, `sock.declinePaymentRequest()`, `sock.cancelPaymentRequest()`, `sock.sendPaymentInvite()`)
|
|
449
|
+
|
|
450
|
+
Sends WhatsApp payment cards: a payment request (`requestPaymentMessage`
|
|
451
|
+
with amount, currency, note and a 7-day expiry as the app uses), a
|
|
452
|
+
payment against a request (`sendPaymentMessage`, referencing the
|
|
453
|
+
request's key), declining or cancelling a request, and inviting someone
|
|
454
|
+
to a payment service (`paymentInviteMessage`: 1 = FBPAY, 2 = NOVI,
|
|
455
|
+
3 = UPI). Amounts are given in the currency's major units (500 =
|
|
456
|
+
500 KES) and sent as `amount1000` (thousandths) plus a `Money` value
|
|
457
|
+
in the currency's minor units (2 decimals by default, 0 for JPY/KRW,
|
|
458
|
+
3 for KWD/BHD). The background is a colour/id background only in v1
|
|
459
|
+
(no image upload). This only sends the request/message — moving money
|
|
460
|
+
still needs a payment provider; the library does not settle it.
|
|
461
|
+
|
|
462
|
+
```ts
|
|
463
|
+
await sock.requestPayment('254143947797@s.whatsapp.net', {
|
|
464
|
+
amount: 500,
|
|
465
|
+
currency: 'KES',
|
|
466
|
+
note: 'lunch money'
|
|
467
|
+
})
|
|
468
|
+
```
|
|
469
|
+
|
|
470
|
+
Live-tested 2026-11-10 on the VPS: a 100 KES request ("spacesocket
|
|
471
|
+
payment test") sent from sikimo.254 to baba hany — the server
|
|
472
|
+
accepted it (message id 3EB00BA765F8DB265415EC). Whether it renders
|
|
473
|
+
as a proper payment request card on the phone is still to be
|
|
474
|
+
confirmed by the user.
|
|
475
|
+
|
|
476
|
+
- **Send sticker packs** (`sock.sendStickerPack(jid, pack)`)
|
|
477
|
+
|
|
478
|
+
Sends a whole sticker pack — up to 60 WebP stickers plus a tray icon —
|
|
479
|
+
as one `stickerPackMessage` the receiver can add to their sticker
|
|
480
|
+
collection. The pack is zipped in-memory (new dependency-free STORE
|
|
481
|
+
writer in `src/Utils/zip.ts`, with CRC-32), uploaded as media type
|
|
482
|
+
`sticker-pack`, and the tray icon is uploaded as
|
|
483
|
+
`thumbnail-sticker-pack`, encrypted under the pack's own mediaKey (the
|
|
484
|
+
proto carries no separate key for it, so the receiver derives it from
|
|
485
|
+
the pack's key — `encryptedStream` now accepts a `mediaKey` option for
|
|
486
|
+
this). Both media types are registered in `src/Defaults` with the
|
|
487
|
+
HKDF info strings from the official app ("WhatsApp Sticker Pack Keys"
|
|
488
|
+
/ "WhatsApp Sticker Pack Thumbnail Keys") and the `/mms/sticker-pack`
|
|
489
|
+
upload path. The wire shape follows the app's `FMessageStickerPack`
|
|
490
|
+
builder: pack id, name, publisher, description, per-sticker metadata
|
|
491
|
+
(file name in the ZIP, emojis, animated/lottie flags), the pack ZIP's
|
|
492
|
+
hashes/direct path, and the tray icon's direct path + hashes
|
|
493
|
+
(thumbnail fixed at 252x252, as the app does).
|
|
494
|
+
|
|
495
|
+
```ts
|
|
496
|
+
await sock.sendStickerPack('254143947797@s.whatsapp.net', {
|
|
497
|
+
name: 'My Pack',
|
|
498
|
+
publisher: 'spacesocket',
|
|
499
|
+
description: 'a test pack',
|
|
500
|
+
stickers: [
|
|
501
|
+
{ data: stickerWebpBuffer, emojis: ['😀'] },
|
|
502
|
+
{ data: animatedWebpBuffer, emojis: ['😂'], isAnimated: true }
|
|
503
|
+
],
|
|
504
|
+
trayIcon: trayIconPngBuffer
|
|
505
|
+
})
|
|
506
|
+
```
|
|
507
|
+
|
|
508
|
+
Live-tested 2026-11-10 on the VPS: a 3-sticker pack ("spacesocket
|
|
509
|
+
test", tray icon) sent from sikimo.254 to baba hany — the server
|
|
510
|
+
accepted it (message id 3EB047F4BEBAD498E3A91B), and the user
|
|
511
|
+
confirmed it renders as a proper pack on his phone.
|
|
512
|
+
|
|
513
|
+
- **LID ↔ phone-number mapping** (`sock.getPNForLID()`, `sock.getLIDForPN()`, `sock.getPNsForLIDs()`, `sock.getLIDsForPNs()`)
|
|
514
|
+
|
|
515
|
+
WhatsApp now addresses users by LID (a long-lived id) instead of their
|
|
516
|
+
phone number, and the two are only linked by a mapping the client
|
|
517
|
+
learns. The mapping store (`LIDMappingStore`) already existed, but the
|
|
518
|
+
lookups were buried in `sock.signalRepository.lidMapping`, and
|
|
519
|
+
`getPNForLID` returned the phone number with a `:0` device suffix
|
|
520
|
+
(`254181847643:0@s.whatsapp.net`) while `getLIDForPN` returned the LID
|
|
521
|
+
without one — so a plain `===` comparison against the phone number
|
|
522
|
+
failed. Fixed: device 0 is now omitted on the PN side too, matching
|
|
523
|
+
the LID side. The four lookups are now first-class socket functions.
|
|
524
|
+
|
|
525
|
+
- `sock.getPNForLID(lid)` — phone number for a LID, or `null`. Learned
|
|
526
|
+
only: the server does not disclose a phone number for a LID, so an
|
|
527
|
+
unlearned LID stays `null` (verified live: a username that resolves
|
|
528
|
+
to a LID with no shared history gives `null`).
|
|
529
|
+
- `sock.getLIDForPN(pn)` — LID for a phone number, or `null`. This one
|
|
530
|
+
has a server fallback: when the store misses, it asks the server via
|
|
531
|
+
USync and stores the answer.
|
|
532
|
+
- `sock.getPNsForLIDs(lids)` / `sock.getLIDsForPNs(pns)` — batch versions.
|
|
533
|
+
|
|
534
|
+
Mappings are learned from messages where both appear (group messages
|
|
535
|
+
carry `participant` LID + `participantAlt` phone number; 1:1 envelopes
|
|
536
|
+
carry the sender's LID alongside the chat's phone number) and persist
|
|
537
|
+
in the auth state (`lid-mapping` keys), so they survive restarts.
|
|
538
|
+
|
|
539
|
+
Live-tested 2026-11-09 on the VPS from baba hany's session: after
|
|
540
|
+
sikimo.254 sent a message to baba hany, `getPNForLID` on sikimo's LID
|
|
541
|
+
returned the phone number in canonical form and `getLIDForPN` returned
|
|
542
|
+
the LID back — the mapping works both ways. A LID with no shared
|
|
543
|
+
history still returns `null`, as designed.
|
|
544
|
+
|
|
545
|
+
- **WhatsApp usernames** (`sock.checkUsername()`, `sock.getMyUsername()`, `sock.findUserByUsername()`, and more)
|
|
546
|
+
|
|
547
|
+
The `@username` handles, separate from phone numbers: check availability,
|
|
548
|
+
claim one, and look people up by theirs. Implemented from the public
|
|
549
|
+
Baileys forks' username API (MEX queries + USync), not from the flagged
|
|
550
|
+
`@jexkcode/baileys` package.
|
|
551
|
+
|
|
552
|
+
- `sock.checkUsername(username)` — availability check via MEX
|
|
553
|
+
(`xwa2_username_check`); returns `{ available, username, session_id }`,
|
|
554
|
+
plus `suggestions` and `rejectionReasons` when taken.
|
|
555
|
+
- `sock.checkUsernameMulti(usernames)` — check several at once
|
|
556
|
+
(`xwa2_username_check_multi`).
|
|
557
|
+
- `sock.setUsername(username, { source, sessionId, pin })` — claim a
|
|
558
|
+
username (`xwa2_username_set`, `reserved: true`).
|
|
559
|
+
- `sock.deleteUsername()` — give up the account's username
|
|
560
|
+
(`xwa2_username_delete`).
|
|
561
|
+
- `sock.getMyUsername()` — this account's username, or `null`
|
|
562
|
+
(`xwa2_username_get`).
|
|
563
|
+
- `sock.getUsernameRecommendations(source?)` — suggestions for this account
|
|
564
|
+
(`xwa2_username_get_recommendations`).
|
|
565
|
+
- `sock.setUsernamePin(pin | null)` — set or clear the username PIN
|
|
566
|
+
(`xwa2_username_pin_set`).
|
|
567
|
+
- `sock.findUserByUsername(username, pin?)` — resolve a username to a JID
|
|
568
|
+
via USync (`contact` protocol with the username; returns
|
|
569
|
+
`{ jid, contact }` or `null`).
|
|
570
|
+
- `sock.fetchContactUsernames(...jids)` — look up usernames for JIDs via
|
|
571
|
+
USync (`username` protocol).
|
|
572
|
+
- `sock.setUsernameQueryIds({ ... })` — patch the MEX query IDs at runtime.
|
|
573
|
+
WhatsApp rotates these server-side, so a stale ID shows up as a
|
|
574
|
+
`GraphQL server error: Bad Request`; patching avoids a new release.
|
|
575
|
+
The current IDs are exported as `sock.USERNAME_QUERY_IDS`.
|
|
576
|
+
|
|
577
|
+
Live-tested 2026-11-09 on the VPS: `checkUsername('courtney')` → taken
|
|
578
|
+
(suggestions `courtney132`, `courtney838`, `courtney969`),
|
|
579
|
+
`checkUsername('spacesocket_test_xyz_987')` → free,
|
|
580
|
+
`getMyUsername()` → the test account's own username,
|
|
581
|
+
`findUserByUsername('courtney')` → `null` (a taken username is not always
|
|
582
|
+
resolvable without its PIN), `fetchContactUsernames` on baba hany →
|
|
583
|
+
no username set. Only read-only calls were tested live; `setUsername`,
|
|
584
|
+
`deleteUsername` and `setUsernamePin` change account state and were not
|
|
585
|
+
run.
|
|
586
|
+
|
|
587
|
+
- **Channel statuses — receive and send** (`newsletter.status` event and `sock.sendChannelStatus()`)
|
|
588
|
+
|
|
589
|
+
Channel statuses are the temporary (24h) updates a channel admin posts from
|
|
590
|
+
the channel. They are **not** channel messages (`sock.sendMessage` to the
|
|
591
|
+
`@newsletter` JID) and **not** personal statuses (`sock.sendMessage` to
|
|
592
|
+
`status@broadcast`). They were previously invisible to this library: no
|
|
593
|
+
function, no event, no proto field, and no MEX query existed for them.
|
|
594
|
+
|
|
595
|
+
#### Wire format (captured live 2026-11-09, Techword 401🦅)
|
|
596
|
+
|
|
597
|
+
A channel status arrives as a top-level `<status>` stanza from the channel's
|
|
598
|
+
`@newsletter` JID — not as a `<message>`:
|
|
599
|
+
|
|
600
|
+
```xml
|
|
601
|
+
<status from="120363331321673219@newsletter" type="text"
|
|
602
|
+
id="3EB079CA1FB41899DF027B" t="1794223368" server_id="136">
|
|
603
|
+
<plaintext><!-- proto.Message bytes --></plaintext>
|
|
604
|
+
</status>
|
|
605
|
+
```
|
|
606
|
+
|
|
607
|
+
The `<plaintext>` child holds a plain `proto.Message` (same encoding as a
|
|
608
|
+
newsletter message): a text status is an `extendedTextMessage` (text,
|
|
609
|
+
`backgroundArgb`, `font`), an image status an `imageMessage`, an audio
|
|
610
|
+
status an `audioMessage`; `messageContextInfo` carries a `messageSecret`.
|
|
611
|
+
Delivered statuses also carry `contextInfo.statusAttributions` with
|
|
612
|
+
`type: 9` (`NEWSLETTER_STATUS` — that value is not in `WAProto.proto` yet,
|
|
613
|
+
which only goes up to `LAYOUTS = 8`).
|
|
614
|
+
|
|
615
|
+
Sending mirrors the delivery format: a top-level `<status>` stanza **to**
|
|
616
|
+
the channel JID, same `<plaintext>` payload, id from
|
|
617
|
+
`generateMessageIDV2`. The server assigns `t` and `server_id`.
|
|
618
|
+
|
|
619
|
+
#### Receive
|
|
620
|
+
|
|
621
|
+
- New `ChannelStatus` type (`src/Types/ChannelStatus.ts`): `id`,
|
|
622
|
+
`channelJid`, `type`, `serverId`, `messageTimestamp`, `offline`, `text`,
|
|
623
|
+
`backgroundArgb`, `font`, `message`.
|
|
624
|
+
- New `decodeChannelStatus(node)` (`src/Socket/channelStatus.ts`) and new
|
|
625
|
+
`'newsletter.status'` event (`src/Types/Events.ts`), wired up in
|
|
626
|
+
`src/Socket/messages-recv.ts` via `ws.on('CB:status', ...)`. No ack is
|
|
627
|
+
sent — the socket delivers live and offline stanzas without it.
|
|
628
|
+
- The handler does not go through the offline processor (its `MessageType`
|
|
629
|
+
is only `'message' | 'call' | 'receipt' | 'notification'`).
|
|
630
|
+
- `proto.Message.decode` is used without `.toJSON()`: `toJSON()` turns the
|
|
631
|
+
font enum `0` into the string `'SYSTEM'`.
|
|
632
|
+
|
|
633
|
+
#### Send
|
|
634
|
+
|
|
635
|
+
```ts
|
|
636
|
+
await sock.sendChannelStatus(channelJid, { text: 'Hello' }, { backgroundColor: '#ff0000', font: 2 })
|
|
637
|
+
await sock.sendChannelStatus(channelJid, { image: buffer, caption: 'Photo' })
|
|
638
|
+
await sock.sendChannelStatus(channelJid, { audio: buffer, mimetype: 'audio/ogg; codecs=opus', ptt: true })
|
|
639
|
+
```
|
|
640
|
+
|
|
641
|
+
`sendChannelStatus(jid, content, options)` (`src/Socket/channelStatus.ts`,
|
|
642
|
+
wired into `src/Socket/messages-send.ts` next to `sendGroupStatus`) accepts
|
|
643
|
+
the same content shapes as `sendMessage`. Options: `backgroundColor` for
|
|
644
|
+
text statuses, `font` for text. Returns `{ id, channelJid, message }`.
|
|
645
|
+
|
|
646
|
+
#### How to tell whether a post published
|
|
647
|
+
|
|
648
|
+
The server's ack for the `<status>` stanza tells you:
|
|
649
|
+
|
|
650
|
+
- ack **with `server_id`** (and no `error`) — the status was published.
|
|
651
|
+
Proven live on Techword 401🦅, server ids 139–142, each then delivered
|
|
652
|
+
back to a follower socket as a `newsletter.status` event.
|
|
653
|
+
- ack **without `server_id`** (and no `error`) — the stanza was accepted
|
|
654
|
+
but the status was **not** published. Seen on a brand-new channel
|
|
655
|
+
created via `newsletterCreate` ("Baileys Test Channel",
|
|
656
|
+
`120363412722391397@newsletter`): four posts acked clean and never
|
|
657
|
+
appeared anywhere. A new channel created through the API apparently
|
|
658
|
+
does not have the server-gated channel-status feature enabled.
|
|
659
|
+
- ack with `error: '401'` — the sender is not an admin/owner of the
|
|
660
|
+
channel (only admins can post a channel status).
|
|
661
|
+
- ack with `error: '479'` — the stanza carried a client-set `t`
|
|
662
|
+
attribute; `t` must be left for the server to assign.
|
|
663
|
+
|
|
664
|
+
A `<message>` stanza to the channel JID — even with a
|
|
665
|
+
`statusAttributions: [{ type: 9 }]` context — is accepted as a **regular
|
|
666
|
+
channel message** (ack class `message`, with a `server_id`), not a status.
|
|
667
|
+
A `<status>` stanza with the same attribution acks clean as a status.
|
|
668
|
+
|
|
669
|
+
#### Tests
|
|
670
|
+
|
|
671
|
+
- `src/__tests__/Socket/channel-status.test.ts`: 5 tests — decode of a
|
|
672
|
+
text stanza, offline backlog marking, ignoring non-newsletter stanzas,
|
|
673
|
+
ignoring stanzas with no plaintext, and a send test asserting the stanza
|
|
674
|
+
shape and that it round-trips through the decoder.
|
|
675
|
+
- Live-tested on Techword 401🦅 (2026-11-09): text, coloured text
|
|
676
|
+
(`#ff0000`, font 2), image, and audio statuses all published
|
|
677
|
+
(server ids 139–142) and received by a follower socket.
|
|
678
|
+
|
|
679
|
+
- **Channel auto-react example** (`Example/channel-auto-react.ts`)
|
|
680
|
+
|
|
681
|
+
Follows a channel and reacts to each new post with a random emoji,
|
|
682
|
+
after a random delay of 45s–3min so reactions do not land instantly.
|
|
683
|
+
Uses the built-in `sock.newsletterFollow` and
|
|
684
|
+
`sock.newsletterReactMessage` (the reaction is a `<message
|
|
685
|
+
type="reaction">` IQ carrying the post's `server_id`). Run with the
|
|
686
|
+
channel JID as an argument — never hardcode a channel into a shared
|
|
687
|
+
script. Skips your own posts and posts without a `server_id`.
|
|
688
|
+
|
|
689
|
+
### Fixed
|
|
690
|
+
|
|
691
|
+
- **`getStatusCodeForMediaRetry` broke `npm run build`:** it indexed the
|
|
692
|
+
retry-status map with a plain `number`, which `tsc` rejects (TS7053).
|
|
693
|
+
The lookup is now typed to the map's keys; runtime behaviour is
|
|
694
|
+
unchanged.
|
|
695
|
+
|
|
696
|
+
# 7.0.0-rc14 (2026-07-29)
|
package/README.md
CHANGED
|
@@ -1,25 +1,71 @@
|
|
|
1
|
-
#
|
|
1
|
+
# xspacesocket
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+

|
|
4
|
+
|
|
5
|
+
`xspacesocket` is a Baileys fork maintained by **XCASPER SPACE**. It preserves the upstream API while adding polls and poll voting, channels, app-state controls, view-once recovery, native buttons, and more.
|
|
6
|
+
> **Migrating from `whiskeysockets/baileys`?** You do **not** need to rename your imports. npm uses the dependency key in your `package.json` as the import name, so change one line to the npm alias and your existing imports keep working unchanged:
|
|
7
|
+
|
|
8
|
+
```json
|
|
9
|
+
"@whiskeysockets/baileys": "npm:xspacesocket"
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
If your bot imports from `'baileys'`, use `"baileys": "npm:xspacesocket"` instead. Aliases only work for registry packages, not git dependencies.
|
|
13
|
+
|
|
14
|
+
- **npm:** https://www.npmjs.com/package/xspacesocket
|
|
15
|
+
- **Source:** https://gitlab.com/Casper-Tech-ke/baileys
|
|
16
|
+
- **Changelog:** [CHANGELOG.md](./CHANGELOG.md)
|
|
17
|
+
- **License:** [LICENSE](./LICENSE) (MIT)
|
|
4
18
|
|
|
5
19
|
## Installation
|
|
6
20
|
|
|
7
21
|
```bash
|
|
8
|
-
npm install
|
|
22
|
+
npm install xspacesocket
|
|
9
23
|
```
|
|
10
24
|
|
|
11
25
|
The package is ESM and requires Node.js 20 or newer.
|
|
12
26
|
|
|
27
|
+
New users import from `'xspacesocket'` (see Quick start). If you are migrating from `whiskeysockets/baileys`, use the npm alias in the note above instead. Your imports stay as they are.
|
|
28
|
+
|
|
29
|
+
### Install from GitLab
|
|
30
|
+
|
|
31
|
+
```json
|
|
32
|
+
"baileys": "git+https://gitlab.com/Casper-Tech-ke/baileys.git#main"
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Or install it directly:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
npm install git+https://gitlab.com/Casper-Tech-ke/baileys.git#main
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Your imports stay as `'baileys'`, since the dependency key is the import name.
|
|
42
|
+
|
|
13
43
|
## Quick start
|
|
14
44
|
|
|
15
45
|
```js
|
|
16
|
-
import makeWASocket, { useMultiFileAuthState } from '
|
|
46
|
+
import makeWASocket, { useMultiFileAuthState } from 'xspacesocket'
|
|
17
47
|
|
|
18
48
|
const { state, saveCreds } = await useMultiFileAuthState('auth_info')
|
|
19
49
|
const sock = makeWASocket({ auth: state })
|
|
20
50
|
sock.ev.on('creds.update', saveCreds)
|
|
21
51
|
```
|
|
22
52
|
|
|
53
|
+
## Features
|
|
54
|
+
|
|
55
|
+
- **Polls & poll voting** — quiz and timed polls, poll add-option, and `sendPollVote` by option name with the LID voter-id fix.
|
|
56
|
+
- **Channels** — channel status publishing and management, channel poll voting, scheduled posts, status responses, view receipts, and directory search; newsletter status send, react, revoke, and fetch.
|
|
57
|
+
- **App-state controls** — pin and unpin chats and messages (with pin safety for messages that do not exist), archive chats, personal and Close Friends statuses, status audience (contacts, allow list, deny list, Close Friends), all eight privacy settings, status viewing and reactions, and automatic sync-key resolve on fresh sessions.
|
|
58
|
+
- **View-once recovery** — V2 envelope, `downloadViewOnceMessage` and `extractViewOnceMedia`, with reupload-first when media has a key but no URL.
|
|
59
|
+
- **Native interactive buttons** — `cta_url`, `cta_copy`, `quick_reply`, `single_select`, and `cta_call`, with media headers and offer banners.
|
|
60
|
+
- **Contacts** — `addOrEditContact` and `removeContact` (WhatsApp contacts only, not the phone address book).
|
|
61
|
+
- **Member tag & sticker packs** — member tag text and `group-participants.update`, sticker pack publisher, cover, and hash.
|
|
62
|
+
- **Group status** — `sendGroupStatus` for text, image, video, audio, and sticker, with link previews on text statuses.
|
|
63
|
+
- **Group history** — `sendGroupHistory`, the E2EE history bundle for new members.
|
|
64
|
+
- **Native Markdown tables** — the `markdownTable` message property, `parseMarkdownTables`, and `markdownToAIRichResponse`.
|
|
65
|
+
- **Article cards** — `sendArticleCard` external-ad reply cards.
|
|
66
|
+
- **Enhanced sticker fields** — `isAiSticker`, `isAvatar`, `isLottie`, and `accessibilityLabel`.
|
|
67
|
+
- **Core WhatsApp Web** — the full upstream Baileys API: messages, groups, calls, presence, auth, and pairing codes.
|
|
68
|
+
|
|
23
69
|
## Native Markdown tables
|
|
24
70
|
|
|
25
71
|
Send an AI response containing Markdown pipe tables through `markdownTable`. WhatsApp renders each detected table with its native rich-table interface while preserving surrounding prose.
|
|
@@ -52,7 +98,7 @@ Supported behavior:
|
|
|
52
98
|
The lower-level helpers are also exported:
|
|
53
99
|
|
|
54
100
|
```js
|
|
55
|
-
import { parseMarkdownTables, markdownToAIRichResponse } from '
|
|
101
|
+
import { parseMarkdownTables, markdownToAIRichResponse } from 'xspacesocket'
|
|
56
102
|
|
|
57
103
|
const submessages = parseMarkdownTables(markdown, { title: 'Results' })
|
|
58
104
|
const richResponse = markdownToAIRichResponse(markdown, { title: 'Results' })
|
|
@@ -133,12 +179,22 @@ These fields do not convert a WebP file into WhatsApp's signed premium `applicat
|
|
|
133
179
|
- Adds `sock.sendGroupStatus()` for text and media group-status updates.
|
|
134
180
|
- Adds Markdown-to-native-table parsing through the `markdownTable` message property.
|
|
135
181
|
- Adds `sock.sendArticleCard()` for external-ad reply article cards.
|
|
182
|
+
- Adds polls and poll voting: quiz and timed polls, poll add-option, and `sendPollVote` with the LID voter-id fix.
|
|
183
|
+
- Adds channel status and polls, scheduled posts, status responses, view receipts, and directory search.
|
|
184
|
+
- Adds app-state controls: pin chats and messages, archive, personal and Close Friends status, privacy settings, and status audience.
|
|
185
|
+
- Adds view-once recovery with `downloadViewOnceMessage` and `extractViewOnceMedia`.
|
|
186
|
+
- Adds native interactive buttons (`cta_url`, `cta_copy`, `quick_reply`, `single_select`, `cta_call`).
|
|
187
|
+
- Adds contact controls (`addOrEditContact`, `removeContact`), member tag text, sticker pack fields, and `sendGroupHistory`.
|
|
136
188
|
- Exports `parseMarkdownTables()` and `markdownToAIRichResponse()`.
|
|
137
189
|
- Supports enhanced sticker protobuf fields.
|
|
138
190
|
- Fixes media stanza detection required by group-status messages.
|
|
139
191
|
|
|
140
192
|
All other standard Baileys APIs remain available.
|
|
141
193
|
|
|
194
|
+
## Changelog
|
|
195
|
+
|
|
196
|
+
See [CHANGELOG.md](./CHANGELOG.md) for the full version history.
|
|
197
|
+
|
|
142
198
|
## License
|
|
143
199
|
|
|
144
|
-
MIT. See [LICENSE](./LICENSE). The original Baileys copyright notice is preserved. Modifications by
|
|
200
|
+
MIT. See [LICENSE](./LICENSE). The original Baileys copyright notice is preserved. Modifications by XCASPER SPACE are licensed under the same terms.
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xspacesocket",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.3.
|
|
5
|
-
"description": "CASPER-TECH-KE Baileys
|
|
4
|
+
"version": "1.3.2",
|
|
5
|
+
"description": "CASPER-TECH-KE Baileys — WhatsApp Web library with report/block, polls and poll voting, channel status and polls, app-state controls, view-once recovery, native buttons, and group status.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"whatsapp",
|
|
8
8
|
"automation",
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
"wolf-tech",
|
|
12
12
|
"wolvarex"
|
|
13
13
|
],
|
|
14
|
-
"homepage": "https://
|
|
14
|
+
"homepage": "https://gitlab.com/Casper-Tech-ke/baileys",
|
|
15
15
|
"repository": {
|
|
16
|
-
"url": "https://
|
|
16
|
+
"url": "https://gitlab.com/Casper-Tech-ke/baileys.git"
|
|
17
17
|
},
|
|
18
18
|
"license": "MIT",
|
|
19
19
|
"author": "Briton Kiplangat (Silent Wolf) <WOLF TECH>",
|
|
@@ -22,7 +22,9 @@
|
|
|
22
22
|
"files": [
|
|
23
23
|
"lib/**/*",
|
|
24
24
|
"WAProto/**/*",
|
|
25
|
-
"engine-requirements.js"
|
|
25
|
+
"engine-requirements.js",
|
|
26
|
+
"poster.webp",
|
|
27
|
+
"CHANGELOG.md"
|
|
26
28
|
],
|
|
27
29
|
"scripts": {
|
|
28
30
|
"build:all": "npm run build && npm run build:docs",
|
|
@@ -49,6 +51,7 @@
|
|
|
49
51
|
"@hapi/boom": "^9.1.3",
|
|
50
52
|
"@types/qrcode-terminal": "^0.12.2",
|
|
51
53
|
"async-mutex": "^0.5.0",
|
|
54
|
+
"jimp": "0.16.3",
|
|
52
55
|
"libsignal": "^6.0.0",
|
|
53
56
|
"link-preview-js": "^4.0.4",
|
|
54
57
|
"lru-cache": "^11.1.0",
|
|
@@ -94,7 +97,6 @@
|
|
|
94
97
|
},
|
|
95
98
|
"peerDependencies": {
|
|
96
99
|
"audio-decode": "^2.1.3",
|
|
97
|
-
"jimp": "^0.16.3",
|
|
98
100
|
"sharp": "*"
|
|
99
101
|
},
|
|
100
102
|
"resolutions": {
|
|
@@ -129,9 +131,6 @@
|
|
|
129
131
|
"peerDependenciesMeta": {
|
|
130
132
|
"audio-decode": {
|
|
131
133
|
"optional": true
|
|
132
|
-
},
|
|
133
|
-
"jimp": {
|
|
134
|
-
"optional": true
|
|
135
134
|
}
|
|
136
135
|
},
|
|
137
136
|
"packageManager": "yarn@4.9.2",
|
package/poster.webp
ADDED
|
Binary file
|