Get hosting team of an incoming shared channel

12 Views Asked by At

I need the ID of the team that hosts an incoming shared channel but I only have the channel ID and the ID of the team that this channel is shared with.

E.g. TeamA is sharing its ChannelA with TeamB. I have the ID of TeamB and need the ID of TeamA.

My app is using application permissions with client secret. The app has ChannelMember.Read.All permission with admin consent (and many more permissions).

I can list all the channels with .../TeamB-id/allChannels

The response does contain the ID of the incoming shared ChannelA

I can get details of this channel without problems via

.../TeamB-id/channels/ChannelA-id/

But the response doesn't contain the ID of the hosting team (i.e. of TeamA).

The sharedWithTeams endpoint should return what I need. But .../TeamB-id/channels/ChannelA-id/sharedWithTeams fails with the error

"No channel is found for channelId or user is not member of channel if in user context: 'ChannelA-id'"

However, if I use TeamA (the hosting team) for the sharedWithTeams endpoint, then I get a result. But since I don't have the TeamA-id, this is not an option.

Is there an alternative for creating my own Channel-id/Team-id mapping by querying all channels for all teams?

0

There are 0 best solutions below