Skip to content

Commit b0857a3

Browse files
committed
fix(slack): keep channel listing independent of credential storage
1 parent f15777d commit b0857a3

7 files changed

Lines changed: 23 additions & 47 deletions

File tree

apps/docs/content/docs/integrations/slack.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -956,15 +956,15 @@ Rename the Slack agent session associated with a thread.
956956

957957
### Slack List Channels
958958

959-
List accessible Slack conversations. Credential-group user tokens also return one-to-one and group direct messages.
959+
List accessible public and private Slack channels.
960960

961961
#### Input
962962

963963
| Parameter | Type | Required | Description |
964964
| --------- | ---- | -------- | ----------- |
965965
| `authMethod` | string | No | Authentication method: oauth or bot_token |
966966
| `botToken` | string | No | Bot token for Custom Bot |
967-
| `includePrivate` | boolean | No | Include private channels the bot is a member of \(default: true\) |
967+
| `includePrivate` | boolean | No | Include private channels the connected account can access \(default: true\) |
968968
| `excludeArchived` | boolean | No | Exclude archived channels \(default: true\) |
969969
| `limit` | number | No | Maximum number of channels to return \(default: 100, max: 200\) |
970970
| `cursor` | string | No | Pagination cursor from a previous response.next_cursor |
@@ -973,7 +973,7 @@ List accessible Slack conversations. Credential-group user tokens also return on
973973

974974
| Parameter | Type | Description |
975975
| --------- | ---- | ----------- |
976-
| `channels` | array | Accessible public and private channels, plus direct and group DMs for credential-group user tokens |
976+
| `channels` | array | Accessible public and private channels |
977977
|`id` | string | Conversation ID \(for example, C123, D123, or G123\) |
978978
|`name` | string | Channel or group-DM name; omitted for one-to-one direct messages |
979979
|`is_channel` | boolean | Whether this is a channel |
@@ -997,8 +997,8 @@ List accessible Slack conversations. Credential-group user tokens also return on
997997
|`is_user_deleted` | boolean | Whether the other participant in a direct message is deactivated |
998998
|`is_open` | boolean | Whether a direct or group-direct-message conversation is open |
999999
|`priority` | number | Slack sidebar sort priority |
1000-
| `ids` | array | Conversation IDs for every returned channel or DM |
1001-
| `names` | array | Names of returned channels and group DMs; one-to-one DMs have no name |
1000+
| `ids` | array | Conversation IDs for every returned channel |
1001+
| `names` | array | Names of returned channels |
10021002
| `count` | number | Total number of conversations returned |
10031003
| `nextCursor` | string | Cursor for the next page; null if no more pages |
10041004

apps/sim/tools/generated/tool-metadata.ts

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

apps/sim/tools/generated/tool-outputs.ts

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

apps/sim/tools/slack/list_channels.test.ts

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -17,27 +17,16 @@ function requestUrl(params: SlackListChannelsParams): URL {
1717
}
1818

