National Commerce Docs
n8n flows

Create PO on ShipHero

Takes a submitted purchase-order form and creates the matching purchase order directly in ShipHero.

This flow backs the front-end "create purchase order" form. It validates the submission, builds the line items, and creates the real purchase order in ShipHero, then returns a success or failure status to the caller.

At a glance

  • Status: Active
  • Trigger: Webhook (POST /webhook/weweb-form-create-purchase-order), answered by a Respond-to-Webhook node.
  • Runs on: The WeWeb front-end form submission.
  • Talks to: ShipHero (GraphQL API); the WeWeb front-end (webhook source).

How it works

  1. The webhook receives the form: SKUs, quantities, prices, weights, vendor names, PO name, vendor and warehouse IDs, estimated arrival, tracking number, and a ShipHero vendor access token in the body.
  2. Format Query normalizes the arrays, builds PO line items (skipping blanks, computing subtotal and total), validates the required fields, and assembles a purchase_order_create GraphQL mutation.
  3. Create ShipHero PO posts the mutation to https://public-api.shiphero.com/graphql/, authenticating with the per-request Bearer token from the body.
  4. If checks whether data.purchase_order_create.purchase_order.id came back, then routes to the success or failure Respond node returning a PO_creation_status.

Notes

  • The ShipHero token is passed in the request body per call rather than stored as an n8n credential.
  • The GraphQL call uses continueErrorOutput, so a ShipHero error still routes cleanly to the failure response.
  • Shared error-handler set as the error workflow.

On this page