Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
tareko opened this issue Sep 19, 2024 · 2 comments
Labels

Comments

@tareko
Copy link

tareko commented Sep 19, 2024

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

  • Enable login mode and configure a 2-way bridge between mattermost and whatever else.
  • Send a message from the other side of the bridge to mattermost. Works every time
  • Send a message from mattermost to the other service. Will only work if both the user and the bot are logged into the same replica.

Expected behavior
Messages should hit the bridge in both directions.

Environment (please complete the following information):

  • OS: Kubernetes with mattermost operator

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 tareko added the bug label Sep 19, 2024
@tareko
Copy link
Author

tareko commented Sep 19, 2024

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 = "[email protected]"

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

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

# Whatsapp
   [[gateway.in]]
   account = "whatsapp.glia"
   channel = "[email protected]"

@test8t
Copy link

test8t commented Oct 30, 2024

Hello. I have a same problem with mattermost and telegram.
After receive message in telegram matterbridge doesn't send message to mattermost

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

[[gateway.in]]
account="telegram.work"
chatid=-XXXXXXXXXXX

[[gateway.out]]
account="mattermost.work"
channel="matterbridge"

[0572] DEBUG telegram: [handleRecv:bridge/telegram/handlers.go:175] == Receiving event: &tgbotapi.Message{MessageID:92, From:(*tgbotapi.User)(0xc0004d0420), SenderChat:(*tgbotapi.Chat)(nil), Date:1730291959, Chat:(*tgbotapi.Chat)(0xc0004b6870), ForwardFrom:(*tgbotapi.User)(nil), ForwardFromChat:(*tgbotapi.Chat)(nil), ForwardFromMessageID:0, ForwardSignature:"", ForwardSenderName:"", ForwardDate:0, IsAutomaticForward:false, ReplyToMessage:(*tgbotapi.Message)(nil), ViaBot:(*tgbotapi.User)(nil), EditDate:0, HasProtectedContent:false, MediaGroupID:"", AuthorSignature:"", Text:"bega", Entities:[]tgbotapi.MessageEntity(nil), Animation:(*tgbotapi.Animation)(nil), Audio:(*tgbotapi.Audio)(nil), Document:(*tgbotapi.Document)(nil), Photo:[]tgbotapi.PhotoSize(nil), Sticker:(*tgbotapi.Sticker)(nil), Video:(*tgbotapi.Video)(nil), VideoNote:(*tgbotapi.VideoNote)(nil), Voice:(*tgbotapi.Voice)(nil), Caption:"", CaptionEntities:[]tgbotapi.MessageEntity(nil), Contact:(*tgbotapi.Contact)(nil), Dice:(*tgbotapi.Dice)(nil), Game:(*tgbotapi.Game)(nil), Poll:(*tgbotapi.Poll)(nil), Venue:(*tgbotapi.Venue)(nil), Location:(*tgbotapi.Location)(nil), NewChatMembers:[]tgbotapi.User(nil), LeftChatMember:(*tgbotapi.User)(nil), NewChatTitle:"", NewChatPhoto:[]tgbotapi.PhotoSize(nil), DeleteChatPhoto:false, GroupChatCreated:false, SuperGroupChatCreated:false, ChannelChatCreated:false, MessageAutoDeleteTimerChanged:(*tgbotapi.MessageAutoDeleteTimerChanged)(nil), MigrateToChatID:0, MigrateFromChatID:0, PinnedMessage:(*tgbotapi.Message)(nil), Invoice:(*tgbotapi.Invoice)(nil), SuccessfulPayment:(*tgbotapi.SuccessfulPayment)(nil), ConnectedWebsite:"", PassportData:(*tgbotapi.PassportData)(nil), ProximityAlertTriggered:(*tgbotapi.ProximityAlertTriggered)(nil), VoiceChatScheduled:(*tgbotapi.VoiceChatScheduled)(nil), VoiceChatStarted:(*tgbotapi.VoiceChatStarted)(nil), VoiceChatEnded:(*tgbotapi.VoiceChatEnded)(nil), VoiceChatParticipantsInvited:(*tgbotapi.VoiceChatParticipantsInvited)(nil), ReplyMarkup:(*tgbotapi.InlineKeyboardMarkup)(nil)} [0572] DEBUG telegram: [handleRecv:bridge/telegram/handlers.go:237] <= Sending message from Dr5ty on telegram.work to gateway [0572] DEBUG telegram: [handleRecv:bridge/telegram/handlers.go:238] <= Message is config.Message{Text:"bega", Channel:"-XXXXXXXXX", Username:"XXXXX", UserID:"XXXXXX", Avatar:"", Account:"telegram.work", Event:"", Protocol:"", Gateway:"", ParentID:"", Timestamp:time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), ID:"92", Extra:map[string][]interface {}{}}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants