Skip to content

Commit e09cc6c

Browse files
committed
fix(slack): address PR review comments on conversation tools
1 parent 1c864e0 commit e09cc6c

3 files changed

Lines changed: 27 additions & 40 deletions

File tree

apps/sim/tools/slack/create_conversation.ts

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,10 @@
1-
import type { SlackCreateConversationParams } from '@/tools/slack/types'
1+
import type {
2+
SlackCreateConversationParams,
3+
SlackCreateConversationResponse,
4+
} from '@/tools/slack/types'
25
import { CHANNEL_OUTPUT_PROPERTIES } from '@/tools/slack/types'
36
import type { ToolConfig } from '@/tools/types'
47

5-
interface SlackCreateConversationResponse {
6-
success: boolean
7-
output: {
8-
channel: {
9-
id: string
10-
name: string
11-
is_private: boolean
12-
is_archived: boolean
13-
is_member: boolean
14-
topic: string
15-
purpose: string
16-
created: number
17-
creator: string
18-
}
19-
}
20-
}
21-
228
export const slackCreateConversationTool: ToolConfig<
239
SlackCreateConversationParams,
2410
SlackCreateConversationResponse
@@ -137,8 +123,8 @@ export const slackCreateConversationTool: ToolConfig<
137123
is_member: ch.is_member || false,
138124
topic: ch.topic?.value || '',
139125
purpose: ch.purpose?.value || '',
140-
created: ch.created ?? null,
141-
creator: ch.creator ?? null,
126+
created: ch.created,
127+
creator: ch.creator,
142128
},
143129
},
144130
}

apps/sim/tools/slack/invite_to_conversation.ts

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,10 @@
1-
import type { SlackInviteToConversationParams } from '@/tools/slack/types'
1+
import type {
2+
SlackInviteToConversationParams,
3+
SlackInviteToConversationResponse,
4+
} from '@/tools/slack/types'
25
import { CHANNEL_OUTPUT_PROPERTIES } from '@/tools/slack/types'
36
import type { ToolConfig } from '@/tools/types'
47

5-
interface SlackInviteToConversationResponse {
6-
success: boolean
7-
output: {
8-
channel: {
9-
id: string
10-
name: string
11-
is_private: boolean
12-
is_archived: boolean
13-
is_member: boolean
14-
topic: string
15-
purpose: string
16-
created: number
17-
creator: string
18-
}
19-
}
20-
}
21-
228
export const slackInviteToConversationTool: ToolConfig<
239
SlackInviteToConversationParams,
2410
SlackInviteToConversationResponse
@@ -149,9 +135,10 @@ export const slackInviteToConversationTool: ToolConfig<
149135
is_member: ch.is_member || false,
150136
topic: ch.topic?.value || '',
151137
purpose: ch.purpose?.value || '',
152-
created: ch.created ?? null,
153-
creator: ch.creator ?? null,
138+
created: ch.created,
139+
creator: ch.creator,
154140
},
141+
...(data.errors?.length ? { errors: data.errors } : {}),
155142
},
156143
}
157144
},
@@ -162,5 +149,18 @@ export const slackInviteToConversationTool: ToolConfig<
162149
description: 'The channel object after inviting users',
163150
properties: CHANNEL_OUTPUT_PROPERTIES,
164151
},
152+
errors: {
153+
type: 'array',
154+
description: 'Per-user errors when force is true and some invitations failed',
155+
optional: true,
156+
items: {
157+
type: 'object',
158+
properties: {
159+
user: { type: 'string', description: 'User ID that failed' },
160+
ok: { type: 'boolean', description: 'Always false for error entries' },
161+
error: { type: 'string', description: 'Error code for this user' },
162+
},
163+
},
164+
},
165165
},
166166
}

apps/sim/tools/slack/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1051,6 +1051,7 @@ export interface SlackCreateConversationResponse extends ToolResponse {
10511051
export interface SlackInviteToConversationResponse extends ToolResponse {
10521052
output: {
10531053
channel: SlackChannel
1054+
errors?: Array<{ user: string; ok: boolean; error: string }>
10541055
}
10551056
}
10561057

0 commit comments

Comments
 (0)