Skip to content

Instantly share code, notes, and snippets.

@1davidmichael
Created March 20, 2018 20:19
Show Gist options
  • Save 1davidmichael/f12a867f6ca06188eec479ee39637968 to your computer and use it in GitHub Desktop.
Save 1davidmichael/f12a867f6ca06188eec479ee39637968 to your computer and use it in GitHub Desktop.
Find recent Slack logins for a particular user
from slackclient import SlackClient
user = "username goes here"
slack_token = os.environ["SLACK_API_TOKEN"]
sc = SlackClient(slack_token)
response = sc.api_call(
"team.accessLogs",
count=1000
)
for login in response['logins']:
if login['username'] == user:
print(login)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment