Problem retrieving user email
DonEmil opened this issue · comments
I have used this script before and:
email = msg.message.user.pagerdutyEmail || msg.message.user.email_address
used to work and picked up Slack users emails from msg.message.user.email_address
I recently changed bot and it no longer works, it seems as if msg.message.user.email_address
returns "undefined"
changed msg.message.user.email_address
to msg.message.user.profile.email
which fixed it
Hmm. The slack
adapter (or Hubot core) should be disambiguating this as much as possible so that there is One True Way™ to get the email address for a user.
I think it depends on what version of slack adapter you use, the newer one (^4.0.0) requires msg.message.user.profile.email