Skip to content

Instantly share code, notes, and snippets.

@PandaWhoCodes
Created December 21, 2016 04:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PandaWhoCodes/00c8d15ed3ad2cf3d628aa6b3b78110e to your computer and use it in GitHub Desktop.
Save PandaWhoCodes/00c8d15ed3ad2cf3d628aa6b3b78110e to your computer and use it in GitHub Desktop.
TO find the slack bot ID
import os
from slackclient import SlackClient
BOT_NAME = 'YOUR BOT NAME WHICH YOU GAVE EXAMPLE @SOMETHINGBOT'
slack_client ="YOUR API KEY"
if __name__ == "__main__":
api_call = slack_client.api_call("users.list")
if api_call.get('ok'):
users = api_call.get('members')
for user in users:
if 'name' in user and user.get('name') == BOT_NAME:
print("Bot ID for '" + user['name'] + "' is " + user.get('id'))
else:
print("could not find bot user with the name " + BOT_NAME)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment