Rafa Viotti
Rafa Viotti

Reputation: 10522

Is a Slack channel id unique across teams?

Is a Slack channel/group/im/mpim id unique across different teams? In other words, can two teams have channels with the same id?

I read the docs, searched on Google and here on SO, but could not get confirmation if channel IDs are unique or not.

Upvotes: 14

Views: 4282

Answers (2)

mxxk
mxxk

Reputation: 10264

Update (May 2021)

While certain Slack API methods (e.g. conversations.info and users.info) operate on a channel ID and do not require a team ID, it is possible that they infer the team ID based on the provided Slack token ("user", "bot", "classic bot") which is scoped to the Slack team. (Thanks @zizzo for pointing this out in the comments below.)

Original Post (March 2020)

Interestingly, the Slack API methods conversations.info and users.info only accept a channel ID or user ID, without a team ID. This suggests that scoping by team IDs may not actually be necessary.

Since the conversations.info method did not exist[1] (not publicly, anyway) at the time of Taylor Singletary's original answer, the guidance regarding ID scoping may have changed since then.

Footnotes

  1. Deprecating early methods in favor of the Conversations API. https://api.slack.com/changelog/2020-01-deprecating-antecedents-to-the-conversations-api

    We released the Conversations API in September 2017 as a one-size-fits-all replacement for a variety of APIs used to read and write information about channels, private channels, direct messages, and multi-party direct messages.

Upvotes: 2

Taylor Singletary
Taylor Singletary

Reputation: 2296

Slack plans to clarify this in documentation soon. While in the present day you'd probably get by just fine assuming IDs are unique across different teams, we strongly recommend scoping all of your storage and retrieval by team ID.

Essentially, we recommend considering IDs as only unique within teams, regardless of if experientially they are globally unique.

This is the best way to protect yourself for the future.

Upvotes: 16

Related Questions