Users get emails#452
Merged
Merged
Conversation
Add a nullable slack_email column to the users table, plus the corresponding entity property and email validation rule. The column is nullable because email is only available from Slack's users.info API when the app has the users:read.email OAuth scope, and existing rows need a backfill. Population happens in a follow-up change to keep the schema migration independently deployable. slack_email is added to the entity's _hidden list so it does not leak into the JSON output of existing endpoints that serialize user entities (leaderboard, user list, profile). Exposing it deliberately where needed is a follow-up change.
Populate the slack_email column from Slack's users.info response in both places users are synced: - UserService::getOrCreateUser() for newly created users - UpdateUsersCommand (nightly cron) for existing users, which also serves as the backfill once the users:read.email OAuth scope is granted — no separate backfill command needed Email falls back to null when Slack doesn't return one (bot users, or missing users:read.email scope), matching the nullable column. Note: requires adding the users:read.email scope to the Slack app for profile.email to be included in users.info responses.
Unhide slack_email specifically in GET /api/users so authenticated consumers (session or Bearer API token) get a user id to email mapping in a single call. This lets external systems correlate GibPotato user ids with people in other tools. The field stays hidden everywhere else user entities are serialized (leaderboard, profile, messages containments) via the entity's _hidden list — the unhide is scoped to this one endpoint.
This was referenced Jul 10, 2026
cleptric
approved these changes
Jul 13, 2026
cleptric
left a comment
Member
There was a problem hiding this comment.
Can be merged once the slack app was re-installed, which adds the new required users:read.email scope.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We only know people by Slack ID, which means nothing to any other system. This adds emails to users: synced from Slack (on user creation + the nightly sync, which doubles as the backfill), and exposed in
/api/usersso you can match potato people to actual people.Together with #449 you can now pull your potato history into another system and know who's who. 🥔✉️
users:read.emailscope added to the Slack app, otherwise Slack keeps emails to itself.