What is the simplest way to find a slack team ID and a channel ID?
Asked Answered
Y

11

172

We are trying to setup deep linking into slack, as described here:

https://api.slack.com/docs/deep-linking

The document states that to open a specific team, the following URL should be used:

slack://open?team={TEAM_ID}

Open Slack and switch teams to the specified team. The provided TEAM_ID should be a string, like T12345.

Furthermore, to open a channel in a team, the following URL should be used:

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.

My question is simple. Where can I find out what TEAM_ID I need and what CHANNEL_ID I need?

Yeager answered 2/12, 2016 at 20:27 Comment(3)
Depending on how you're doing it, you should be able to retrieve a POST with all of the info you need: api.slack.com/outgoing-webhooks for exampleCoetaneous
The accepted answer no longer works in 2019. Please consider changing the accepted answer to @SamuelDev response, which does work. https://mcmap.net/q/129507/-what-is-the-simplest-way-to-find-a-slack-team-id-and-a-channel-idAdviser
Thanks @Adviser ! Just did it, sorry for the delay.Yeager
K
90

As of July 2019, it seems like the team id and the channel id is already being shown via the web.

enter image description here

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.

Klimt answered 29/7, 2019 at 2:29 Comment(3)
This is the only approach that worked for me in 2019.Adviser
NOTE: you don't really need to fire up the web UI -- just Copy link to any message in the public channel of interest in the your client app of choice -- and inspect the resultant URLPotamic
@AntonK hmmm im not sure how to do that though. I tried that in my slack windows app (v4.2.0). I copied a link to one of the messages in one of our public channels, and the URL looked like this: https://team.slack.com/archives/C########/p################. I Can probably get the channel id, but not the team id.Klimt
T
157

Here is the easiest way to manually find the slack IDs

1. Any channel ID

Open the slack webpage (http://yourteam.slack.com) and then simply open the channel. The channel ID is displayed in the browser URL:

get any channel ID


2. Any user ID

To find a user ID you 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":

get any user 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)

get team members user ID


3. Team 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:

get the team ID

Tristichous answered 3/7, 2017 at 10:31 Comment(8)
Thanks @Paulin'tHout - somehow I confused team-ID with user-ID... I updated the answer to also describe how to quickly get the team IDTristichous
For finding the channel ID and team ID, per the original question, this is definitely the quickest and easiest and should be the accepted answer.Airliner
looks like the url formats may have changed to app.slack.com/client/<team_id>/<channel_id>/details/…Vet
Hey @Philipp, while this works! The slack developer tool makes this much easier. I would recommend checking my answer here and consider including it in your answer, thanks in advance 😊Aloeswood
Currently even easier: go to yourteam.slack.com/messages, then open any channel. The URL will be formatted as https://app.slack.com/client/<team ID>/<channel ID>.Macur
Uncaught ReferenceError: boot_data is not definedBlockhouse
For team/user group ID you can just open the user group in Slack Web. The url is going to have user_groups/[user group ID] at the endChino
I noticed that in latest Slack desktop there is now a button to copy group ID. Go to More => Your Organization => People => Groups and choose group you want. On side panel there is Edit Members button and beside it there is small ... with dropdown. Inside there is Copy group ID element.Theatrical
K
90

As of July 2019, it seems like the team id and the channel id is already being shown via the web.

enter image description here

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.

Klimt answered 29/7, 2019 at 2:29 Comment(3)
This is the only approach that worked for me in 2019.Adviser
NOTE: you don't really need to fire up the web UI -- just Copy link to any message in the public channel of interest in the your client app of choice -- and inspect the resultant URLPotamic
@AntonK hmmm im not sure how to do that though. I tried that in my slack windows app (v4.2.0). I copied a link to one of the messages in one of our public channels, and the URL looked like this: https://team.slack.com/archives/C########/p################. I Can probably get the channel id, but not the team id.Klimt
E
81

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)

https://my.slack.com/messages

The <a> tag that links to a user tends to include a data-member-id attribute, the content of which is the user 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.

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.

Basically, it's all hidden in plain sight. You just need to know where to look ;)

