{
  "name": "Weekly Shopify AI-shopping readiness check (GetShopAgent)",
  "nodes": [
    { "parameters": { "rule": { "interval": [ { "field": "weeks", "triggerAtDay": [1], "triggerAtHour": 9 } ] } },
      "id": "a1", "name": "Every Monday 9am", "type": "n8n-nodes-base.scheduleTrigger", "typeVersion": 1.2, "position": [0, 0] },
    { "parameters": { "assignments": { "assignments": [
        { "id": "s1", "name": "store", "value": "yourstore.com", "type": "string" },
        { "id": "s2", "name": "minScore", "value": 80, "type": "number" } ] }, "options": {} },
      "id": "a2", "name": "Settings (edit me)", "type": "n8n-nodes-base.set", "typeVersion": 3.4, "position": [220, 0] },
    { "parameters": { "url": "https://api.getshopagent.com/build/grade", "sendQuery": true,
        "queryParameters": { "parameters": [ { "name": "url", "value": "={{ $json.store }}" } ] }, "options": { "timeout": 90000 } },
      "id": "a3", "name": "Check store", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [440, 0] },
    { "parameters": { "conditions": { "options": { "caseSensitive": true, "typeValidation": "loose" }, "conditions": [
        { "id": "c1", "leftValue": "={{ $json.score }}", "rightValue": "={{ $('Settings (edit me)').item.json.minScore }}", "operator": { "type": "number", "operation": "lt" } } ], "combinator": "and" }, "options": {} },
      "id": "a4", "name": "Score below target?", "type": "n8n-nodes-base.if", "typeVersion": 2.2, "position": [660, 0] },
    { "parameters": { "jsCode": "const g=$input.first().json; const fails=(g.checks||[]).filter(c=>c.pass===false); return [{json:{subject:`${g.store}: AI-shopping score ${g.score}/100`, text:[`Score: ${g.score}/100`,'',...fails.map(c=>`- ${c.label}: ${c.detail}${c.fix?'\\n  Fix: '+c.fix:''}`),'',`Full report: https://getshopagent.com/?store=${encodeURIComponent(String(g.store).replace(/^https?:\\/\\//,''))}`].join('\\n')}}];" },
      "id": "a5", "name": "Build summary", "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [880, -80] },
    { "parameters": { "fromEmail": "alerts@yourdomain.com", "toEmail": "you@yourdomain.com", "subject": "={{ $json.subject }}", "emailFormat": "text", "text": "={{ $json.text }}", "options": {} },
      "id": "a6", "name": "Email me (set SMTP credential)", "type": "n8n-nodes-base.emailSend", "typeVersion": 2.1, "position": [1100, -80] }
  ],
  "connections": {
    "Every Monday 9am": { "main": [ [ { "node": "Settings (edit me)", "type": "main", "index": 0 } ] ] },
    "Settings (edit me)": { "main": [ [ { "node": "Check store", "type": "main", "index": 0 } ] ] },
    "Check store": { "main": [ [ { "node": "Score below target?", "type": "main", "index": 0 } ] ] },
    "Score below target?": { "main": [ [ { "node": "Build summary", "type": "main", "index": 0 } ], [] ] },
    "Build summary": { "main": [ [ { "node": "Email me (set SMTP credential)", "type": "main", "index": 0 } ] ] }
  },
  "settings": { "executionOrder": "v1" },
  "meta": { "templateCredsSetupCompleted": false }
}
