Skip to content

fix(slack): Add user_change event handler and include mapped individuals in admin#915

Merged
bokelley merged 1 commit intomainfrom
bokelley/slack-webhook-gaps
Jan 30, 2026
Merged

fix(slack): Add user_change event handler and include mapped individuals in admin#915
bokelley merged 1 commit intomainfrom
bokelley/slack-webhook-gaps

Conversation

@bokelley
Copy link
Contributor

Summary

  • Add handler for Slack user_change events to capture profile updates in real-time (display name, real name, email, deleted status, timezone)
  • Add slack_tz_offset to handleTeamJoin for consistency with sync
  • Include invalidateUnifiedUsersCache in user_change handler
  • Fix admin users query to include "mapped individuals" - users who have a WorkOS user ID but no organization membership

Problem

  1. Missing profile updates via webhooks: We only handled team_join events, missing all subsequent profile changes. This caused the need for frequent manual syncs (1311 users updated in last sync).

  2. Invisible mapped individuals: Users like Brian May who have a WorkOS user ID but no organization membership were falling through the cracks - excluded from both the AAO users list (no org membership) and the Slack-only list (has workos_user_id).

Changes

server/src/slack/events.ts

  • Add SlackUserChangeEvent interface and handler
  • Add slack_tz_offset to handleTeamJoin for consistency
  • Invalidate unified users cache on profile changes

server/src/routes/admin/users.ts

  • Include mapped individuals (have workos_user_id but no org) with mapping_status: 'mapped'
  • Show their name and email from Slack data

Test plan

  • Deploy and verify Brian May appears in admin search for "may"
  • Add user_change event subscription in Slack app settings
  • Verify profile updates trigger the new handler (check logs)

🤖 Generated with Claude Code

…als in admin

- Add handler for Slack user_change events to capture profile updates in
  real-time (display name, real name, email, deleted status, timezone)
- Add slack_tz_offset to handleTeamJoin for consistency with sync
- Include invalidateUnifiedUsersCache in user_change handler
- Fix admin users query to include "mapped individuals" - users who have
  a WorkOS user ID but no organization membership. Previously these users
  were excluded from both the AAO users list (no org membership) and the
  Slack-only list (has workos_user_id), causing them to be invisible in
  the admin panel.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@bokelley bokelley merged commit a45c54a into main Jan 30, 2026
6 checks passed
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