matterbridge icon indicating copy to clipboard operation
matterbridge copied to clipboard

WhatsApp bridge: Rate-Overlimit

Open totallynotdavid opened this issue 2 years ago • 13 comments

I don't know if the problem is caused by Matterbridge or WhatsApp.

Apparently there is a WhatsApp gateway entry limit of 5. If more than 5 gateways are added, the WhatsApp bridge does not start due to the following error:

Starting gateway failed: bridge whatsapp.mywhatsapp failed to join channel: info query returned status 429: rate-overlimit

Steps to reproduce the behavior:

  1. Add more than 5 WhatsApp gateways
  2. Matterbridge ends abruptly.

A clear and concise description of what you expected to happen.

  1. Add more than 5 WhatsApp gateways
  2. Matterbridge starts gateways normally.

Last lines from the output when running: matterbridge -debug:

[0020]  WARN whatsapp:     [Connect:C:/Users/xx/go/pkg/mod/github.com/42wim/[email protected]/bridge/whatsappmulti/whatsapp.go:139] Could not get profile photo of [email protected]: failed to get avatar: the user has hidden their profile picture from you
[0021]  INFO whatsapp:     [Connect:C:/Users/xx/go/pkg/mod/github.com/42wim/[email protected]/bridge/whatsappmulti/whatsapp.go:149] Finished getting avatars..
[0021]  INFO whatsapp:     [joinChannels:C:/Users/xx/go/pkg/mod/github.com/42wim/[email protected]/bridge/bridge.go:77] whatsapp.mywhatsapp: joining [email protected] (ID: [email protected])
[0022]  INFO whatsapp:     [joinChannels:C:/Users/xx/go/pkg/mod/github.com/42wim/[email protected]/bridge/bridge.go:77] whatsapp.mywhatsapp: joining [email protected] (ID: [email protected])
[0022]  INFO whatsapp:     [joinChannels:C:/Users/xx/go/pkg/mod/github.com/42wim/[email protected]/bridge/bridge.go:77] whatsapp.mywhatsapp: joining [email protected] (ID: [email protected])
[0022]  INFO whatsapp:     [joinChannels:C:/Users/xx/go/pkg/mod/github.com/42wim/[email protected]/bridge/bridge.go:77] whatsapp.mywhatsapp: joining [email protected] (ID: [email protected])
[0023]  INFO whatsapp:     [joinChannels:C:/Users/xx/go/pkg/mod/github.com/42wim/[email protected]/bridge/bridge.go:77] whatsapp.mywhatsapp: joining [email protected] (ID: [email protected])
[0023]  INFO whatsapp:     [joinChannels:C:/Users/xx/go/pkg/mod/github.com/42wim/[email protected]/bridge/bridge.go:77] whatsapp.mywhatsapp: joining [email protected] (ID: [email protected])
[0023] FATAL main:         [main:C:/Users/xx/go/pkg/mod/github.com/42wim/[email protected]/matterbridge.go:66] Starting gateway failed: Bridge whatsapp.mywhatsapp failed to join channel: info query returned status 429: rate-overlimit

Environment (please complete the following information):

  • Windows 11, Ubuntu 20.04
  • Version: 1.25.2-dev
  • go install -tags whatsappmulti github.com/42wim/matterbridge@master

Additional context Please add your configuration file (be sure to exclude or anonymize private data (tokens/passwords))

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

    [[gateway.in]]  # First gateway
    account="whatsapp.mywhatsapp"
    channel="[email protected]"

    [[anothergateway.in]]
    XXXXX
    XXXXX

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

    [[anothergateway.in]]
    XXXXX
    XXXXX

    [[gateway.out]]  # Second gateway
    account="whatsapp.mywhatsapp"
    channel="[email protected]"

    [[gateway.out]]  # Thirdgateway
    account="whatsapp.mywhatsapp"
    channel="[email protected]"

... and so on

ADITIONAL NOTES: It was working fine until today when I deleted the 'device' (whatsmeow) from the list of LINKED DEVICES on WhatsApp. Added it again and the error started to appear.

totallynotdavid avatar Jun 08 '22 08:06 totallynotdavid

Same here, using the last version of matterbridge, from telegram to whatsapp multi device.

david-botelho-mariano avatar Jun 09 '22 02:06 david-botelho-mariano

Same issue here too. We are using the latest version of matterbridge to bridge messages between Whatsapp and Mattermost

snikpic avatar Jun 09 '22 07:06 snikpic

Same issue here too after restart.

Waldelf avatar Jun 11 '22 21:06 Waldelf

Try go install -tags whatsappmulti github.com/42wim/matterbridge@master again, I've just updated the whatsmeow library.

42wim avatar Jun 11 '22 21:06 42wim

Doesn't work, compiled a new container with: docker build https://github.com/42wim/matterbridge.git --file Dockerfile_whatsappmulti

Same Issue: time="2022-06-11T21:32:32Z" level=fatal msg="Starting gateway failed: Bridge whatsapp.mywhatsapp failed to join channel: info query returned status 429: rate-overlimit" prefix=main

Waldelf avatar Jun 11 '22 21:06 Waldelf

@Waldelf this is using multiple whatsapp accounts right? not with just 1 whatsapp bridge?

42wim avatar Jun 11 '22 21:06 42wim

@42wim Just one Whatsapp Account, but 8 groups bridged to Telegram (8 Gateways)

Waldelf avatar Jun 11 '22 21:06 Waldelf

My configuration was: 1 phone number from India, from 1 group on telegram to 9 groups on whatsapp (multi device)

*I haven't tested this new commit yet.

david-botelho-mariano avatar Jun 11 '22 21:06 david-botelho-mariano

@42wim When I reduce the number of Gateways to 4 matterbridge with whatsapp gateway starts nomaly

Waldelf avatar Jun 11 '22 22:06 Waldelf

@Waldelf ok, well nothing much I can do right now, whatsapp seems to be ratelimiting

42wim avatar Jun 11 '22 22:06 42wim

The solution I found was to send from 1 group on telegram to only 1 group on whatsapp using matterbridge, then I used whatsmeaw pure library to forward to the 9 groups I need, basically the code is that I wait for the message (on message event) and then use the forward method of whatsmeaw.

@42wim

david-botelho-mariano avatar Jun 11 '22 22:06 david-botelho-mariano

I have the same error. When Matterbridge gets started, I always get the notification "Could not get profile photo of ...". Why are these requests necessary and would it help to disable these requests? Another idea would be to wait between requests to avoid the ratelimit. Matterbridge worked for me with 6 groups, but restarting it does not work. So it seems for me that only the start is the problem.

sirdrakeistda avatar Jul 03 '22 21:07 sirdrakeistda

My solution was to run two matterbridges the same time. This is not an ideal solution, but it works without problem on the same device (you have two register matterbridge for each instance on whatsapp).

sirdrakeistda avatar Jul 07 '22 15:07 sirdrakeistda

Would it be possible to implement a rate-limter during the bridge startup? So that for each whatsapp group you could define to wait for 5 seconds for example before the bridge requests the information.

Schmurki avatar Jan 11 '23 14:01 Schmurki