Skip to content

Commit e7b4da2

Browse files
authored
feat(slack): add email field to get user and list users tools (#3509)
* feat(slack): add email field to get user and list users tools * fix(slack): use empty string fallback for email and make type non-optional * fix(slack): comment out users:read.email scope pending app review
1 parent aa0101c commit e7b4da2

File tree

6 files changed

+17
-0
lines changed

6 files changed

+17
-0
lines changed

apps/docs/content/docs/en/tools/slack.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -590,6 +590,7 @@ List all users in a Slack workspace. Returns user profiles with names and avatar
590590
|`name` | string | Username \(handle\) |
591591
|`real_name` | string | Full real name |
592592
|`display_name` | string | Display name shown in Slack |
593+
|`email` | string | Email address \(requires users:read.email scope\) |
593594
|`is_bot` | boolean | Whether the user is a bot |
594595
|`is_admin` | boolean | Whether the user is a workspace admin |
595596
|`is_owner` | boolean | Whether the user is the workspace owner |
@@ -629,6 +630,7 @@ Get detailed information about a specific Slack user by their user ID.
629630
|`title` | string | Job title |
630631
|`phone` | string | Phone number |
631632
|`skype` | string | Skype handle |
633+
|`email` | string | Email address \(requires users:read.email scope\) |
632634
|`is_bot` | boolean | Whether the user is a bot |
633635
|`is_admin` | boolean | Whether the user is a workspace admin |
634636
|`is_owner` | boolean | Whether the user is the workspace owner |

apps/sim/lib/oauth/oauth.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -624,6 +624,7 @@ export const OAUTH_PROVIDERS: Record<string, OAuthProviderConfig> = {
624624
'im:history',
625625
'im:read',
626626
'users:read',
627+
// TODO: Add 'users:read.email' once Slack app review is approved
627628
'files:write',
628629
'files:read',
629630
'canvases:write',

apps/sim/lib/oauth/utils.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,7 @@ export const SCOPE_DESCRIPTIONS: Record<string, string> = {
270270
'im:history': 'Read direct message history',
271271
'im:read': 'View direct message channels',
272272
'users:read': 'View workspace users',
273+
'users:read.email': 'View user email addresses',
273274
'files:write': 'Upload files',
274275
'files:read': 'Download and read files',
275276
'canvases:write': 'Create canvas documents',

apps/sim/tools/slack/get_user.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ export const slackGetUserTool: ToolConfig<SlackGetUserParams, SlackGetUserRespon
8585
first_name: profile.first_name || '',
8686
last_name: profile.last_name || '',
8787
title: profile.title || '',
88+
email: profile.email || '',
8889
phone: profile.phone || '',
8990
skype: profile.skype || '',
9091
is_bot: user.is_bot || false,

apps/sim/tools/slack/list_users.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ export const slackListUsersTool: ToolConfig<SlackListUsersParams, SlackListUsers
9393
name: user.name,
9494
real_name: user.real_name || user.profile?.real_name || '',
9595
display_name: user.profile?.display_name || '',
96+
email: user.profile?.email || '',
9697
is_bot: user.is_bot || false,
9798
is_admin: user.is_admin || false,
9899
is_owner: user.is_owner || false,

apps/sim/tools/slack/types.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,11 @@ export const USER_OUTPUT_PROPERTIES = {
376376
title: { type: 'string', description: 'Job title', optional: true },
377377
phone: { type: 'string', description: 'Phone number', optional: true },
378378
skype: { type: 'string', description: 'Skype handle', optional: true },
379+
email: {
380+
type: 'string',
381+
description: 'Email address (requires users:read.email scope)',
382+
optional: true,
383+
},
379384
is_bot: { type: 'boolean', description: 'Whether the user is a bot' },
380385
is_admin: { type: 'boolean', description: 'Whether the user is a workspace admin' },
381386
is_owner: { type: 'boolean', description: 'Whether the user is the workspace owner' },
@@ -438,6 +443,11 @@ export const USER_SUMMARY_OUTPUT_PROPERTIES = {
438443
name: { type: 'string', description: 'Username (handle)' },
439444
real_name: { type: 'string', description: 'Full real name' },
440445
display_name: { type: 'string', description: 'Display name shown in Slack' },
446+
email: {
447+
type: 'string',
448+
description: 'Email address (requires users:read.email scope)',
449+
optional: true,
450+
},
441451
is_bot: { type: 'boolean', description: 'Whether the user is a bot' },
442452
is_admin: { type: 'boolean', description: 'Whether the user is a workspace admin' },
443453
is_owner: { type: 'boolean', description: 'Whether the user is the workspace owner' },
@@ -953,6 +963,7 @@ export interface SlackUser {
953963
title?: string
954964
phone?: string
955965
skype?: string
966+
email: string
956967
is_bot: boolean
957968
is_admin: boolean
958969
is_owner: boolean

0 commit comments

Comments
 (0)