Search code examples
pythonpython-2.7slackslack-api

Remove user from a slack team [API]


I need to remove user from slack team (totally), via API using Python. Recently I've found the undocumented methods https://github.com/ErikKalkoken/slackApiDoc But users.admin.setInactive is not working correctly. It seems that there is no such method, because I get an AttributeError: 'UsersAdmin' object has no attribute 'setInactive' Is there any way to achieve my goal?


Solution

  • Unfortunately this method is not available for Slack teams that use the free tier, so I can not fully test it. However, I am still getting the error "paid_only" when I call it, which would suggest that the API method itself does exist.

    Based on your error it sounds more like in error in the implementation of the access layer to the API (e.g. if you are using 3rd party library it may not include this method).

    You can verify by calling the method directly, which should work if you are on a paid tier:

    https://slack.com/api/users.admin.setInactive?token=TOKEN&user=U12345678
    

    If that works your issue is in the access layer of your code / the 3rd party library you are using.