Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
tulssinep opened this issue Mar 21, 2019 · 16 comments
Open

Comments

@tulssinep
Copy link

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
Copy link

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

@tulssinep
Copy link
Author

tulssinep commented Mar 24, 2019

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
Copy link

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

@tulssinep
Copy link
Author

@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
Copy link

arunrreddy commented Mar 25, 2019 via email

@tulssinep
Copy link
Author

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
Copy link

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

@tulssinep
Copy link
Author

tulssinep commented Mar 25, 2019

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
Copy link

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
Copy link
Author

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
Copy link

arunrreddy commented Mar 26, 2019 via email

@kelvin5290
Copy link

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
Copy link

arunrreddy commented Mar 26, 2019 via email

@kelvin5290
Copy link

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
Copy link

arunrreddy commented Mar 26, 2019 via email

@refanka-inv
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants