sigalor / whatsapp-web-reveng

Reverse engineering WhatsApp Web.
MIT License
6.1k stars 802 forks source link

sendTextMessage no errors, but doing nothing, not sending the message #177

Open tulssinep opened 5 years ago

tulssinep commented 5 years ago

I've logged in, messages on group chats etc. makes them appear in the the console. Good.

I've duplicated the disconnect button from the JS HTML interface, renamed it and made it call a test method that eventually calls currWhatsAppInstance.sendTextMessage("55xxxxxx@c.us","Test");

I've had to do a ton of imports and the method eventually ran through without breaking the process, everything good - except for the fact that the message doesn't get sent. I've tried with different phone numbers etc. the message simply won't appear in the conversation on either device. I've deleted the conversation to make sure it's not buried on the wrong timestamp but no change.

The sendTextMessage does get called, I put text file writes in it and they all get written.

Any idea what I'm doing wrong? Did I miss something?

arunrreddy commented 5 years ago

What is the response you get back from the python server?

tulssinep commented 5 years ago

Hey, attached you will find the console output:

Sending message from the phone to the number in question "manually" on the phone itself:

[1] sending {"from": "backend", "timestamp": 1553451__________, "resource_instance_id": "05__________e5", "message": ["Presence", {"deny": false, "type": "unavailable", "id": "55__________55@c.us", "t": 154846__________}], "type": "whatsapp_message_received", "message_type": "json"}
[1] ["Presence", {"deny": false, "type": "unavailable", "id": "__________@c.us", "t": 15484__________}]
[0] got message  { from: 'backend',
[0]   timestamp: 1553451__________,
[0]   resource_instance_id: '050b2__________6e5',
[0]   message: 
[0]    [ 'Presence',
[0]      { deny: false,
[0]        type: 'unavailable',
[0]        id: '__________@c.us',
[0]        t: 15484__________ } ],
[0]   type: 'whatsapp_message_received',
[0]   message_type: 'json' }
[1] sending {"from": "backend", "timestamp": 1553451__________, "resource_instance_id": "050__________e5", "message": ["action", {"add": "relay"}, [{"status": "PENDING", "message": {"conversation": "W"}, "key": {"remoteJid": "__________@s.whatsapp.net", "fromMe": true, "id": "3__________3"}, "messageTimestamp": "15534__________"}]], "type": "whatsapp_message_received", "message_type": "binary"}
[1] sending {"from": "backend", "timestamp": 155345__________, "resource_instance_id": "05__________6e5", "message": ["Msg", {"from": "__________@c.us", "ack": 1, "cmd": "ack", "to": "__________@c.us", "t": 15534__________, "id": "3__________E3"}], "type": "whatsapp_message_received", "message_type": "json"}
[1] ["Msg", {"from": "__________@c.us", "ack": 1, "cmd": "ack", "to": "__________@c.us", "t": 15534__________, "id": "3A__________E3"}]
[0] got message  { from: 'backend',
[0]   timestamp: 1553451__________,
[0]   resource_instance_id: '050__________6e5',
[0]   message: [ 'action', { add: 'relay' }, [ [Object] ] ],
[0]   type: 'whatsapp_message_received',
[0]   message_type: 'binary' }
[0] got message  { from: 'backend',
[0]   timestamp: 155345__________,
[0]   resource_instance_id: '050__________e5',
[0]   message: 
[0]    [ 'Msg',
[0]      { from: '__________@c.us',
[0]        ack: 1,
[0]        cmd: 'ack',
[0]        to: '__________@c.us',
[0]        t: 15534__________,
[0]        id: '3__________3' } ],
[0]   type: 'whatsapp_message_received',
[0]   message_type: 'json' }

Print when I hit my "send" button. All the parameters are entirely copied from the "logout" button (except that the command is backend-test)

[0] got message  { command: 'backend-test', from: 'client', type: 'call' }
[1] 1__________5,{"command":"backend-test","whatsapp_instance_id":"05__________6e5","from":"api2backend","type":"call"}
{u'whatsapp_instance_id': u'050__________6e5', u'type': u'call', u'command': u'backend-test', u'from': u'api2backend'}
[1] send: '\x82__________\__________\__________\xa8'
[1] sending {"resource": "whatsapp", "type": "resource_disconnected", "resource_instance_id": "050__________6e5", "from": "backend"}
[0] got message  { resource: 'whatsapp',
[0]   type: 'resource_disconnected',
[0]   resource_instance_id: '050b__________6e5',
[0]   from: 'backend' }

Error I sometimes get after sending. First line might be a print I've added to the code:

[1] send: '\x81__________xfe'
[1] Traceback (most recent call last):
[1]   File "/Users/__________/Downloads/ware2/backend/whatsapp.py", line 152, in onMessage
[1]     messageContent = messageSplit[1];
[1] IndexError: list index out of range
[1] 
arunrreddy commented 5 years ago

Check out arunrreddy/whatsapp-web-reveng. I have made a few changes to make it work.

tulssinep commented 5 years ago

@arunrreddy thank you but unfortunately this can't connect for me.

Click to connect to API Connecting to API Connection to API closed. Click to reconnect

JS console:

whatsapp-web-reveng jsdemo server listening on port 2021

Python console

[2] Sass is watching for changes. Press Ctrl-C to stop.
[2] 
[1] [nodemon] 1.18.3
[0] [nodemon] 1.18.3
[0] [nodemon] to restart at any time, enter `rs`
[1] [nodemon] to restart at any time, enter `rs`
[1] [nodemon] watching: *.*
[0] [nodemon] watching: *.*
[1] [nodemon] starting `python2.7 ./backend/whatsapp_web_backend.py`
[0] [nodemon] starting `node index.js`
[0] whatsapp-web-reveng API server listening on port 2019
[0] Creating new connection 0
[0] whatsapp-web-reveng HTTP server listening on port 2018
[1] whatsapp-web-backend listening on port 2020

