Skip to content

Commit 16a4f37

Browse files
authored
feat(slack): add better error messages, reminder to add bot to app (#1990)
1 parent 6c56d48 commit 16a4f37

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

apps/sim/tools/slack/message_reader.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,23 @@ export const slackMessageReaderTool: ToolConfig<
8888
transformResponse: async (response: Response) => {
8989
const data = await response.json()
9090

91+
if (!data.ok) {
92+
if (data.error === 'not_in_channel') {
93+
throw new Error(
94+
'Bot is not in the channel. Please invite the Sim bot to your Slack channel by typing: /invite @Sim Studio'
95+
)
96+
}
97+
if (data.error === 'channel_not_found') {
98+
throw new Error('Channel not found. Please check the channel ID and try again.')
99+
}
100+
if (data.error === 'missing_scope') {
101+
throw new Error(
102+
'Missing required permissions. Please reconnect your Slack account with the necessary scopes (channels:history, groups:history).'
103+
)
104+
}
105+
throw new Error(data.error || 'Failed to fetch messages from Slack')
106+
}
107+
91108
const messages = (data.messages || []).map((message: any) => ({
92109
// Core properties
93110
type: message.type || 'message',

0 commit comments

Comments
 (0)