42wim / matterbridge

bridge between mattermost, IRC, gitter, xmpp, slack, discord, telegram, rocketchat, twitch, ssh-chat, zulip, whatsapp, keybase, matrix, microsoft teams, nextcloud, mumble, vk and more with REST API (mattermost not required!)
Apache License 2.0
6.56k stars 617 forks source link

telegram whatsapp bridge: [Client ERROR] Client outdated (405) connect failure #2175

Closed fabio841 closed 2 weeks ago

fabio841 commented 3 weeks ago

0000] INFO main: Running version 1.26.0 [0000] INFO router: Parsing gateway gateway1 [0000] INFO router: Starting bridge: whatsapp.mywhatsapp 13:36:59.744 [Client ERROR] Client outdated (405) connect failure [0003] INFO whatsapp: QR channel result: err-client-outdated [0005] INFO whatsapp: WhatsApp connection successful panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x12f5042]

goroutine 1 [running]: github.com/42wim/matterbridge/bridge/whatsappmulti.(Bwhatsapp).Connect(0xc000358fc0) /root/go/pkg/mod/github.com/42wim/matterbridge@v1.26.0/bridge/whatsappmulti/whatsapp.go:119 +0x622 github.com/42wim/matterbridge/gateway.(Router).Start(0xc000108780) /root/go/pkg/mod/github.com/42wim/matterbridge@v1.26.0/gateway/router.go:76 +0x35f main.main() /root/go/pkg/mod/github.com/42wim/matterbridge@v1.26.0/matterbridge.go:65 +0x39e

Why have this error ? I have launch command ./matterbridge -conf matterbridge.toml

fabio841 commented 3 weeks ago

solve incredible need update go!!!!!! First check version. send command go version if is old need update.

command is sudo snap install go --classic

if not work or have other bersion need remove before use: sudo apt-get purge golang-go sudo apt-get autoremove $ rm -rf /usr/lib/go $ rm -rf /usr/lib/go-1.13 $ rm -rf /usr/share/go $ rm -rf /usr/share/go-1.13 git clone https://github.com/udhos/update-golang cd update-golang sudo ./update-golang.sh

restart ubuntu now verify if version is update by command "go version"

later send command: sudo CGO_ENABLED=0 go install -tags nomsteams,whatsappmulti,nozulip github.com/42wim/matterbridge@master

if continue have problem with go module (go: command not found) need add this line in 2 file: profile and bash.bashrc:

write in terminal: sudo nano /etc/profile and add in bottom line export PATH=$PATH:/usr/local/go/bin CTRL+X save later sudo nano /etc/bash.bashrc and add in bottom line export PATH=$PATH:/usr/local/go/bin CTRL+X save

now reboot: sudo reboot send command: sudo CGO_ENABLED=0 go install -tags whatsappmulti github.com/42wim/matterbridge@master enter in folder home/go/bin

start command: ./matterbridge -debug -conf matterbridge.toml

QR CODE IS OK!!!!!

mujeebcpy commented 3 weeks ago

i updated everything but still getting error.

10:50:11.337 [Client/Socket ERROR] Error reading from websocket: websocket: close 1006 (abnormal closure): unexpected EOF
[0002]  INFO whatsapp:     [Connect:/home/nivadaily/go/pkg/mod/github.com/42wim/matterbridge@v1.26.1-0.20240524210809-d16645c9527a/bridge/whatsappmulti/whatsapp.go:106] QR channel result: timeout
10:50:11.338 [Client ERROR] Client outdated (405) connect failure (client version: 2.2412.50)
[0003]  INFO whatsapp:     [Connect:/home/nivadaily/go/pkg/mod/github.com/42wim/matterbridge@v1.26.1-0.20240524210809-d16645c9527a/bridge/whatsappmulti/whatsapp.go:123] WhatsApp connection successful
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x1477e66]

goroutine 1 [running]:
github.com/42wim/matterbridge/bridge/whatsappmulti.(*Bwhatsapp).Connect(0xc0000b0cc0)
        /home/nivadaily/go/pkg/mod/github.com/42wim/matterbridge@v1.26.1-0.20240524210809-d16645c9527a/bridge/whatsappmulti/whatsapp.go:125 +0x5e6
github.com/42wim/matterbridge/gateway.(*Router).Start(0xc00040ccd0)
        /home/nivadaily/go/pkg/mod/github.com/42wim/matterbridge@v1.26.1-0.20240524210809-d16645c9527a/gateway/router.go:76 +0x345
main.main()
        /home/nivadaily/go/pkg/mod/github.com/42wim/matterbridge@v1.26.1-0.20240524210809-d16645c9527a/matterbridge.go:65 +0x394
fabio841 commented 3 weeks ago

Have restart linux ? send sudo reboot command Try use this format into matterbridge.toml (change XXXXXXXXX with your data)

[telegram.mytelegram] Token="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"

Create new TG bot and put the API token above.

RemoteNickFormat="<{NICK}> " MessageFormat="HTMLNick >"

[whatsapp.mywhatsapp] Number="+XXXXXXXX" #insert mobile number in IDC format SessionFile="session-XXXXXXX.gob" ###insert mobile number in IDC format QrOnWhiteTerminal=false

[[gateway]] name="gateway1" enable=true

[[gateway.inout]] account="whatsapp.mywhatsapp" channel="XXXXXXXXXXXXX@g.us"

