Open knvpk opened 4 years ago
That function is returning a string combining values in server and user, but in original whatsapp web it is sending as object, if i use your helper function it will send as string which will not work for whatsapp server.
can you attach the dump from web whatsapp? or point me to the code in web whatsapp js?
Also, you not attach your code so I can't check it. Some binary need metric byte or it will fail. that byte is not part of the encrypted content.
Im actually cloned the whatsappweb and debugging it please check below screenshots to understand
This is there where i kept console.log
for read and write places.
Total expanded console log object when writing
I added below function in index.ts
under whatsapp
folder after queryStatus
function thats it.
queryMessage() {
return this.query({
count: "50",
epoch: "5",
index: "7A7B3E4A12A9F5BB266B1BBDE95EDF59",
kind: "before",
owner: "true",
participant: undefined,
type: "message",
jid: widHelper.serialize({
server: "c.us",
user: "919133985985",
})
})
}
AFAIK, JID/WID is sent as string to whatsapp server. I never seen it send as object, you can look into binary writer in whatsapp code. It does replace all WID to string with correct "suffix" like replacing @c.us
to @s.whatsapp.net
.
If you sure that WID is sent as object, so you can try to change that suffix.
Also the group id is differ from user WID, something like {creator}-{timestamp}@c.us
Im using the WID helper but getting the 401
status do you have any idea. Im using the same account in whatsapp web and this lib also. please check below logs i have annotated required parts
I changed the metric in interface from QUERY_MESSAGES
to QUERY_MESSAGE
https://github.com/ndunks/WaJs/blob/a900da7b60e5b9f79d8da349a4727e58c8a6d252/src/whatsapp/interfaces.ts#L257
because the type
should be converted to query_{type}.
After doing that it is working got response from whatsapp server but another problem of handling binary for message. please check below screenshots Sending metric as 7 Response is 16 messages but unable to handle. what to do here.
Ans also when second response came (which has actual content), the callback is not called.
Ah yes, just add little patch to not remove handle. make the handle function remove it self after all data received. Look here
@pavankumarkatakam can you kindly guide me on how I can clone the whatsapp web and run locally as you are doing. I would like to learn and test it too.
Hi, Im trying to get the previous chat list of a contact or group, by debugging the whatsapp web im able to see that is related to
query
, as belowso im trying to implement it but getting error as
writer:writeString passed non-string/wid type:
, i think because thejid
is Object in my message.Can you tell me how to proceed furthur.