Repository navigation
Description
Split out of #191 during review of #323.
What happens
#323 creates a Slack user mapping by calling users.lookupByEmail inside completeSlackInstall. That runs once, for one person: whoever clicked Connect, which in practice is the workspace admin.
Every other member of the workspace ends up with no slack_user_mapping row, and nothing else in the product ever calls upsertSlackUserMapping. So the Slack DM feature in #321 works for exactly one person per workspace, and everyone else sees a permanent "Connect your Orbit account to Slack to enable Slack DMs" notice in notification settings with no action attached to it.
The documentation added in #321 currently says "the workspace administrator must complete the Orbit-to-Slack user mapping", which describes a screen that does not exist.
What to build
Two paths, because neither is sufficient alone.
Backfill by email. At install time, and on demand from the integrations settings page, run users.lookupByEmail across the workspace member list and write a mapping for every match. Slack rate limits this endpoint, so it needs to be batched and to tolerate partial completion rather than failing the whole run.
A manual fallback. Email matching has a permanent tail: personal address on Orbit and work address on Slack, aliases, and workspaces where users:read.email is not granted. Those people need a way to link themselves, either a "Connect my Slack account" action in notification settings or an /orbit link slash command. The slash command plumbing already exists in apps/web/src/app/api/webhooks/slack/route.ts.
Also worth handling
- Unmapping. Someone leaves, or a mapping points at the wrong Slack account, and there is currently no way to remove one.
slack_user_mappinghas a unique index on(integration_id, slack_user_id), butupsertSlackUserMappingsets its conflict target to(integration_id, user_id)only. Re-mapping a Slack identity to a different Orbit user throws a raw unique violation today. Whatever builds this should fix that and cover it.- Showing the mapped Slack display name in notification settings, so a user can tell whether the match is the account they expected.
Not in scope
Routing, the slack_dm channel, and the dispatcher itself. Those are #191 and #321.
Depends on
#323 landing first, since it introduces the table and the lookup client method.
Activity
imshashank commentedon Aug 23, 2026
#323 has merged, so the schema and Slack lookup prerequisite named here is no longer blocking this work. I am removing the stale
blockedlabel.Keeping
needs designfor now because the install-time backfill, manual self-link fallback, and notification-settings state overlap with the delivery work in #321 and should be agreed as one user flow before implementation.imshashank commentedon Sep 6, 2026
Done by #382.
syncSlackMembersbackfills a mapping for every workspace member at install time and on demand from the integrations page, and a mapping is removed when the member is removed. The manual self-link for people whose emails do not match is not built; file it as its own small issue if anyone hits it.