Reputation: 2003
I have used channels.invite
method to add a user to a slack channel. After the user has been added, I have used channels.kick
method to remove the user from the channel. But the slack returns an error:
restricted_action: A team preference prevents the authenticated user from kicking.
What could be the reason that I could not remove a user from a channel?
Upvotes: 6
Views: 1989
Reputation: 32852
You can define for your workspace which roles can kick users from a channel. The default is admin / owner.
This can be set under Administration / Workspace Settings / Permissions / Channel Management if your user have the necessary rights to change it.
Apparently the user that owns your API token does not have the required role.
See the help article Remove someone from a channel for details.
Upvotes: 5