Etienne answered 4/12, 2016 at 23:44 Comment(11)
Thanks! Thats the easiest method I have seen so far!Yeager
the team_domain information is missing :( they might have removed it?Goodspeed
@Goodspeed I still seem to be able to find it. What exactly are you attempting? :)Etienne
Excellent suggestion! I found it hard to parse through all of the HTML elements, especially for the TEAM_ID, but looking at the XHR requests in Chrome Dev Tools found what I needed right away. Check the response from auth.currentSessions for the TEAM_ID and channels.info or pins.list for the CHANNEL_ID.Finicky
Very smart solution. I don't see it, though. Navigated to https://my.slack.com/messages then Developer > Source (in Chrome). Search shows only this block: // called by ssb when online var proceedToApp = function(last_team_domain_arg) { // do nothing, we're already in the app }Postgraduate
Ahh sorry I didn't literally mean team_domain. I meant the team_domain that my resolves to in my.slack.com/messagesEtienne
Even following @WilhelmKlopp reply I had a hard time finding the team ID. For me the easiest way was: 1. search for api_token on the page source and copy that code 2. open this in the browser: https://slack.com/api/auth.test?pretty=1&token=<token-from-prev-step-here> 3. on the response copy team_id valueMuse
The above answer no longer works for determining Team ID. Use the answer from @Mbb instead.Intine
Finding the team_id this way still works for me just FYI. All you need to know is your team_domain, which should be obvious.Etienne
I found team_id searching for it in the page source. It was in an object called boot_data.Anabolite
Why is this data not more easily accessible on the website? This makes no sense to meSchoolgirl
P
39

The answer marked correct here does not work for me, but I may have found an even easier way with test tokens.

  1. Create a test token: https://api.slack.com/docs/oauth-test-tokens

  2. Scroll down to the "try it now!" button. You land on auth.test: https://api.slack.com/methods/auth.test/test

  3. Choose the team you want to test and click Test Method. You can find your team_id (and user_id) there.

  4. Do the same for channels.list. You can click "View Another Method" and search or go to: https://api.slack.com/methods/channels.list/test

  5. Choose the team again and Test Method. Cmd+F through the channels object looking for whatever channel_ids you need.

Postgraduate answered 14/1, 2017 at 17:45 Comment(2)
Thanks, this was, for me, the easiest method.Karankaras
The token link no longer works and seems to be deprecated.Cohe
A
32

The easiest way to get the team and channel id and is to add slack developer tool app to your slack, you can can it here.

After adding it all you simply need to do is go to any channel and choose this command

/sdt whoami

It will output a snippet like this one.

There are much more commands and other things you can perform with this slack app, I would highly recommend it if you're building any integrations for slack.

Aloeswood answered 28/9, 2020 at 8:16 Comment(3)
How come this one has so few upvotes? Thanks a million @realappie.Damnation
I tried that, but the link seems to be dead as of 2021 :(Gregory
@J.Gwinner The old link didn't work anymore sadly, I just corrected it to the new link of the slack app. Which can be found at sdt.builtbyslack.comAloeswood
W
27

As of 2017, it looks like slack made it easier to find.

Here is the easiest way to manually find the Team IDs.

Visit your slack room via a web browser. Right Click > "View Source"

And search for Team_id:

Waverly answered 27/7, 2017 at 1:45 Comment(0)
G
18

If you are using the Slack app you can simply right click on the channel name in the left menu and click Copy link, paste it somewhere and you will see the channel id.

Gules answered 6/10, 2020 at 1:59 Comment(1)
Just to add a little to this answer link will look like thishttps://netmediagroup.slack.com/archives/CHANNELID. This was the easiest for me I didn't want to install an app. ThanksSteve
R
17

You can also simply right-click on the slack channel (or direct message) in the desktop App and select the 'Copy Link' option.

This will give you a URL of the form: https://org.slack.com/messages/[channel-ID]

I attest this works on High Sierra Mac OSX - Slack 3.1.1

Rub answered 1/5, 2018 at 23:54 Comment(1)
This is by far the best and simplest answer. ThanksRenfrew
H
4

Team ID

The easiest way to get your team ID is to use the Slack API method auth.test with your access token.

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.

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.

Histolysis answered 2/12, 2016 at 21:39 Comment(2)
It's lame that Slack doesn't provide a lookup channels by name method. Their FAQ just suggests itterating over the entire list of channels to find the one you want: See "How do I find a channel's ID if I only have its #name? " at api.slack.com/faqIntine
@CamdenS.: You can now with the newly added interactive menu feature. Check out my corresponding answer: Channel auto-completeHistolysis
A
2
  • Click ▼ (Get channel details)
  • Scroll to the bottom
  • See Channel ID

channel details

channel id

Anuria answered 23/6, 2023 at 0:12 Comment(0)
W
1

If you've come here looking for how to access these values via the API for a specific user (like me!) using the @slack/bolt package - here's an example of how to do it.

Team ID & Channel ID & User ID

app.message('hello'),
  async ({ say, body, context, message }) => {
  const teamResponse: any = await app.client.team.info({
    token: context.botToken,
    user: message.id,
  });

  // An object containing the team data that Slack has stored
  const team: SlackGeneratedTeam = teamResponse.team;

  // User ID
  console.log(message.id)

  // Team ID
  console.log(team.id)

  // channel ID
  console.log(message.channel)
})
Weiner answered 16/12, 2020 at 13:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.