After provisioning a Rocket.Chat account for a JSN-bridged user, explicitly
invite them to the configured supporters channel via channels.invite. This
is belt-and-braces alongside the RC default-channel flag — the default flag
only fires at user creation time, so flipping a channel to default later
doesn't catch existing users. The explicit invite path handles that case
and also gives us a stable hook for migration scripts.
Three changes:
- New env: RC_SUPPORTERS_CHANNEL (default 'supporters'). z.string() in
env.ts. Set in cmlite .env if you want to route to a different channel.
- New rocketchatClient method: inviteUserToChannel(userId, channelName).
Idempotent — RC's channels.invite no-ops if the user is already a member.
- identityBridgeService.provisionRocketChatAccount now calls
rocketchatClient.inviteUserToChannel after createUser + setting
rocketChatUserId. Wrapped in its own try/catch so an invite failure logs
warn but doesn't roll back the RC account creation.
Tested end-to-end: JSN magic-link verify → cmlite User → RC account →
auto-invited to #supporters (membership goes from 4 → 5 on the test signup).
Three existing stragglers backfilled via direct API calls (idempotent).
Bunker Admin