You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We run a chat bot that only messages users. There is no need for the bot to be in a team on our mattermost server.
If the bot is not in the configured team (and not a mattermost admin), this line https://github.com/errbotio/err-backend-mattermost/blob/master/mattermost.py#L346 will throw an error. You should add a proper error message what is wrong. Removing this one line allowed our bot to run perfectly until I took a bit deeper into the issue.
You should add an option for the bot to not belong to a team, e.g., by leaving the team empty.
The text was updated successfully, but these errors were encountered:
For posterity as I'm sure @a-gerhard has moved on from this issue, but it seems like the requirement for a bot to be hard-coded to a specific team is not any sort of technical requirement, but a design decision that's enforced by a single if statement.
If you know what you're doing (which is essentially giving this bot access to every team, which may have unacceptable security implications for your use case), you can bypass it. Here's my workaround:
In err-backend-mattermost.py, I found this line:
# In some cases (direct messages) team_id is an empty string
if data["team_id"] != "" and self.teamid != data["team_id"]:
log.info(
"Message came from another team ({}), ignoring...".format(
data["team_id"]
)
)
return
and above that, I added this line of code:
# Adding this to bypass the following check.
# Hacky, but had to make sure the bot can respond to messages across teams.
self.teamid = data["team_id"]
So now, over in config.py, just put any existing team for BOT_IDENTITY. No matter where an event comes from, that check will think it came from the configured team.
We run a chat bot that only messages users. There is no need for the bot to be in a team on our mattermost server.
The text was updated successfully, but these errors were encountered: