errbotio / err-backend-mattermost

GNU General Public License v3.0
42 stars 22 forks source link

Allow a bot to communicate across several teams #41

Closed deborahgu closed 4 years ago

deborahgu commented 5 years ago

We need a single instance of a bot which communicates in channels for any team where it is present on the server. This change makes the ability to communicate across teams into a boolean setting.

Vaelor commented 5 years ago

I am not a 100% sure about that either. I had an initial version (not sure if these commits ever made it to GitHub), where I had an option for multiple teams and I ran into issues all over the place (this was with Mattermost API v3). Not sure if it is still as annoying. Would like to check that first. Also, I would probably make a config option, not directly in the code.

deborahgu commented 5 years ago

I definitely agree about config option, I just wasn't sure of the right place to put things.

It seems to work in testing but my use cases might be very simple. Do you remember where you ran into issues? I can stress test more thoroughly.

deborahgu commented 5 years ago

Hmm, I've found one of the failure modes of this getting a channel list; I'm testing a fix for it and once I do I'll see if I can find any more.

Specifically, the concept of getting a channel ID by channel name is problematic if you don't know the team. I'm going to investigate the API to see if there's enough information in the message that you can live without this.

Would you rather I close this PR since a fix for this is clearly not ready for prime time, or keep it open so the discussion exists whilst I debug?

Vaelor commented 5 years ago

We can leave this PR open, sure.

AFAIK I always had to look up which team I now need to respond to, which at least in the v3 version of the mattermost api wasn't always so easy. (If I recall correctly you couldn't message users across teams like you can do now).

Also, I was concerned about things like !history - the bot would show you things from the other team - or channels from the other team, even if it felt like they should be seperated. Sure, that may or may not be a problem, depending on the setup.

I am trying to find out what other issues I had, but they may not be relevant anymore with the switch from v3 to v4 in the mattermost api.

The websocket events could be problematic as well, since they could come from other teams, too - and plugins dealing with those events probably wouldn't be able to just call send anymore since you would need to pass some team information into the send part. https://api.mattermost.com/#tag/WebSocket

The question I asked myself at that time was (after failing to implement that - I wanted to do that at first, too): If the line between the two teams is so thin, that the teams have the same (bot)-admin, and sharing possible information across teams isn't a problem, ... - why have multiple teams at all?