mirror of
https://github.com/simstudioai/sim.git
synced 2026-04-06 03:00:16 -04:00
feat(slack): add better error messages, reminder to add bot to app (#1990)
This commit is contained in:
@@ -88,6 +88,23 @@ export const slackMessageReaderTool: ToolConfig<
|
||||
transformResponse: async (response: Response) => {
|
||||
const data = await response.json()
|
||||
|
||||
if (!data.ok) {
|
||||
if (data.error === 'not_in_channel') {
|
||||
throw new Error(
|
||||
'Bot is not in the channel. Please invite the Sim bot to your Slack channel by typing: /invite @Sim Studio'
|
||||
)
|
||||
}
|
||||
if (data.error === 'channel_not_found') {
|
||||
throw new Error('Channel not found. Please check the channel ID and try again.')
|
||||
}
|
||||
if (data.error === 'missing_scope') {
|
||||
throw new Error(
|
||||
'Missing required permissions. Please reconnect your Slack account with the necessary scopes (channels:history, groups:history).'
|
||||
)
|
||||
}
|
||||
throw new Error(data.error || 'Failed to fetch messages from Slack')
|
||||
}
|
||||
|
||||
const messages = (data.messages || []).map((message: any) => ({
|
||||
// Core properties
|
||||
type: message.type || 'message',
|
||||
|
||||
Reference in New Issue
Block a user