With the index.html.

login-via-js-demo.html loads the QR code just fine but on the index.html nothing happens. Anything I need to configure?

arunrreddy commented 5 years ago

I am not sure of the demo but the actual implementation works fine. i.e the server running on localhost:2018

On Mon, Mar 25, 2019, 9:58 PM tulssinep notifications@github.com wrote:

@arunrreddy https://github.com/arunrreddy thank you but unfortunately this can't connect for me.

Click to connect to API Connecting to API Connection to API closed. Click to reconnect

JS console:

whatsapp-web-reveng jsdemo server listening on port 2021

Python console

[2] Sass is watching for changes. Press Ctrl-C to stop. [2] [1] [nodemon] 1.18.3 [0] [nodemon] 1.18.3 [0] [nodemon] to restart at any time, enter rs [1] [nodemon] to restart at any time, enter rs [1] [nodemon] watching: . [0] [nodemon] watching: . [1] [nodemon] starting python2.7 ./backend/whatsapp_web_backend.py [0] [nodemon] starting node index.js [0] whatsapp-web-reveng API server listening on port 2019 [0] Creating new connection 0 [0] whatsapp-web-reveng HTTP server listening on port 2018 [1] whatsapp-web-backend listening on port 2020

With the index.html.

login-via-js-demo.html loads the QR code just fine but on the index.html nothing happens. Anything I need to configure?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/sigalor/whatsapp-web-reveng/issues/177#issuecomment-476275517, or mute the thread https://github.com/notifications/unsubscribe-auth/AQ_9XBi0hy0eLOVUljDzah94g2FVdVrmks5vaPlDgaJpZM4cAlkJ .

tulssinep commented 5 years ago

Hey, just tried it, I'm getting the exact same on localhost:2018

Tried with both Chrome and Safari, taken straight from this repo here runs fine, yours does not :(

Because my paths are messed up a bit, I've had to hardcode --exec python2.7 in the package.json. Could this be a possible issue for your repo?

arunrreddy commented 5 years ago

I have configured a sendmessage button on the ui itself. I have hard-coded the number though. Did you try that?

tulssinep commented 5 years ago

Sorry I don't understand the question; I put the number at currWhatsAppInstance.sendTextMessage("55xxxxxx@c.us","Test");, it's not being read dynamically from a text field on the website if that's what you mean

arunrreddy commented 5 years ago

As I would you before I wasn't able to get the login-via-js-demo.html to work. I went to the URL localhost:2018 (not the demo). Logged in with whatsapp and then sent a message. You should see something like the page below what

tulssinep commented 5 years ago

Sorry if I didn't explain correctly; I can't get there because of the API connection loop on your repo;

ware2fork-api-error4

arunrreddy commented 5 years ago

Ah, I cloned the repo. Installed python requirements using pip and node requirements using npm and then ran npm run dev. This worked like a charm.

On Tue, Mar 26, 2019, 12:17 AM tulssinep notifications@github.com wrote:

Sorry if I didn't explain correctly; I can't get there because of the API connection loop on your repo;

[image: ware2fork-api-error4] https://user-images.githubusercontent.com/11710965/54945679-b0875c00-4f36-11e9-8460-66616c97573a.gif

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/sigalor/whatsapp-web-reveng/issues/177#issuecomment-476329753, or mute the thread https://github.com/notifications/unsubscribe-auth/AQ_9XNwQQpkgRh9l28jCgyEfliJgqR3sks5vaRmsgaJpZM4cAlkJ .

kelvin5290 commented 5 years ago

Check out arunrreddy/whatsapp-web-reveng. I have made a few changes to make it work.

hi, may i know do u solve the problem of wrong timestamp when sent a message out ?

arunrreddy commented 5 years ago

Hey i tried everything I could. The go-whatsapp library doesn't have this issue. It has something to do with the encryption and decryption I guess. I tried to reverse engineer the go library but wasn't able to do it.

On Tue, Mar 26, 2019, 5:21 PM kelvin5290 notifications@github.com wrote:

Check out arunrreddy/whatsapp-web-reveng. I have made a few changes to make it work.

hi, may i know do u solve the problem of wrong timestamp when sent a message out ?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/sigalor/whatsapp-web-reveng/issues/177#issuecomment-476592217, or mute the thread https://github.com/notifications/unsubscribe-auth/AQ_9XEGg-prc_ffWX8QQ0zLzN6piGWiYks5vagnWgaJpZM4cAlkJ .

kelvin5290 commented 5 years ago

i tried using the decryption script to decrypt the encripted message, it seem no problem. I stuck in here for few month and maybe the problem is coming from python coding.

arunrreddy commented 5 years ago

Can you share the script? I might find something. Also the user list which WhatsApp sends back has only nine digits apart from the country code? Do you have any idea why this is happening?

On Tue, Mar 26, 2019, 5:34 PM kelvin5290 notifications@github.com wrote:

i tried using the decryption script to decrypt the encripted message, it seem no problem. I stuck in here for few month and maybe the problem is coming from python coding.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/sigalor/whatsapp-web-reveng/issues/177#issuecomment-476595896, or mute the thread https://github.com/notifications/unsubscribe-auth/AQ_9XHcniH21vXJrEIhm4mkBKXv7JGSqks5vagyygaJpZM4cAlkJ .

refanka-inv commented 3 years ago

@tulssinep hai, can I have take a look to your works if you still have it?