National Commerce Docs
n8n flows

Invite Users to Client Portal

Invites one or more users to a brand's client portal, creating auth invites, brand roles, and emailing a set-password link.

Invites one or more users to the National Commerce client portal for a given brand (account), creating Supabase auth invites, assigning brand roles, and emailing a branded set-password link. It also handles the "already a member" case.

At a glance

  • Status: Active
  • Trigger: Webhook (POST /webhook/0805be40-1cc9-4415-8355-80bc16122185), answered by a Respond-to-Webhook node.
  • Runs on: A call carrying one or more users and a target brand, typically from New Brand Onboarding or the Users screen.
  • Talks to: Supabase (Auth Admin generate_link, get_user_uuid_by_email RPC, userRoles, user_settings, userParentBrands); Gmail.

How it works

  1. The webhook responds immediately, then Prepare Users Array feeds a counter loop over each user.
  2. Get User Via Email calls the Supabase RPC get_user_uuid_by_email, then branches on whether the user exists.
  3. Existing users: check userRoles for the brand and either return a 400 "already exists" or add a new brand role.
  4. New users: Generate Invite Link For User (Supabase Admin generate_link, type invite, redirect /update-password), then send the invite email and add the brand role in parallel.
  5. Send Invite Email delivers a branded HTML message via Gmail with the one-time action link.
  6. Create Default User Preferences seeds a user_settings row with default notification prefs.

Notes

  • Called by New Brand Onboarding.
  • callerPolicy: workflowsFromSameOwner; a fixed roleId is assigned to invitees.
  • Shared error-handler set as the error workflow.

On this page