I'm writing a Script for Hubot using the Slack API
How can I get the mentioned user's email (@ben for example) from a message?
I've figured out I can do something like:
user.profile.email
To get the current user, but I'm not sure about searching for others or getting a profile based on a mention
In order to get the email for a Slack user you need to
users.list
Note that your access token needs both the users:read
and users:read.email
scopes in order to retrieve that information. See also here for more info about scopes and here for detail on email address access.