From c36c32c22959ed437036461805eb8dbc70bbec62 Mon Sep 17 00:00:00 2001 From: Renato Alcara Date: Sat, 25 Apr 2026 11:02:03 -0300 Subject: [PATCH] fix(chats): use abt xmlns and protocol 1 for fetchProps to avoid bad-request Aligns with Baileys upstream PR #2473. Server rejects the previous combination (xmlns=w, protocol=2, hash=''), returning bad-request and dropping AB props on connect. Switches to xmlns=abt with protocol=1 and omits the hash attr entirely when empty. Co-Authored-By: Claude Opus 4.7 (1M context) --- src/Socket/chats.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/Socket/chats.ts b/src/Socket/chats.ts index 023e804d..46685d42 100644 --- a/src/Socket/chats.ts +++ b/src/Socket/chats.ts @@ -1060,22 +1060,21 @@ export const makeChatsSocket = (config: SocketConfig) => { } } - /** sending non-abt props may fix QR scan fail if server expects */ + /** fetch AB props */ const fetchProps = async () => { - //TODO: implement both protocol 1 and protocol 2 prop fetching, specially for abKey for WM const resultNode = await query({ tag: 'iq', attrs: { to: S_WHATSAPP_NET, - xmlns: 'w', + xmlns: 'abt', type: 'get' }, content: [ { tag: 'props', attrs: { - protocol: '2', - hash: authState?.creds?.lastPropHash || '' + protocol: '1', + ...(authState?.creds?.lastPropHash ? { hash: authState.creds.lastPropHash } : {}) } } ]