raweee / node-red-contrib-whatsapp-link

Simple Node-Red node to link Whatsapp
https://discord.gg/VApVeGuF
26 stars 7 forks source link

WhatsApp Lite : Beta Testing #12

Closed raweee closed 9 months ago

raweee commented 1 year ago

Web sockets based whatsapp-lite is allmost finished, integrating the same in whatsapp-link node. QR code and connections are completed. Working on sending and receiving massages.

ryangonzalez133 commented 1 year ago

after testing the lite version, it is no longer crashing, but when I connect to my whatsapp, the node appears as disconnected and does not change image

ryangonzalez133 commented 1 year ago

I've been doing some tests and I've verified that even though it appears as disconnected, I managed to receive the return of messages received for me, I haven't tested the rest of the functions yet. But for it to work, I had to follow the tutorial, I connected by the qr code and soon after it appeared as disconnected, so I just created another client and then it changed the status to "connected" without having to connect again by the qr code, I put the new client in the "chats" node in" node "admin" changed again to "disconnected" but I was able to receive the messages.

And when restarting node-red or the machine. asks you to connect to whatsapp again through the qr code

raweee commented 1 year ago

The status below the node, have to work on it.

But the node is always connected even if show disconnected, if it was disconnected it will show QR code for new connection. WhatsApp-lite is very fast, it changes its state of connection so fast that status below it missed to update.

raweee commented 1 year ago

After restart of node-red or machine, it should'nd asked for scanning of QR as the session is already store in 'whatsaap Link' folder. Please check that folder still remains or deleted when machin go down. That folder 'whatsapp Link' is available in same folder where the settings.js and flow.json are located.

ryangonzalez133 commented 1 year ago

hello friend, I could not find the folder or file named as "whatsapp link". The only folders and files I found were the "whatsapp web.js" folder and the "node-red-contrib-home-assistant-websocket" file as shown in the screenshot.

Captura de Tela (10) Captura de Tela (9)

I don't understand what you mean by "After restart of node-red or machine, it should'nd asked for scanning of QR as the session is already store in 'whatsaap Link' folder." So every time i restart node-red or the machine i will have to go and connect with my whatsapp by the qr code? Wouldn't there be a way to store the session and always leave it saved?

ryangonzalez133 commented 1 year ago

another folder I found was this one, but the name is not "whatsapp link" but "node-red-contrib-whatsapp-link" so I don't know if it's this one Captura de Tela (12) Captura de Tela (11)

raweee commented 1 year ago

Hi folder location sould be

store your session locally in Node-RED. All data are store in users <user>/.node-red/Whatsapp-Link folder. Near you Node-Red's settings.js file.

It might be hidden

ryangonzalez133 commented 1 year ago

Would it be this? image

raweee commented 1 year ago

No, this is the correct folder. I'll make a option to choose the folder while publishing the node, in next release. So you can select your own folder to store sessions.

ryangonzalez133 commented 1 year ago

I understand, what I told you is happening. To actually connect the node, after I scan the QR code, I have to create another client to connect, but after a while, it disconnects and I stop receiving the messages. Thanks for the work and development

paede81 commented 1 year ago

I have also the issue that it disconnect after a few hours. I tried to reconnect by sending restart to the admin node, but it seems that messages that I send to the admin node are ignore. The only way to reconnect is by open the config of the admin note, change to Whatsapp Web and back to lite do re-establish the connection for the next few hours. Btw the normal Whatsapp Web will never connect and status show connecting

afcasasfranco commented 1 year ago

HI

Great job, work very well.

Any change to use multiple accounts by websocket??

raweee commented 1 year ago

Hi @afcasasfranco , Multi user functionality was already in their.

afcasasfranco commented 1 year ago

@raweee perfect, but when try not give me another QR and on this moment the link disconnect in a couple of hours, do you know how can prevent the disconnect?

raweee commented 1 year ago

@afcasasfranco, yes I find that web sockets client goes in sleep after some time, In next version I'll add a timer to ping or go online ever couple of hour(user defined time).

raweee commented 1 year ago

Hi @ryangonzalez133, I find that it difficult to get a folder location by user in any browser. In search of any other option so user can also select a location for WhatsApp sessions.

ryangonzalez133 commented 1 year ago

Hello friend, I gave up trying to use lite, it was giving an error all the time. So I installed node-red via docker separate from the Home assistant, at first it gave an error, so I installed puppeteer directly in the docker that worked fine doing this. Run the command:

docker exec -it --user=root node-red /bin/sh

After entering your node-red docker file, a "node-red" folder will appear but at least for me, this is not the correct node-red folder, so you have to access where the node-red folder really is red, mine is in "/data/noderyan". So just "cd" to go back to the folders and find the right one, then run the following commands

` apk update

apk add --no-cache chromium --repository=http://dl-cdn.alpinelinux.org/alpine/v3.10/main

rm /data/node_modules/puppeteer/.local-chromium/linux-982053/chrome-linux/chrome

ln -s /usr/bin/chromium-browser /data/node_modules/puppeteer/.local-chromium/linux-982053/chrome-linux/chrome ` Use all commands with docker running.

So it worked fine, it doesn't ask to connect again with whatsapp and so far it hasn't given any errors, I'm using web, lite was giving an error all the time and when I restarted I had to connect again.

ryangonzalez133 commented 1 year ago

hello friend @raweee , do you intend to put message compatibility by buttons in your node? It would be something very surprising

jdntortosa commented 1 year ago

@afcasasfranco, yes I find that web sockets client goes in sleep after some time, In next version I'll add a timer to ping or go online ever couple of hour(user defined time).

Thks!! Great Job!! I'm waiting for it

paede81 commented 1 year ago

@raweee any updates regarding WhatsApp lite and disconnects?

raweee commented 1 year ago

Whatsapp-Lite with Ping-Interval and Online/Offline mode added.

paede81 commented 1 year ago

Whatsapp-Lite with Ping-Interval and Online/Offline mode added.

Thanks a lot. One question: Why do I have to do a full restart of node-red when I just update your package? I don't have this behavior with other node red packages

paede81 commented 1 year ago

Whatsapp-Lite with Ping-Interval and Online/Offline mode added.

It's not working. It's still disconnecting after a few hours, even if I set ping to 1 hour

raweee commented 1 year ago

Hi @paede81, Now their are only 2 case it's show disconnected.

  1. Case1 : logout (obvious reason to avoid connecting again and again).
  2. Case2: lose/bad internet connection (if their was no internet at any time,it will remain disconnected) to avoid connecting again and again till nodered crashes.

You may check what is the exact reason of disconnection by selecting connection.updates in chats-in node, which shows status of connection along with reason.

Let me know the reason of disconnection. PS: Mine is working fine from last 23hrs.

afcasasfranco commented 1 year ago

Whatsapp-Lite with Ping-Interval and Online/Offline mode added.

It's not working. It's still disconnecting after a few hours, even if I set ping to 1 hour

I'm test and work in the last 6 hours

paede81 commented 1 year ago

Hi @paede81, Now their are only 2 case it's show disconnected.

  1. Case1 : logout (obvious reason to avoid connecting again and again).
  2. Case2: lose/bad internet connection (if their was no internet at any time,it will remain disconnected) to avoid connecting again and again till nodered crashes.

You may check what is the exact reason of disconnection by selecting connection.updates in chats-in node, which shows status of connection along with reason.

Let me know the reason of disconnection. PS: Mine is working fine from last 23hrs.

I will check. One proposal: Instead of sending "Error Sending Msg:: Error: Connection Closed", can you trigger a reconnect if you try to send a message and connection is closed or can you add a function to trigger a reconnect via call to the admin note