Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: Slack Connect channels and token storage #1370

Closed
inf3rnus opened this issue Nov 4, 2021 · 3 comments
Closed

Question: Slack Connect channels and token storage #1370

inf3rnus opened this issue Nov 4, 2021 · 3 comments
Labels
question M-T: User needs support to use the project

Comments

@inf3rnus
Copy link

inf3rnus commented Nov 4, 2021

Hey there Slack team!

Couldn't find a better place to put this, so thought I'd ask here...

For Slack bots that perform chat unfurls, there seems to be no way to get uniquely identifying information for a given message in a Slack Connect channel.

In a typical channel (non Slack Connect channel), if you're keeping track of multiple bot tokens in a database, you can you can simply store a slack bot token against a slackTeamId (or if you want to support multiple channels, you could nest that by locating slack tokens with a slackTeamId and a channelId) so that you're able to use the right token for a given unfurl event.

However, this model breaks down completely when using a bot to perform unfurls in a Slack Connect channel, as the event object that's received by your webhook can have a different slackTeamId than the team that own's the Slack Connect channel depending on the user that writes a message to the channel...

For anyone whose part of the team that uses the Slack Connect channel, their unfurls will work using the previous model, but will not work for anyone who's not part of the team, but has been invited to the channel, as their slackTeamId will be different.

Now, what is "unique" is the channelId that's returned from the unfurl event, but channelId's are not guaranteed to be unique across different teams, only within a team.

So... What I'm wondering is what the right approach to this is, or if using channelIds is a reasonable decision? (The chance of a collision seems astronomically low, but... wouldn't want any end users to experience a catastrophe.)

Any thoughts/info would be greatly appreciated!

Thanks,
Aaron

@inf3rnus inf3rnus changed the title Slack connect channels and token storage Question: Slack Connect channels and token storage Nov 4, 2021
@seratch seratch added question M-T: User needs support to use the project and removed untriaged labels Nov 5, 2021
@seratch
Copy link
Member

seratch commented Nov 5, 2021

Hi @inf3rnus, thanks for writing in!

I can definitely relate to what you mention here. The team_id etc. in the event payloads coming from a Slack Connect shared channels are quite confusing. A good news is that there is certainly a way to know the workspace (team_id) that installed your app.

Please refer to the following issue and pull requests for details but long story short, you can use $.authorizations[0].team_id to know the correct team_id.

I hope this was helpful to you.

@seratch
Copy link
Member

seratch commented Nov 12, 2021

Hi @inf3rnus, was my above comment helpful to you? If you have any follow ups, please let us know! If we don't hear back for a while, we may close this issue due to inactivity.

@seratch
Copy link
Member

seratch commented Nov 19, 2021

Let us close this issue now but please feel free to write in if you have any follow ups!

@seratch seratch closed this as completed Nov 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question M-T: User needs support to use the project
Projects
None yet
Development

No branches or pull requests

2 participants