admin管理员组文章数量:1297036
For context, I'm using the Bolt for JavaScript framework to develop a Slack bot. I have a workspace where I'm the only member.
In the app home, I need to retrieve the current user's email address, but I'm not sure how to do that.
WebAPI methods for users for example, users.profile.get and users.identity, require a user token, I suppose I need to get the user token of the current user.
Any ideas on how to retrieve the user token from the backend? Suggestions would be appreciated.
For context, I'm using the Bolt for JavaScript framework to develop a Slack bot. I have a workspace where I'm the only member.
In the app home, I need to retrieve the current user's email address, but I'm not sure how to do that.
WebAPI methods for users for example, users.profile.get and users.identity, require a user token, I suppose I need to get the user token of the current user.
Any ideas on how to retrieve the user token from the backend? Suggestions would be appreciated.
Share Improve this question asked Aug 13, 2021 at 3:44 Aj ThomasAj Thomas 431 silver badge5 bronze badges 1- Wele S. Thomas, it would be easier to help if we can see some code that you have tried. Links to Bolt documentation and the exact section you are working on solving a problem about would also help. What is this token you're talking about, where does it e from and where is the documentation for that? Etc. – anatolhiman Commented Aug 13, 2021 at 3:48
1 Answer
Reset to default 9Instead of a user token, I'd remend using a bot token to call users.info
(https://api.slack./methods/users.info). You will need to request the users:read
and the users:read.email
scopes in order for the email to be returned in the API call. When you install your app on your Workspace your bot token will appear in the OAuth & Permissions page of your Developer Config site (https://api.slack./apps). Your app should be listening for the app_home_opened
event. When a user opens the App Home the user_id
will be returned in the event payload. You can then use that user_id
to call users.info
and get the user email.
版权声明:本文标题:How to get the current user email address for Slack bot using Bolt for JavaScript(Node.JS) - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741647944a2390300.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论