1

I am creating a bot in aws-lex and will integrate it with Slack, FB Workplace and Yammer to start with.

I need to read the Slack user email address, then validate that against our webservice to ensure the user is registered. This will return some data about the users organisation that I need for further execution in lex.

I have no idea how to pass/extract the Slack user email (the one that is engaging in conversation with my Bot).

Any ideas?? Examples please! New to bot dev.

  • 2
    Welcome to Stackoverflow! Please be advised that this is not a coding service. If you want help from the community, please provide your existing code and state what your issues are exactly. If you are new to Slack, check out the Slack [tutorials](https://api.slack.com/tutorials) and the excellent Slack [API documentation](https://api.slack.com/). One hint specific to your problem: You can get the email from a user with this API method: [users.info](https://api.slack.com/methods/users.info) – Erik Kalkoken Nov 21 '17 at 10:59

1 Answers1

3

At least for slack you could do:

Under requestAttributes (from event) you can check the presence of x-amz-lex:channel-type. The value will be Slack if the user comes from slack.

You can then extract the user slack id from the event that is submitted to your lambda under the key userId

With that id, go to Slack API and call the method users.info. Now you can get the user email from the response.

paulosuzart
  • 1,082
  • 2
  • 13
  • 28
  • I do see x-amz-lex:channel-type under requestAttributes, but am not getting userId in the event. My bot has below permissions chat:write im:history team:read, users.profile:read users:read users:read.email Is there anything else i need to do to get userId/user email in the lamda event? – vasu Mar 16 '23 at 13:58