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.58k stars 614 forks source link

Mattermost on Kubernetes with multiple replicas does not reliably report messages to bridge #2187

Open tareko opened 1 week ago

tareko commented 1 week ago

Describe the bug When a message is written in mattermost, if the Kubernetes replica is not the same one matterbridge is logged into, then it does not capture and transmit the message.

To Reproduce

Expected behavior Messages should hit the bridge in both directions.

Environment (please complete the following information):

Additional context I believe this can be solved by using a webhook in one direction and the bot in the other direction. I will try this and perhaps submit a PR to the readme regarding this if it works.

tareko commented 1 week ago

I can confirm that outgoing webhooks resolved the above issue. I ultimately had to use two bridges, one for 'in' and one for 'out. Here is a sample from my toml, where mattermost.sample-send is using the outgoing webhook:

[[gateway]]
name="from-mm"
enable=true

# Mattermost
    [[gateway.in]]
    account="mattermost.sample-send"
    channel="town-square"

# Whatsapp
   [[gateway.out]]
   account = "whatsapp.sample"
   channel = "xxxx@g.us"

[[gateway]]
name="to-mm"
enable=true

# Mattermost
    [[gateway.out]]
    account="mattermost.sample"
    channel="town-square"

# Whatsapp
   [[gateway.in]]
   account = "whatsapp.glia"
   channel = "xxx@g.us"