What this workflow does
- Shopify: order created (Shopify Trigger) registers the
orders/createwebhook and verifies Shopify’s HMAC signature on every delivery. - Shopify: risk, stock and fulfillment orders (HTTP Request, GraphQL Admin API) loads the order’s risk recommendation, current inventory for each variant and its fulfillment orders.
- Rule checks and build prompt (Code) runs deterministic checks and returns reason codes:
exc-address,exc-pobox,exc-country,exc-risk,exc-oversellandexc-duplicate. It collects only the free text (order note, note attributes, visible line item properties) for the model. Payment details are never sent. - Has free text? (If) skips the model call when there is nothing to read.
- Claude: classify order notes (HTTP Request) classifies the text as a change request, delivery instruction, gift message, complaint or nothing actionable, quotes the triggering sentence and drafts a customer email, using structured outputs at low effort.
- Decide exception (Code) handles
refusal,max_tokensand API errors (flagged asexc-note-unread), merges all reasons and builds one GraphQL mutation that adds the tags and, outside shadow mode, places a fulfillment hold on each open fulfillment order. - Exception? (If) leaves clean orders alone. Shopify: tag and hold order applies the mutation.
- Slack: exception for review posts the order, reasons, any tag or hold errors, the suggested email and an admin link. Log exception adds a row to Google Sheets for weekly trend review.
Before you import
- A Shopify custom app with order, fulfillment order and inventory scopes, added to n8n as a Shopify Access Token credential. The app secret is used for webhook verification. Custom apps created in the Shopify admin before January 1, 2026 show a static access token. Newer ones are created in Shopify’s Dev Dashboard, where client credentials tokens expire after 24 hours, so plan how n8n gets a current token.
- An Anthropic API key, a Slack app with
chat:write, and a Google Sheet with an “Order exceptions” tab.
Setup
- Attach credentials, then replace
REPLACE_WITH_SHOPin the two GraphQL URLs and the Slack message. Keep the API version in the URL inside Shopify’s support window. - In Rule checks and build prompt, adjust
PO_BOX_BLOCKED_CARRIERSandDUPLICATE_WINDOW_MINUTES. LeaveSHADOW_MODE = truefor the first week. - Set
REPLACE_WITH_SLACK_CHANNEL_IDandREPLACE_WITH_SHEET_ID, and add the column headers shown on the Sheets node. - Activate the workflow so the trigger registers its webhook.
Test it
Place test orders on a development store: one clean, one shipping UPS to a PO box, one with “please change to size M” in the note, and the same email and address twice. Confirm the clean order produces nothing, and each other order gets the right tags, a Slack message and a sheet row.
Make it production-ready
- Compare a week of shadow-mode tags with what your team caught by hand, then set
SHADOW_MODE = false. Check that holds land before your 3PL or ShipStation connector pulls the order. - Add release and cancel actions for reviewers, and subscribe to
orders/updatedfor edits. - Duplicate detection uses workflow static data, which only persists in an active workflow.
- Add an error workflow, and watch GraphQL Admin API rate limits during sales.
claude-haiku-5-5is a cheaper option for note classification at volume.
Read the full guide at How to automate Shopify order exceptions, see our Shopify notes, or talk to us.