Html 查找 Slack 团队 ID 和频道 ID 的最简单方法是什么?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/40940327/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What is the simplest way to find a slack team ID and a channel ID?
提问by lfboulanger
We are trying to setup deep linking into slack, as described here:
我们正在尝试将深度链接设置为 slack,如下所述:
https://api.slack.com/docs/deep-linking
https://api.slack.com/docs/deep-linking
The document states that to open a specific team, the following URL should be used:
该文档指出,要打开特定团队,应使用以下 URL:
slack://open?team={TEAM_ID}
Open Slack and switch teams to the specified team. The provided TEAM_ID should be a string, like T12345.
slack://open?team={TEAM_ID}
打开 Slack 并切换团队到指定团队。提供的 TEAM_ID 应该是一个字符串,如 T12345。
Furthermore, to open a channel in a team, the following URL should be used:
此外,要在团队中打开频道,应使用以下 URL:
slack://channel?team={TEAM_ID}&id={CHANNEL_ID}
Open the channel specified by the CHANNEL_ID provided in the id field, like C024BE91L. You must also specify the team with a TEAM_ID.
slack://channel?team={TEAM_ID}&id={CHANNEL_ID}
打开 id 字段中提供的 CHANNEL_ID 指定的频道,如 C024BE91L。您还必须使用 TEAM_ID 指定团队。
My question is simple. Where can I find out what TEAM_ID I need and what CHANNEL_ID I need?
我的问题很简单。在哪里可以找到我需要的 TEAM_ID 和我需要的 CHANNEL_ID?
采纳答案by SamuelDev
As of July 2019, it seems like the team id and the channel id is already being shown via the web.
截至 2019 年 7 月,似乎团队 ID 和频道 ID 已通过网络显示。
As you can see in the screenshot, the 2nd to the last node is the team id(prefixed with "T") and the last node is the channel id(prefixed with "C"). All you have to do is open slack via the web, go to the specific channel, and you can see the url change to something close to the screenshot above.
正如您在屏幕截图中看到的,倒数第二个节点是团队 ID(以“T”为前缀),最后一个节点是频道 ID(以“C”为前缀)。您所要做的就是通过网络打开 slack,转到特定频道,您可以看到 url 更改为与上面的屏幕截图接近的内容。
回答by Philipp
Here is the easiest way to manually find the slack IDs
这是手动查找 slack ID 的最简单方法
1. Any channel ID
1.任何频道ID
Open the slack webpage (http://yourteam.slack.com) and then simply open the channel. The channel IDis displayed in the browser URL:
打开 slack 网页 ( http://yourteam.slack.com),然后打开频道。的信道ID被显示在浏览器URL:
2. Any user ID
2.任何用户ID
To find a user IDyou need to open your browser dev-tools console and inspect the user-link in the sidebar. The user ID can be found in the HTML attribute "data-member-id":
要查找用户 ID,您需要打开浏览器开发工具控制台并检查侧栏中的用户链接。用户 ID 可以在 HTML 属性“data-member-id”中找到:
Or in slack: (1) Click on the users name and choose (2) "Show Profile". Then open the "..." menu and you see the option (3) "Copy Member-ID ..." - to get your own user ID via the UI, you have to click the Team-Logo in top-left corner and then choose "Profile & Account" (this is not included in the screenshot)
或在 slack 中:(1) 单击用户名并选择 (2)“显示个人资料”。然后打开“...”菜单,您会看到选项 (3)“复制会员 ID...” -要通过 UI 获取您自己的用户 ID,您必须单击左上角的 Team-Logo然后选择“个人资料和帐户”(这不包括在屏幕截图中)
3. Team ID
3.团队ID
Simply open the dev-tools of your browser, switch to the "Console" tab and enter the text boot_data.team_id
into the console. This will display your team ID:
只需打开浏览器的开发工具,切换到“控制台”选项卡,然后boot_data.team_id
在控制台中输入文本。这将显示您的团队 ID:
回答by Wilhelm Klopp
Slightly different answer to the existing ones.
与现有答案略有不同。
Whenever I wanted to just find out quickly what the relevant ids are for a specific team, I just opened the Slack web client and inspected the relevant elements. (Using Chrome Dev Tools)
每当我想快速找出特定团队的相关 id 时,我只需打开 Slack 网络客户端并检查相关元素。(使用 Chrome 开发工具)
The <a>
tag that links to a user tends to include a data-member-id
attribute, the content of which is the user id.
<a>
链接到用户的标签往往包含一个data-member-id
属性,其内容是用户 ID。
The same holds true for channels. If you inspect any of the channels in the sidebar, you can see they are ordered as <li>
list elements each containing the channel id in the class name.
对于渠道也是如此。如果您检查侧栏中的任何频道,您可以看到它们按<li>
列表元素排序,每个元素在类名称中包含频道 ID。
For the team id, you can open the entire source of the slack web client and CTRL-F for your team_domain
(e.g. myslack55
for myslack55.slack.com
) and that should find you the team id.
对于团队 id,您可以打开 slack Web 客户端的整个源代码并为您的team_domain
(例如myslack55
for myslack55.slack.com
)打开 CTRL-F ,这应该会找到您的团队 id。
Basically, it's all hidden in plain sight. You just need to know where to look ;)
基本上,这一切都隐藏在显眼的地方。你只需要知道在哪里看;)
回答by mbb
The answer marked correct here does not work for me, but I may have found an even easier way with test tokens.
此处标记为正确的答案对我不起作用,但我可能已经找到了一种更简单的测试令牌方法。
Create a test token: https://api.slack.com/docs/oauth-test-tokens
Scroll down to the "try it now!" button. You land on
auth.test
: https://api.slack.com/methods/auth.test/testChoose the team you want to test and click Test Method. You can find your
team_id
(anduser_id
) there.Do the same for
channels.list
. You can click "View Another Method" and search or go to: https://api.slack.com/methods/channels.list/testChoose the team again and Test Method. Cmd+Fthrough the
channels
object looking for whateverchannel_id
s you need.
创建一个测试令牌:https: //api.slack.com/docs/oauth-test-tokens
向下滚动到“立即尝试!” 按钮。你登陆
auth.test
:https: //api.slack.com/methods/auth.test/test选择您要测试的团队,然后单击测试方法。你可以在那里找到你的
team_id
(和user_id
)。对
channels.list
. 您可以点击“查看另一种方法”并搜索或访问:https: //api.slack.com/methods/channels.list/test再次选择团队和测试方法。Cmd+F通过
channels
对象寻找channel_id
你需要的任何东西。
回答by Rocky Kev
回答by Joel
You can also simply right-click on the slack channel (or direct message) in the desktop App and select the 'Copy Link' option.
您也可以简单地在桌面应用程序中右键单击 slack 频道(或直接消息),然后选择“复制链接”选项。
This will give you a URL of the form: https://org.slack.com/messages/[channel-ID]
这将为您提供表单的 URL:https: //org.slack.com/messages/[channel-ID]
I attest this works on High Sierra Mac OSX - Slack 3.1.1
我证明这适用于 High Sierra Mac OSX - Slack 3.1.1
回答by Erik Kalkoken
Team ID
团队标识
The easiest way to get your team ID is to use the Slack API method auth.testwith your access token.
获取团队 ID 的最简单方法是将 Slack API 方法auth.test与访问令牌一起使用。
Channel ID
频道编号
Depends on if you want a public or private channel you can call the respective Slack API method to get a list of all channels incl. their IDs.
取决于您想要公共频道还是私人频道,您可以调用相应的 Slack API 方法来获取所有频道的列表,包括。他们的身。
- Public channel: channels.list
- Private channel: groups.list
- 公共频道:channels.list
- 私人频道:groups.list
Note that you can only see private channels in which the user/bot that belongs to your access token has been invited into.
请注意,您只能看到属于您的访问令牌的用户/机器人已被邀请进入的私人频道。
Accesss Token
访问令牌
To get the access token you can either request a "test token" on the Slack API page under "Test Token" (only recommended for testing purposes by Slack). Or you can create a Slack app and install that app for your Slack team using Oath which will also generate an app specific access token.
要获取访问令牌,您可以在“测试令牌”下的 Slack API 页面上请求“测试令牌”(仅 Slack 推荐用于测试目的)。或者您可以创建一个 Slack 应用程序并使用 Oath 为您的 Slack 团队安装该应用程序,这也将生成一个应用程序特定的访问令牌。