Created
June 25, 2018 16:06
-
-
Save chrisbay/90e228e89c659bf17d6b1f3e84ff3f36 to your computer and use it in GitHub Desktop.
Get a Slackbot's ID
This file contains hidden or 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
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