Skip to content

feat(slack): add email field to get user and list users tools#3509

Open
waleedlatif1 wants to merge 2 commits intostagingfrom
waleedlatif1/slack-user-email
Open

feat(slack): add email field to get user and list users tools#3509
waleedlatif1 wants to merge 2 commits intostagingfrom
waleedlatif1/slack-user-email

Conversation

@waleedlatif1
Copy link
Collaborator

Summary

  • Add users:read.email scope to Slack OAuth config so email is returned by the API
  • Return email field from get_user and list_users tool responses
  • Add email to user output types, interfaces, and docs

Type of Change

  • New feature

Testing

Tested manually

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel
Copy link

vercel bot commented Mar 10, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Mar 10, 2026 11:27pm

Request Review

@cursor
Copy link

cursor bot commented Mar 10, 2026

PR Summary

Medium Risk
Adds a new Slack OAuth permission (users:read.email) and starts returning user email addresses, which is additional PII and may require users to re-authorize Slack credentials. Also updates TypeScript output contracts, which could affect downstream consumers expecting the previous schema.

Overview
Slack OAuth now requests the additional users:read.email scope (with a new scope description) so the Slack API can return user email addresses.

Both slack_get_user and slack_list_users now include an email field in their outputs, with corresponding updates to Slack tool output property definitions, the SlackUser interface, and the Slack tool docs to document the new field and required scope.

Written by Cursor Bugbot for commit 2874e91. Configure here.

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Mar 10, 2026

Greptile Summary

This PR extends the Slack get_user and list_users tools to surface user email addresses by adding the users:read.email OAuth scope and threading the email field through the tool response transforms, output type definitions, the SlackUser interface, and documentation.

Key changes:

  • users:read.email scope added to the Slack OAuth provider config and its description registered in SCOPE_DESCRIPTIONS
  • email: profile.email || '' (get_user) and email: user.profile?.email || '' (list_users) added to response transforms, consistent with the || '' fallback pattern used by all sibling string fields
  • email added to USER_OUTPUT_PROPERTIES, USER_SUMMARY_OUTPUT_PROPERTIES (both with optional: true to signal the field may be empty when the scope isn't granted by a custom bot token), and the SlackUser TypeScript interface
  • Documentation updated for both tools to reflect the new field and its scope dependency

The implementation is internally consistent: the runtime transform always produces a value (empty string fallback), gracefully handling both OAuth and bot-token auth methods where the email scope may not have been granted.

Confidence Score: 5/5

  • This PR is safe to merge — it's a purely additive change with no breaking modifications to existing behavior.
  • All six changed files follow existing conventions precisely. The new scope is additive in OAuth config. The || '' fallback ensures existing connections (without users:read.email) continue to work without errors. Type definitions are consistent with the established patterns: the runtime transform always produces a value (via || '' fallback), so email: string is correct in the interface, while optional: true in the output schema correctly reflects the Slack API behavior (the field may be empty when the scope isn't granted).
  • No files require special attention.

Sequence Diagram

sequenceDiagram
    participant U as User / LLM
    participant Tool as Slack Tool
    participant SlackAPI as Slack API

    U->>Tool: Call get_user / list_users (OAuth token with users:read.email)
    Tool->>SlackAPI: GET users.info?user=U123 (Bearer token)
    SlackAPI-->>Tool: { ok: true, user: { profile: { email: "...", ... } } }
    Note over Tool: profile.email || '' (empty string if scope missing)
    Tool-->>U: { user: { email: "user@example.com", ... } }

    U->>Tool: Call list_users (OAuth token with users:read.email)
    Tool->>SlackAPI: GET users.list?limit=100 (Bearer token)
    SlackAPI-->>Tool: { ok: true, members: [{ profile: { email: "...", ... } }] }
    Note over Tool: user.profile?.email || '' (empty string if scope missing)
    Tool-->>U: { users: [{ email: "user@example.com", ... }], ids, names, count }
Loading

Last reviewed commit: 2874e91

@waleedlatif1
Copy link
Collaborator Author

@greptile

@waleedlatif1
Copy link
Collaborator Author

@cursor review

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

@waleedlatif1
Copy link
Collaborator Author

@greptile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant