Created
December 21, 2016 04:45
-
-
Save PandaWhoCodes/00c8d15ed3ad2cf3d628aa6b3b78110e to your computer and use it in GitHub Desktop.
TO find the slack bot ID
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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