I’ve recently started looking into Mattermost as an alternative for one of our ideas (embed a chat inside an app). So far it’s working just as we wanted, so we started testing it’s API in order to automate some processes.
As of now, I’m trying to add a user to a channel and it’s returning me an error that doesn’t actually make a lot of sense… The issue I’m having is exactly the same pointed out here: Add User to Channel with APIv4 endpoint however in my case it is a private channel, also created via API.
I was getting the same error I linked to, with “Response: No team member found for that user ID and team ID.”. However I’m trying to reproduce it in order to paste the error here and now I’m getting a different error… I can query channels and users by name, create users and teams, but the endpoint for “add user to channel” returns me a “session expired error”.
I’m testing every request using the same environment with the same personal access token.
If you mean the fact that he was trying to add the user to a group and not an open/private channel, yes. But in my case, it is a private channel, so I’m not sure what could be causing this.
More importantly, I’ve tried resetting everything, since the error actually changed to a 401 Unauthorized as I mentioned before, but nothing changed, I’m still getting a 401 error when trying to add to a channel, while other endpoints no longer work.
Another info is the fact that I’ve tried creating a new channel, and it returns the same 401 error.
So, summarizing, “Add user to a channel” and “Create a new channel” endpoints return me a 401 error, while creating and listing users and teams work just fine…