kishore
kishore

Reputation: 413

How to get user info with bot token

I am using python slack client to connect and send messages with a bot application.

slc = SlackClient("BOT_USER_TOKEN")
out = slc.api_call(method='users.profile.get', user='XXX')

I am getting not_allowed_token_type error in output json. I am able to call:

slc.api_call(method='chat.PostMessage',channel)

Is there a way to get user email, name from slack API. previously I got the username from event messages. but now I am getting only user id so I am looking for a solution to fetch user info using that id.

Upvotes: 1

Views: 2167

Answers (1)

Erik Kalkoken
Erik Kalkoken

Reputation: 32852

The reason you get this error message is that users.profile.get does not work with bot tokens.

To mitigate just use the user token that you received along with your bot token when installing your Slack app.

Upvotes: 2

Related Questions