meinto / whatsapp-signal-bridge

Forward your Whatsapp messages to a separate Signal chat and reply to Whatsapp by quoting received messages.
MIT License
54 stars 4 forks source link

Cannot connect to WhatsApp #1

Open cobordism opened 2 years ago

cobordism commented 2 years ago

On first startup I get the following error:

$ ./bot --bot="+NUM1" --receiver="+NUM2" 
2021-10-16 18:14:39 debug   client  [signal] new subscription to whatsapp
2021-10-16 18:14:39 debug   queue   new subscription
error during login: error decoding login resp: json: cannot unmarshal array into Go value of type map[string]interface {}

I see this error message being discussed in the repos for go-whatsapp. Perhaps a fix from there must be ported here?

cobordism commented 2 years ago

as a fix, edit file whatsapp/setup.go and add wac.SetClientVersion(2, 2123, 7) in a new line right after wac, err = whatsapp.NewConn(5 * time.Second)

cobordism commented 2 years ago

That latest error can be fixed by using the code from: https://github.com/Rhymen/go-whatsapp/commit/8029c28f5c5a82145e324af228ac64354f07b4e8

I changed the code at ~/github.com/*rhymen/go-whatsapp@v0.1.1/binary/token/token.go as in the commit above and then rebuilt the bot with go build -a -o bot ..

The logs now say:

login successful, session: {BUNCH_OF_STUFF_HERE}
2021-10-17 00:32:45 debug   client  [whatsapp] new subscription to signal
2021-10-17 00:32:45 debug   queue   new subscription
2021-10-17 00:32:45 debug   client  [whatsapp] publish &{    service started <nil> <nil>} to whatsapp
2021-10-17 00:32:45 debug   queue   publish &{    service started <nil> <nil>} to whatsapp
2021-10-17 00:32:45 debug   queue   received message on whatsapp : &{    service started <nil> <nil>}
2021-10-17 00:32:45 debug   client  [signal] received message on whatsapp : &{    service started <nil> <nil>}
2021-10-17 00:32:45 debug   queue   received message on whatsapp : &{    service started <nil> <nil>}

but nothing arrives on my signal account.

I can receive signal messages manually using signal-cli, so I know that the registration of the phone number for signal worked... but alas the bridge still does not. work for me.

I'd welcome any help here.

DomeGamer14 commented 2 years ago

@cobordism Have you been able to fix this yet?

cobordism commented 2 years ago

Hi. Apologies for late reply. I have not been able to fix this yet. OTOH I have not really been trying recently. I wanted to spend some more time on it soon.

My goal would be for the bridge to create a new Signal group chat for every contact or group on whatsapp so that replying in that signal group passes the message along to the correct whatsapp contact. That should be easier to work with than having all messages arrive in one channel on the signal side.

pixincreate commented 2 years ago

2 would you care to reply to this as you've already used it before @cobordism ?

cobordism commented 2 years ago

I can see the whatsapp messages appearing in the nohup.out console log, so they are definitely being retrieved. However I do not receive anything on signal.

The output ends with

2022-02-02 19:31:06 debug   client  [signal] new subscription to whatsapp
2022-02-02 19:31:06 debug   queue   new subscription
error during login: error decoding login resp: json: cannot unmarshal array into Go value of type map[string]interface {}

I do not know how to proceed.