1919
describe('Slack list channels', () => {
20-
it('includes direct and group DMs only for credential-group OAuth users', () => {
21-
expect(requestUrl(BASE_PARAMS).searchParams.get('types')).toBe('public_channel,private_channel')
22-
expect(requestUrl({ ...BASE_PARAMS, credentialType: 'oauth' }).searchParams.get('types')).toBe(
23-
'public_channel,private_channel'
24-
)
25-
expect(
26-
requestUrl({ ...BASE_PARAMS, credentialType: 'service_account' }).searchParams.get('types')
27-
).toBe('public_channel,private_channel')
28-
expect(
29-
requestUrl({ ...BASE_PARAMS, credentialType: 'managed_oauth' }).searchParams.get('types')
30-
).toBe('public_channel,private_channel,im,mpim')
31-
})
32-
33-
it('keeps the private-channel toggle independent from managed DM access', () => {
34-
const url = requestUrl({
35-
...BASE_PARAMS,
36-
credentialType: 'managed_oauth',
37-
includePrivate: false,
38-
})
39-
expect(url.searchParams.get('types')).toBe('public_channel,im,mpim')
40-
})
20+
it.each([undefined, 'oauth', 'managed_oauth', 'service_account'])(
21+
'does not request DM scopes based on credential storage type %s',
22+
(credentialType) => {
23+
const params = { ...BASE_PARAMS, credentialType }
24+
expect(requestUrl(params).searchParams.get('types')).toBe('public_channel,private_channel')
25+
expect(requestUrl({ ...params, includePrivate: false }).searchParams.get('types')).toBe(
26+
'public_channel'
27+
)
28+
}
29+
)
4130

4231
it('rejects invalid limits and empty cursors before the provider request', () => {
4332
expect(() => requestUrl({ ...BASE_PARAMS, limit: 0 })).toThrow(

apps/sim/tools/slack/list_channels.ts

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -84,16 +84,14 @@ export const slackListChannelsTool: ToolConfig<SlackListChannelsParams, SlackLis
8484
{
8585
id: 'slack_list_channels',
8686
name: 'Slack List Channels',
87-
description:
88-
'List accessible Slack conversations. Credential-group user tokens also return one-to-one and group direct messages.',
87+
description: 'List accessible public and private Slack channels.',
8988
version: '1.1.0',
9089

9190
oauth: {
9291
required: true,
9392
provider: 'slack',
9493
/** Slack enforces the required scope for the target conversation type. */
9594
requiredScopes: [],
96-
authoritativeParams: ['credentialType'],
9795
},
9896

9997
params: {
@@ -115,17 +113,11 @@ export const slackListChannelsTool: ToolConfig<SlackListChannelsParams, SlackLis
115113
visibility: 'hidden',
116114
description: 'OAuth access token or bot token for Slack API',
117115
},
118-
credentialType: {
119-
type: 'string',
120-
required: false,
121-
visibility: 'hidden',
122-
description: 'Credential type supplied by authorized token resolution',
123-
},
124116
includePrivate: {
125117
type: 'boolean',
126118
required: false,
127119
visibility: 'user-or-llm',
128-
description: 'Include private channels the bot is a member of (default: true)',
120+
description: 'Include private channels the connected account can access (default: true)',
129121
},
130122
excludeArchived: {
131123
type: 'boolean',
@@ -154,9 +146,6 @@ export const slackListChannelsTool: ToolConfig<SlackListChannelsParams, SlackLis
154146
if (resolveBooleanParam(params.includePrivate, 'Include private channels', true)) {
155147
conversationTypes.push('private_channel')
156148
}
157-
if (params.credentialType === 'managed_oauth') {
158-
conversationTypes.push('im', 'mpim')
159-
}
160149
url.searchParams.set('types', conversationTypes.join(','))
161150
url.searchParams.set(
162151
'exclude_archived',
@@ -204,21 +193,20 @@ export const slackListChannelsTool: ToolConfig<SlackListChannelsParams, SlackLis
204193
outputs: {
205194
channels: {
206195
type: 'array',
207-
description:
208-
'Accessible public and private channels, plus direct and group DMs for credential-group user tokens',
196+
description: 'Accessible public and private channels',
209197
items: {
210198
type: 'object',
211199
properties: CONVERSATION_LIST_OUTPUT_PROPERTIES,
212200
},
213201
},
214202
ids: {
215203
type: 'array',
216-
description: 'Conversation IDs for every returned channel or DM',
204+
description: 'Conversation IDs for every returned channel',
217205
items: { type: 'string', description: 'Slack conversation ID' },
218206
},
219207
names: {
220208
type: 'array',
221-
description: 'Names of returned channels and group DMs; one-to-one DMs have no name',
209+
description: 'Names of returned channels',
222210
items: { type: 'string', description: 'Slack conversation name' },
223211
},
224212
count: {

apps/sim/tools/slack/types.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,6 @@ interface SlackBaseParams {
661661
authMethod: 'oauth' | 'bot_token'
662662
accessToken: string
663663
botToken: string
664-
credentialType?: 'oauth' | 'managed_oauth' | 'service_account'
665664
}
666665

667666
export type SlackAgentSessionStatus = 'active' | 'processing' | 'suspended' | 'closed'

packages/deployment-config/src/integrations.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22197,7 +22197,7 @@
2219722197
},
2219822198
{
2219922199
"name": "List Channels",
22200-
"description": "List accessible Slack conversations. Credential-group user tokens also return one-to-one and group direct messages."
22200+
"description": "List accessible public and private Slack channels."
2220122201
},
2220222202
{
2220322203
"name": "List Channel Members",

0 commit comments

Comments
 (0)