{"name":"Shopify CSV import gate — test both decisions and download issue reports","active":false,"settings":{"executionOrder":"v1"},"nodes":[{"id":"subtitle-manual","name":"Run sample","type":"n8n-nodes-base.manualTrigger","typeVersion":1,"position":[0,100],"parameters":{}},{"id":"subtitle-input","name":"Sample product CSV","type":"n8n-nodes-base.code","typeVersion":2,"position":[240,100],"parameters":{"jsCode":"// Two synthetic tutorial cases. Replace this node with your existing CSV text source.\nreturn [\n {json:{mode:'update',csv:'URL handle,Title,Option1 name,Option1 value,Price,Vendor\\nlinen-shirt,Linen Shirt,Size,S,49.00,\\nlinen-shirt,,,S,$39.00,\\n'}},\n {json:{mode:'update',csv:'URL handle,Title,Option1 name,Option1 value,Price,Vendor\\nlinen-shirt,Linen Shirt,Size,S,49.00,Demo Vendor\\n'}}\n];"}},{"id":"subtitle-convert","name":"Check Shopify CSV","type":"n8n-nodes-base.httpRequest","typeVersion":4.2,"position":[500,100],"parameters":{"method":"POST","url":"https://catalog-import-guard.p.rapidapi.com/shopify/validate","authentication":"genericCredentialType","genericAuthType":"httpHeaderAuth","sendHeaders":true,"headerParameters":{"parameters":[{"name":"X-RapidAPI-Host","value":"catalog-import-guard.p.rapidapi.com"}]},"sendBody":true,"specifyBody":"json","jsonBody":"={{ JSON.stringify({csv:$json.csv,mode:$json.mode}) }}","options":{"timeout":30000}}},{"id":"catalog-report","name":"Build import decision and CSV issue report","type":"n8n-nodes-base.code","typeVersion":2,"position":[760,100],"parameters":{"jsCode":"const output=[];\nfor (let index=0;index<$input.all().length;index++) {\nconst data=$input.all()[index].json;\nif (!Number.isInteger(data.errors)||!Number.isInteger(data.warnings)||!Array.isArray(data.issues)||typeof data.passed!=='boolean') throw new Error('Unexpected validation response; stop and review API output.');\nconst cell=value=>{let text=String(value??'');if(typeof value==='string'&&/^[=+@\\t\\r-]/.test(text))text=\"'\"+text;return '\"'+text.replaceAll('\"','\"\"')+'\"';};\nconst reportCsv=['line,severity,code,column,message',...data.issues.map(i=>[i.line,i.severity,i.code,i.column,i.message].map(cell).join(','))].join('\\n');\nconst blocked=!(data.passed&&data.errors===0&&!data.truncated);\nconst fileName=(blocked?'blocked':'review')+'-catalog-'+(index+1)+'.csv';\nconst reportFile=await this.helpers.prepareBinaryData(Buffer.from(reportCsv,'utf8'),fileName,'text/csv');\noutput.push({json:{...data,decision:blocked?'blocked':'review_import_preview',nextAction:blocked?'Correct reported issues and run again. Do not import this file yet.':'Review warnings and Shopify import preview. No import has been performed.',reportCsv},binary:{report:reportFile},pairedItem:{item:index}});\n}\nreturn output;"}},{"id":"catalog-gate","name":"Route catalogs with blocking findings","type":"n8n-nodes-base.if","typeVersion":2.2,"position":[1020,100],"parameters":{"conditions":{"options":{"caseSensitive":true,"leftValue":"","typeValidation":"strict","version":2},"conditions":[{"id":"is-blocked","leftValue":"={{ $json.decision }}","rightValue":"blocked","operator":{"type":"string","operation":"equals"}}],"combinator":"and"},"options":{}}},{"id":"catalog-blocked","name":"Blocked — correct the source CSV","type":"n8n-nodes-base.noOp","typeVersion":1,"position":[1260,0],"parameters":{}},{"id":"catalog-review","name":"Review warnings and Shopify import preview","type":"n8n-nodes-base.noOp","typeVersion":1,"position":[1260,220],"parameters":{}},{"id":"tutorial-note-0","name":"Start here — setup and costs","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[-20,-330],"parameters":{"content":"## 1. Set up and run both tutorial cases\nI maintain Catalog Import Guard. Choose your own RapidAPI plan: BASIC 100 requests/month at $0; PRO 1,000/month at $5. Platform terms/bandwidth limits apply. Your n8n hosting can cost money.\nSelect Header Auth in Check Shopify CSV: name X-RapidAPI-Key, value your own key. No credentials are included. Each execution of this tutorial makes TWO API requests.\nTested in local n8n 2.46.6 against localhost using the actual validation handler and synthetic auth. Not tested in n8n Cloud.","width":750,"height":300}},{"id":"tutorial-note-1","name":"Understand input and privacy","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[0,300],"parameters":{"content":"## 2. Replace sample input for real catalog work\nThe sample emits two CSV texts. First has duplicate size S, a currency symbol in Price and a blank Vendor during overwrite; second is clean for the supported checks.\nFor recurring work, replace Sample product CSV with your own source returning {csv,mode}. The HTTP node sends this text to the API. Remove customer personal data and credentials first. Maximum encoded request 256 KiB, 5,000 rows. No schedule is activated. Browser-only local check: https://catalog-import-guard.mayasmile.workers.dev/try","width":700,"height":300}},{"id":"tutorial-note-2","name":"Check both branches","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[760,-330],"parameters":{"content":"## 3. Verify the output, not just HTTP 200\nA successful HTTP response can contain errors. The report step rejects malformed response shapes. Errors, failed checks or truncated reports route to Blocked; only an untruncated passing result goes to review.\nExpected tutorial: one blocked item (2 errors,1 warning), one review item (0 errors,0 warnings). Both branches are wired. No Shopify API is called; no import, email or file write occurs.","width":760,"height":280}},{"id":"tutorial-note-3","name":"Download reports and extend safely","type":"n8n-nodes-base.stickyNote","typeVersion":1,"position":[760,440],"parameters":{"content":"## 4. Download the issue report\nOpen either final node, choose Binary and download report. A UTF-8 CSV file is attached to each item with line,severity,code,column,message. JSON also includes reportCsv for your own storage step. Formula-like text is escaped for spreadsheet review.\nConnect an existing notification/storage node to Blocked if needed. Keep any import behind your own preview/approval. Passing these documented checks does not guarantee Shopify accepts a file. Review overwrite warnings and Shopify's own import preview.","width":760,"height":300}}],"connections":{"Run sample":{"main":[[{"node":"Sample product CSV","type":"main","index":0}]]},"Sample product CSV":{"main":[[{"node":"Check Shopify CSV","type":"main","index":0}]]},"Check Shopify CSV":{"main":[[{"node":"Build import decision and CSV issue report","type":"main","index":0}]]},"Build import decision and CSV issue report":{"main":[[{"node":"Route catalogs with blocking findings","type":"main","index":0}]]},"Route catalogs with blocking findings":{"main":[[{"node":"Blocked — correct the source CSV","type":"main","index":0}],[{"node":"Review warnings and Shopify import preview","type":"main","index":0}]]}},"pinData":{},"tags":[]}