National Commerce Docs
n8n flows

New Brand Onboarding

End-to-end provisioning of a new brand: ShipHero tokens, warehouses, vendors, webhooks, users, and initial pulls.

The onboarding orchestrator. It provisions a new brand (account) end-to-end: it stores the brand and its ShipHero tokens, imports warehouses and vendors, registers ShipHero webhooks, invites portal users, and kicks off the initial SKU and historical-shipment pulls.

At a glance

  • Status: Active
  • Trigger: Webhook (New Brand Attempt, POST /webhook/create-new-brand), answered by a Respond-to-Webhook node.
  • Runs on: A new-brand submission from the portal's create-connection wizard. The portal reads this webhook's URL from N8N_CREATE_BRAND_WEBHOOK_URL, which is set on production only.
  • Talks to: Supabase (Brands, warehouses, vendors, userRoles and junction tables); ShipHero (warehouse/vendor lookups, webhook registration); three sibling n8n workflows over HTTP.

How it works

  1. The webhook receives the account name, the ShipHero access and refresh tokens pasted into the wizard, the invited users, and the creator's user id. It gets no ShipHero email or password, because the wizard no longer asks for them. Extract Last 4 Access Token Characters takes the token's last four characters for the brand's default name.
  2. Add New Brand Record inserts the brand with those tokens. The Has ShipHero Login? check runs Add Shiphero Credentials To The Vault only when the payload carries both a ShipHero email and password. The portal's payload doesn't, so nothing is stored in the vault.
  3. Warehouses are fetched from ShipHero and looped to create warehouse and brand-to-warehouse records.
  4. Vendors are fetched and looped similarly, creating the vendor or adding the brand to an existing one.
  5. ShipHero GraphQL webhooks are registered for shipments and purchase orders.
  6. The flow calls the Invite Users workflow for the invited users. It doesn't add the creator itself: the trg_add_super_admins_to_new_brand trigger on Brands adds every NC Super Admin, the creator included, the moment Add New Brand Record inserts the account. The old Create userRole row node is disabled.
  7. It triggers Pull Brand SKUs and starts a historical-shipment backfill, then returns OK or a structured error keyed by failure point.

Notes

  • Orchestrator that fans out to multiple downstream scenarios, sequenced with a Wait node.
  • Includes a (TEST) Delete Brand Record cleanup node.
  • Shared error-handler set as the error workflow.

On this page