π€ Sync multi-location inventory to Medusa from any WMS or ERP
β‘ 6 views Β· π€ CRM & Sales Operations
Description
Quick Overview
This workflow receives a stock feed via webhook, validates and expands SKU rows, then syncs per-location inventory levels to Medusa by matching inventory items by SKU and returning a JSON report of synced and missing items.
How it works
- Receives a POST webhook request containing a
stock_location_idand anitemsarray of SKUs and quantities. - Validates the payload and converts each item into a normalized row with
sku,stocked_quantity, andstock_location_id. - For each row, queries Medusa for an inventory item that matches the SKU.
- If a matching Medusa inventory item exists, sets the absolute inventory level for that item at the provided stock location in Medusa.
- If no matching inventory item exists, records a
not_foundresult for the SKU without creating any new inventory records. - Aggregates all row results into a sync report and responds to the webhook with HTTP 200 when all items sync, or HTTP 207 when some SKUs are missing.
Setup
- Configure Medusa credentials in n8n for the Medusa nodes (Medusa backend URL and an API token/secret).
- Copy the production webhook URL for the βmedusa-inventory-syncβ endpoint and configure your WMS/ERP to POST stock updates to it.
- Ensure your sender posts
stock_location_idand anitemsarray withskuand non-negative integerstocked_quantityvalues. - Verify the target Medusa store already contains Inventory Items for every SKU you plan to send and that the referenced stock location IDs exist.
π Nodes Used
Webhook
π₯ Import
Download workflow.json and import into n8n:
Workflow menu β Import from File