Essentially this is the 'ChatID' equivalent to TG. To obtain it is a little convoluted. Follow the steps from the video below

https://www.youtube.com/watch?v=W-VXISoKtNc

[[gateway.inout]] account="telegram.mytelegram" channel="-XXXXXXXXXXXX" #TG Group Chat ID. You will need to create a new Group Chat, assign the TG BOT created above to it and make it an admin of that group too.

Vetgans commented 3 weeks ago

Can confirm what @mujeebcpy experienced. I built the app with updated go as well, but got the same errors as described.

I'm bridging whatsapp to matrix, and at first sight it looks like whatsmeow has to be updated.

paxaman commented 3 weeks ago

same problem here. go update not solved the problem

[Client/Socket ERROR] Error reading from websocket: websocket: close 1006 (abnormal closure): unexpected EOF

fabio841 commented 3 weeks ago

first restart, send:

$sudo reboot later check version. send command: $ go version If no have 1.23 there is a problem

Vetgans commented 3 weeks ago

If no have 1.23 there is a problem

I did exactly as you told, used version 1.23.0, to no success.

IntGrah commented 3 weeks ago

I guess this is a dirty fix, the actual solution would be to bump the whatsmeow version. If you need a working binary asap, just clone my fork, and run go install -tags whatsappmulti,nomsteams,nozulip

Vetgans commented 3 weeks ago

Thanks for your effort! But a problem with the path occurs:

go install -tags nomsteams,nozulip,whatsappmulti github.com/IntGrah/matterbridge@master go: downloading github.com/IntGrah/matterbridge v0.0.0-20240823131055-5a0dade4652c go: github.com/IntGrah/matterbridge@master: version constraints conflict: github.com/IntGrah/matterbridge@v0.0.0-20240823131055-5a0dade4652c: parsing go.mod: module declares its path as: github.com/42wim/matterbridge but was required as: github.com/IntGrah/matterbridge

Maybe you could change that as well?

IntGrah commented 3 weeks ago

Thanks for your effort! But a problem with the path occurs:

go install -tags nomsteams,nozulip,whatsappmulti github.com/IntGrah/matterbridge@master go: downloading github.com/IntGrah/matterbridge v0.0.0-20240823131055-5a0dade4652c go: github.com/IntGrah/matterbridge@master: version constraints conflict: github.com/IntGrah/matterbridge@v0.0.0-20240823131055-5a0dade4652c: parsing go.mod: module declares its path as: github.com/42wim/matterbridge but was required as: github.com/IntGrah/matterbridge

Maybe you could change that as well?

go install -tags <tags> <remote repo> doesn't seem to work with forks. You have to clone the repo first, and then run go install -tags <tags> without any additional args. Hope this helps.

naveenyeluru commented 3 weeks ago

@IntGrah Getting import lookup disabled error while installing post cloning the repo Snip20240823_1

IntGrah commented 3 weeks ago

@IntGrah Getting import lookup disabled error while installing post cloning the repo Snip20240823_1

My bad, I was messing around with changing the module name. It should work now.

Vetgans commented 3 weeks ago

My bad, I was messing around with changing the module name. It should work now.

And it does!! Many thanks for your efforts. :+1:

naveenyeluru commented 3 weeks ago

@IntGrah Getting import lookup disabled error while installing post cloning the repo Snip20240823_1

My bad, I was messing around with changing the module name. It should work now.

Its working now, thank you :)

mujeebcpy commented 2 weeks ago

@fabio841 Happy to see you are suggesting to view a video made by me :smile: ibcomputing is my channel and i made that tutorial

fabio841 commented 2 weeks ago

thanks @mujeebcpy Guys, if you have any concerns, the possibility of forwarding messages between a WhatsApp channel instead of a group should be implemented. In this regard, if it can be useful, I found this interesting discussion which allows you to extract the channel JID: https://github.com/WhiskeySockets/Baileys/issues/549

essentially the channel has an ID that can be easily searched via developer console and WhatsApp web and ends with @newslatter.

Do you think this feature could be added? This would make it possible to use a channel instead of a group. I tried replacing the "TG Group Chat ID" of the group that ends in @g.us with ID @newslatter in the matterbridge.toml file but it doesn't work.

mujeebcpy commented 2 weeks ago

@fabio841 ya. sending to channel is must now. i manage telegram channel so if i can use matterbridge to update my whatsapp channel in realtime it will be excellent.

fabio841 commented 2 weeks ago

only @42wim can help

Draganis commented 2 weeks ago

I have the exact same problem using Windows with go 1.23 Is there any solution by now?

IntGrah commented 2 weeks ago

I have the exact same problem using Windows with go 1.23 Is there any solution by now?

My fork has a temporary fix. Clone it and then run go install -tags whatsappmulti in the directory

Draganis commented 2 weeks ago

Thank you. It works now...

fabio841 commented 2 weeks ago

@IntGrah you think it's possible adding feature for bridge channel ? (no group) I tried replacing the "TG Group Chat ID" of the group that ends in @g.us with ID @newslatter in the matterbridge.toml file but it doesn't work.

fabio841 commented 2 weeks ago

it's possible usa https://github.com/pedroslopez/whatsapp-web.js for adding bridge with channel instead whatsmeow ?

42wim commented 2 weeks ago

Fixed in master now