Skip to content

Instantly share code, notes, and snippets.

@chrisbay
Created June 25, 2018 16:06
Show Gist options
  • Save chrisbay/90e228e89c659bf17d6b1f3e84ff3f36 to your computer and use it in GitHub Desktop.
Save chrisbay/90e228e89c659bf17d6b1f3e84ff3f36 to your computer and use it in GitHub Desktop.
Get a Slackbot's ID
from slackclient import SlackClient
BOT_NAME = # provide your bot's name/handle, without the @
slack_client = SlackClient(os.getenv('SLACK_BOT_TOKEN'))
api_call = slack_client.api_call("users.list")
if api_call.get('ok'):
users = api_call.get('members')
for row in reader:
for user in users:
if 'name' in user and user.get('name') == BOT_NAME:
print(user.get('id'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment