Can I create a link on a web-page to dm someone on slack? (in a specific work-space)

拜拜、爱过 提交于 2020-01-24 10:38:05

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!