1
votes

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.

1
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 and the excellent Slack API documentation. One hint specific to your problem: You can get the email from a user with this API method: users.info - Erik Kalkoken

1 Answers

3
votes

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.