whatscli icon indicating copy to clipboard operation
whatscli copied to clipboard

Whatsapp multi-device support

Open adi-g15 opened this issue 3 years ago • 28 comments

Whatsapp recently provided a "Multi-device" feature, so we can use whatsapp - https://faq.whatsapp.com/general/download-and-installation/about-multi-device-beta/?lang=en

But whatscli currently can't connect when user is using this Multi-device feature, since it requires scanning QR code two times (as per my observation till now). Currently after scanning once whatscli crashes/stays but won't show another qr code, and reopening doesn't help much everytime one qr code.

Screenshot_20210919-113620

adi-g15 avatar Sep 19 '21 06:09 adi-g15

I don't think this is supported in the upstream go-whatsapp library yet: https://github.com/Rhymen/go-whatsapp See this issue: https://github.com/Rhymen/go-whatsapp/issues/601

normen avatar Sep 19 '21 08:09 normen

Maybe use this? go-whatsapp dropped the issue

https://github.com/tulir/whatsmeow

alon-z avatar Oct 31 '21 14:10 alon-z

Maybe use this? go-whatsapp dropped the issue

https://github.com/tulir/whatsmeow

That looks very good, doesn't seem to be complete yet though. Thanks for the link. I won't get around to do the changes any time soon so if anyone wants to have a whack..

normen avatar Nov 01 '21 11:11 normen

any plan to add this feature?

abbasudo avatar Jan 04 '22 07:01 abbasudo

any plan to add this feature?

Not more extensively than whats written here. You can send a PR if you want.

normen avatar Jan 05 '22 10:01 normen

Just to add here: https://github.com/Rhymen/go-whatsapp/issues/622 seems it will be deprecated in favor of https://github.com/tulir/whatsmeow

sfrique avatar Feb 04 '22 19:02 sfrique

Yeah, I saw that, I guess thats the best way forward. It will mean a lot of changes to whatscli as well but thats also a chance to clean up the message database part. But maybe tulir has other plans as well, he's got a nice matrix client for the command line, maybe he'll integrate whatsapp support, that would make whatscli obsolete then.

normen avatar Feb 04 '22 19:02 normen

I was thinking maybe the best is to write whatsmeow support for weechat but not sure how hard it is.

All those webapps use too much ram =/

sfrique avatar Feb 04 '22 20:02 sfrique

I was thinking maybe the best is to write whatsmeow support for weechat but not sure how hard it is. Yeah, I was looking into using weechat back when I wrote whatscli. Adding perl or python based scripts is easy, adding native plugins less so. With golang in the mix things probably won't get easier.

All those webapps use too much ram =/ Agreed. Plus god knows if my laptop is mining dogecoin or whatever for Mark Z while its open 🙄

normen avatar Feb 04 '22 20:02 normen

I'm currently looking into using whatsmeow in whatscli, it seems to be reasonable effort and a good chance to clean the ugly in whatscli. I hope I'll find enough time in the next days.

normen avatar Feb 07 '22 15:02 normen

Initial work has begun in the whatsmeow branch - things seem to be basically working, theres still work to be done to implement the old commands and support extended messages though.

normen avatar Feb 09 '22 12:02 normen

Initial work has begun in the whatsmeow branch - things seem to be basically working, theres still work to be done to implement the old commands and support extended messages though.

please let us know when it's safe to test it

sfrique avatar Feb 09 '22 12:02 sfrique

Well you can try it, it shouldn't break anything in your current install. It will create two databases in the current folder (not in the config/settings folder yet).

The main remaining issues are:

  • Only login/send commands work
  • Message count/notification completely missing
  • Only basic text messages are received
  • Nothing is tested extensively so theres probably bugs

normen avatar Feb 09 '22 19:02 normen

Initial work has begun in the whatsmeow branch

Thanks for that @normen!


  • Only basic text messages are received

As of e249b112b69f8683bb1f9ddc9fda3387fab12ed6, I do receive all basic text messages at login time but I don't receive any new message after it, is there currently a way to reupdate the message panel?

I'm executing the app with go run .

cetinajero avatar Feb 15 '22 16:02 cetinajero

