问题
Can I create a link on a web-page to dm someone on slack? (in a specific work-space)
according to the documentation, something like this should work
<a href="slack://user?team=TEAM-ID&id=USER-ID" target="_blank">
click to dm me on slack
</a>
Where do I find the team id? Is it the subdomain in the workspace URL TEAM-ID.slack.com
When I tried this all it does is open slack to whatever was open last. I want it to open a direct message to the user whose user id is in the link.
Update: being that it is a little more complicated then I thought and I doubt I'll get a slack token from an admin, I'll be leaving it as is (just my slack username for people to find).
回答1:
The team_id
comes along with any payload coming from the API. So you can just grab it there and pass it along as part of your link.
If you're just wanting to hardcode something in a webpage, you can get the team_id
by calling the team.info
method (https://api.slack.com/methods/team.info) with a test token.
来源:https://stackoverflow.com/questions/50105252/can-i-create-a-link-on-a-web-page-to-dm-someone-on-slack-in-a-specific-work-sp