d99kris / nchat

Terminal-based Telegram / WhatsApp client for Linux and macOS
MIT License
619 stars 43 forks source link

Whatsapp broken #56

Closed Caua77 closed 2 years ago

Caua77 commented 2 years ago

With whatsapp's useful update implementing the beta features, it broke using terminal clients. I wonder if it is possible to fix this.

d99kris commented 2 years ago

Yeah, so the nchat WhatsApp support is undocumented and experimental, at best. 

The reason for nchat to not officially support it, is that WhatsApp doesn't really encourage third-party clients, so it's an eternal catchup-game to work with their latest backend. Currently nchat is using a third-party library https://github.com/Rhymen/go-whatsapp for this, but that library has been marked unmaintained recently, with WhatsApp's introduction of multi-device. 

I've started some local work to support WhatsApp multi-device - using https://github.com/tulir/whatsmeow - but I have nothing near basic functionality yet. 

Having that said, current nchat for WhatsApp is working for me (for existing setups at least). It's possible WhatsApp no longer allows new setups/devices that use legacy WhatsApp web device usages.

I will leave this issue open, in case others encounter this, and I will update it when / if support for WhatsApp multi-device gets implemented.

Caua77 commented 2 years ago

Okay, thanks for the reply.

d99kris commented 2 years ago

WhatsApp multi-device functionality has been implemented in latest nchat master. Note that it's still not officially supported by nchat, in the sense that it's an undocumented feature which requires setting a feature flag during build. Having that said, basic functionality is now working for me - with the exception that old chat history cannot be retrieved. Only recent messages are retrieved at first setup/sync. At subsequent logins any new messages will be synced though.

Bellavene commented 2 years ago

Interesting. How to set up whatsapp in it?

d99kris commented 2 years ago

WhatsApp support needs to be enabled when building nchat, for example:

mkdir -p build && cd build && cmake -DHAS_WHATSAPP=ON .. && make -s

or if using the help script make.sh it's enabled by default:

./make.sh build

Then one need to use a separate config dir (assuming you already set it up for Telegram) for running nchat with WhatsApp and run the setup:

nchat -d ~/.nchatwhatsapp -s

And there should be protocol option allowing to select WhatsApp. I use alias'es to make it easier to run nchat with different config dirs, example:

alias whatsapp='nchat -d ~/.nchatwhatsapp'
Bellavene commented 2 years ago

Thank you! Last question (maybe better to make additional issue?) is it possible to set custom shortcuts with alt, instead of control key? Tried it with no luck, but I use it this way everywhere else.

d99kris commented 2 years ago

Thank you! Last question (maybe better to make additional issue?) is it possible to set custom shortcuts with alt, instead of control key? Tried it with no luck, but I use it this way everywhere else.

Yeah, if you could report a separate issue it would be great! :+1:

I haven't tested custom ALT shortcuts but technically I think it should work, but it's not really clear or user-friendly how to do it. Let me do some research and get back.