National Commerce Docs
n8n flows

ShipHero Access Token Rotation

Refreshes each brand's ShipHero public-API access token weekly using the stored refresh token.

Keeps every brand's ShipHero public-API access token fresh. Once a week it uses the stored refresh token to fetch a new access token, so token expiry never breaks the downstream integrations that call the ShipHero public API.

At a glance

  • Status: Active
  • Trigger: Schedule, weekly (every Monday); also a manual trigger.
  • Runs on: All active brands with a stored access and refresh token.
  • Talks to: ShipHero (public API /auth/refresh); Supabase (Brands read/update).

How it works

  1. Get All Active Brands queries Supabase Brands for rows with a non-empty access and refresh token.
  2. Prepare Brands Array packs those rows for a counter loop.
  3. Per iteration, Refresh The Shiphero Token POSTs to https://public-api.shiphero.com/auth/refresh, then UpdateCounter advances.
  4. Store New Token writes the returned access_token back to that brand's row.
  5. The If node loops while counter < total.

Notes

  • Uses a hand-rolled counter loop rather than SplitInBatches.
  • Error workflow pqNfn3sZJQOn1GaG; callerPolicy: workflowsFromSameOwner.

On this page