Closed jesusvalverde closed 4 years ago
Describe the bug
Sitll not able to get all getAllUnreadMessages
I do have 1 unread text from 506xxxxxx39 and 1 form 506xxxxxx60 , [data from getAllChats]. I do make a getAllUnreadMessages and got a Warning (and no data)
Steps to Reproduce
const wa = require('@open-wa/wa-automate'); wa.create('5',{cacheEnabled:false, qrRefreshS:20}).then(client => start(client)); async function start(client) { const getAllChats = await client.getAllChats(); console.log("TCL: getAllChats ->", getAllChats.length); console.log(getAllChats); const getAllUnreadMessages = await client.getAllUnreadMessages(); console.log("TCL: getAllUnreadMessages ->", getAllUnreadMessages.length); console.log(getAllUnreadMessages); }
Expected behavior
DEBUG INFO ✓ Initializing WA ┌─────────────────────┬───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ │ (index) │ Values │ ├─────────────────────┼───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤ │ WA_VERSION │ '2.2021.4' │ │ PAGE_UA │ 'WhatsApp/2.2019.8 Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36' │ │ WA_AUTOMATE_VERSION │ '1.9.52' │ │ BROWSER_VERSION │ 'HeadlessChrome/83.0.4103.0' │ └─────────────────────┴───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ ✓ Authenticated ✓ WAPI Reinjected ✓ Client is ready ✓ Passed Integrity Test TCL: getAllChats -> 2 [ { id: { server: 'c.us', user: '506xxxxxx39', _serialized: '506xxxxxx39@c.us' }, pendingMsgs: false, lastReceivedKey: { fromMe: true, remote: [Object], id: '59C3F4A052E25A0CADE647B0826C07DE', _serialized: 'true_506xxxxxx39@c.us_59C3F4A052E25A0CADE647B0826C07DE' }, t: 1590612407, unreadCount: 1, archive: false, isReadOnly: false, muteExpiration: 0, notSpam: false, pin: 0, msgs: null, kind: 'chat', isGroup: false, formattedTitle: '+506 xxxx xx39', contact: { id: [Object], type: 'in', verifiedName: 'Wh 506', isBusiness: true, isEnterprise: false, verifiedLevel: 0, statusMute: false, labels: [], formattedName: '+506 xxxx xx39', isMe: false, isMyContact: false, isPSA: false, isUser: true, isWAContact: true, profilePicThumbObj: [Object], msgs: null }, groupMetadata: null, presence: { id: [Object], chatstates: [] } }, { id: { server: 'c.us', user: '506xxxxxx60', _serialized: '506xxxxxx60@c.us' }, pendingMsgs: false, lastReceivedKey: { fromMe: false, remote: [Object], id: '3AADCA1773162A48683A', _serialized: 'false_506xxxxxx60@c.us_3AADCA1773162A48683A' }, t: 1590612372, unreadCount: 2, archive: false, isReadOnly: false, modifyTag: 913764, muteExpiration: 0, notSpam: true, pin: 0, msgs: null, kind: 'chat', isGroup: false, formattedTitle: '+506 xxxx xx60', contact: { id: [Object], pushname: 'Jesús', type: 'in', isBusiness: false, isEnterprise: false, statusMute: false, labels: [], formattedName: '+506 xxxx xx60', isMe: false, isMyContact: false, isPSA: false, isUser: true, isWAContact: true, profilePicThumbObj: [Object], msgs: null }, groupMetadata: null, presence: { id: [Object], chatstates: [] } } ] (node:1394) UnhandledPromiseRejectionWarning: SyntaxError: Unexpected token o in JSON at position 1 at JSON.parse () at Client. (/Users/jesusvalverde/what/node_modules/@open-wa/wa-automate/dist/api/Client.js:1149:43) at step (/Users/jesusvalverde/what/node_modules/@open-wa/wa-automate/dist/api/Client.js:44:23) at Object.next (/Users/jesusvalverde/what/node_modules/@open-wa/wa-automate/dist/api/Client.js:25:53) at fulfilled (/Users/jesusvalverde/what/node_modules/@open-wa/wa-automate/dist/api/Client.js:16:58) at processTicksAndRejections (internal/process/task_queues.js:97:5) (Use node --trace-warnings ... to show where the warning was created) (node:1394) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) (node:1394) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
node --trace-warnings ...
--unhandled-rejections=strict
Screenshots
@github-actions run
9400fe6
getAllUnreadMessages
bc9fcb2
@jesusvalverde try now
Working fine !!!
Tnks
Describe the bug
Sitll not able to get all getAllUnreadMessages
I do have 1 unread text from 506xxxxxx39 and 1 form 506xxxxxx60 , [data from getAllChats]. I do make a getAllUnreadMessages and got a Warning (and no data)
Steps to Reproduce
const wa = require('@open-wa/wa-automate'); wa.create('5',{cacheEnabled:false, qrRefreshS:20}).then(client => start(client)); async function start(client) { const getAllChats = await client.getAllChats(); console.log("TCL: getAllChats ->", getAllChats.length); console.log(getAllChats); const getAllUnreadMessages = await client.getAllUnreadMessages(); console.log("TCL: getAllUnreadMessages ->", getAllUnreadMessages.length); console.log(getAllUnreadMessages); }
Expected behavior
DEBUG INFO ✓ Initializing WA ┌─────────────────────┬───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ │ (index) │ Values │ ├─────────────────────┼───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤ │ WA_VERSION │ '2.2021.4' │ │ PAGE_UA │ 'WhatsApp/2.2019.8 Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36' │ │ WA_AUTOMATE_VERSION │ '1.9.52' │ │ BROWSER_VERSION │ 'HeadlessChrome/83.0.4103.0' │ └─────────────────────┴───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ ✓ Authenticated ✓ WAPI Reinjected ✓ Client is ready ✓ Passed Integrity Test TCL: getAllChats -> 2 [ { id: { server: 'c.us', user: '506xxxxxx39', _serialized: '506xxxxxx39@c.us' }, pendingMsgs: false, lastReceivedKey: { fromMe: true, remote: [Object], id: '59C3F4A052E25A0CADE647B0826C07DE', _serialized: 'true_506xxxxxx39@c.us_59C3F4A052E25A0CADE647B0826C07DE' }, t: 1590612407, unreadCount: 1, archive: false, isReadOnly: false, muteExpiration: 0, notSpam: false, pin: 0, msgs: null, kind: 'chat', isGroup: false, formattedTitle: '+506 xxxx xx39', contact: { id: [Object], type: 'in', verifiedName: 'Wh 506', isBusiness: true, isEnterprise: false, verifiedLevel: 0, statusMute: false, labels: [], formattedName: '+506 xxxx xx39', isMe: false, isMyContact: false, isPSA: false, isUser: true, isWAContact: true, profilePicThumbObj: [Object], msgs: null }, groupMetadata: null, presence: { id: [Object], chatstates: [] } }, { id: { server: 'c.us', user: '506xxxxxx60', _serialized: '506xxxxxx60@c.us' }, pendingMsgs: false, lastReceivedKey: { fromMe: false, remote: [Object], id: '3AADCA1773162A48683A', _serialized: 'false_506xxxxxx60@c.us_3AADCA1773162A48683A' }, t: 1590612372, unreadCount: 2, archive: false, isReadOnly: false, modifyTag: 913764, muteExpiration: 0, notSpam: true, pin: 0, msgs: null, kind: 'chat', isGroup: false, formattedTitle: '+506 xxxx xx60', contact: { id: [Object], pushname: 'Jesús', type: 'in', isBusiness: false, isEnterprise: false, statusMute: false, labels: [], formattedName: '+506 xxxx xx60', isMe: false, isMyContact: false, isPSA: false, isUser: true, isWAContact: true, profilePicThumbObj: [Object], msgs: null }, groupMetadata: null, presence: { id: [Object], chatstates: [] } } ] (node:1394) UnhandledPromiseRejectionWarning: SyntaxError: Unexpected token o in JSON at position 1 at JSON.parse ()
at Client. (/Users/jesusvalverde/what/node_modules/@open-wa/wa-automate/dist/api/Client.js:1149:43)
at step (/Users/jesusvalverde/what/node_modules/@open-wa/wa-automate/dist/api/Client.js:44:23)
at Object.next (/Users/jesusvalverde/what/node_modules/@open-wa/wa-automate/dist/api/Client.js:25:53)
at fulfilled (/Users/jesusvalverde/what/node_modules/@open-wa/wa-automate/dist/api/Client.js:16:58)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(Use
node --trace-warnings ...
to show where the warning was created) (node:1394) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag--unhandled-rejections=strict
(see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) (node:1394) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.Screenshots