I am currently in 5 slack organisations and wanted to automate setting my status across all the orgs simultaneously. Unfortunately Slack have deprecated personal api tokens… You may also be in an environment where slack apps are tightly controlled.
Don’t lose hope though - with a bit of l33t h4x0ring you can get a personal bearer token from the web UI!
Log into slack in a browser with devtools available (a URL like https://your-org.slack.com)
Boot up dev tools and inspect the cookies.
Copy the value of the
d=
cookie.Run SlackPirate.py with the
--cookie
flag to find the bearer token for all the slack organisations the account has access to.$ python SlackPirate.py --cookie=Io%2FEQqmUW9%2B72jxbNIBfM1bVq29qxxx This cookie has access to the following Workspaces: URL: https://foo.slack.com/ Token: xoxs-... (not admin) URL: https://bar.slack.com/ Token: xoxs-... (not admin) URL: https://baz.slack.com/ Token: xoxs-... (not admin)
The
xoxs-
value is the bearer token.Test this against the
auth.test
endpoint.curl -H 'Authorization: Bearer xoxs-...' -XGET \ https://slack.com/api/auth.test
If you get a response back with your account details you’re all set! Check out the API docs here - https://api.slack.com/methods/