Nah not really apart from logging out, deleting the database and logging in again.

normen avatar Feb 15 '22 17:02 normen

any updates on the whatsmeow-branch , does it support multi-device?

jaitra1264 avatar Feb 24 '22 10:02 jaitra1264

any updates on the whatsmeow-branch , does it support multi-device?

Yes it does but it is a WIP

cetinajero avatar Feb 24 '22 15:02 cetinajero

I am willing trying to help on code, whats need to be done? Can we try set a TODO list @normen, so interessed people can try to help?

dostoievsky avatar Jun 29 '22 14:06 dostoievsky

I am willing trying to help on code, whats need to be done? Can we try set a TODO list @normen, so interessed people can try to help?

The main thing that needs to be done is storing received message info in a way that allows later recreating whatsmeows messages so extended info can be downloaded (e.g. Images etc). Currently we're storing messages in a backend-agnostic way. For downloading messages whatsmeow expects its own message "objects" and I didn't dig into whatsmeow too deep yet so I'm not sure how to best get from our data about the messages back to whatsmeows. In this thread I basically state whats missing, you'd have to dig into the code (and whatsmeow) anyway to get somewhere. Maybe look around in the code and ask me if anything is unclear.

normen avatar Jun 29 '22 14:06 normen

Theres also the general structure overview in the README for a general idea of what code does what: https://github.com/normen/whatscli/tree/whatsmeow#structure-overview

Its a bit outdated given that the backends are now completely separated from the session manager.

normen avatar Jun 29 '22 14:06 normen

Is the whatsmeow branch usable right now?

Timoyoungster avatar Aug 25 '22 19:08 Timoyoungster

I am willing trying to help on code, whats need to be done? Can we try set a TODO list @normen, so interessed people can try to help?

The main thing that needs to be done is storing received message info in a way that allows later recreating whatsmeows messages so extended info can be downloaded (e.g. Images etc). Currently we're storing messages in a backend-agnostic way. For downloading messages whatsmeow expects its own message "objects" and I didn't dig into whatsmeow too deep yet so I'm not sure how to best get from our data about the messages back to whatsmeows. In this thread I basically state whats missing, you'd have to dig into the code (and whatsmeow) anyway to get somewhere. Maybe look around in the code and ask me if anything is unclear.

what about we use the lime protocol for that?

https://limeprotocol.org/

dostoievsky avatar Sep 28 '22 22:09 dostoievsky

Hm, it would fit but it sounds like its a bit overblown for this use case, also whatsmeow already keeps its own database with all that info, its just about having the right pointers in "our" database to grab it again later.

Ofc this layer of abstraction isn't strictly necessary but if I had implemented it properly in the first version of whatscli then the whatsmeow version would already be running now 😄

normen avatar Sep 29 '22 10:09 normen

@normen How can we debug the process while running it with go run . ?

dostoievsky avatar Jan 23 '23 14:01 dostoievsky

Depends on your dev setup, I am using vim and debug the oldschool way, by using a lot of console output :)

In case you didn't follow the discussion, I think its best to rely completely on whatsmeows database and remove the abstraction, basically only keeping the UI part of whatscli. That way we'd be completely dependent on whatsmeow but we should be able to get results much quicker I suppose.

normen avatar Jan 23 '23 21:01 normen

By "rely completely on whatsmeows..." you mean we should delete the "messages" folder completly and re-write it as whatsmeows implementation?

I am not used to GO but I already read some of the code, the Whatscli UI is created almost at the main.go file, correctly?

So we must rely only on the "backends folder with whatsmeow implementation and rewrite the whole message application?

dostoievsky avatar Jan 24 '23 16:01 dostoievsky

Basically, yes. So this would simply be a whatsmeow frontend going along with its idiosyncrasies.

normen avatar Jan 26 '23 09:01 normen

Normen, I'll try to study to whatsmeow API and see if I can start something!

I guess this is the Go Horse solution, if I had any sucess contribuing to this I think we can discuss better abstractions to the project.

Thanks for the chating.

dostoievsky avatar Jan 26 '23 14:01 dostoievsky