{
  "name": "IndexSentinel — Apple App Store ASO & Low-Rating Review Monitor",
  "nodes": [
    {
      "parameters": {"rule": {"interval": [{"field": "days", "daysInterval": 1}]}},
      "id": "daily-trigger",
      "name": "Daily Schedule",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [220, 300]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {"id": "app1", "name": "app_id", "value": "1232780281", "type": "string"},
            {"id": "cty1", "name": "country", "value": "us", "type": "string"}
          ]
        }
      },
      "id": "set-app",
      "name": "Target iOS App",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [440, 300]
    },
    {
      "parameters": {
        "url": "=https://indexsentinelapp.com/api/v1/data/apple-app-store/app/{{encodeURIComponent($json.app_id)}}?country={{encodeURIComponent($json.country)}}&include_reviews=true",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {"name": "X-IndexSentinel-API-Key", "value": "={{$env.INDEXSENTINEL_API_KEY || 'PASTE_YOUR_KEY_HERE'}}"}
          ]
        },
        "options": {}
      },
      "id": "http-apple-app",
      "name": "Fetch Apple App Profile & Reviews",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [680, 300]
    },
    {
      "parameters": {
        "conditions": {
          "boolean": [
            {"value1": "={{Array.isArray($json.reviews) && $json.reviews.some(r => Number(r.rating) <= 2)}}", "value2": true}
          ]
        }
      },
      "id": "if-low-rating",
      "name": "Alert on 1-2 Star Reviews",
      "type": "n8n-nodes-base.if",
      "typeVersion": 1,
      "position": [940, 300]
    }
  ],
  "connections": {
    "Daily Schedule": {"main": [[{"node": "Target iOS App", "type": "main", "index": 0}]]},
    "Target iOS App": {"main": [[{"node": "Fetch Apple App Profile & Reviews", "type": "main", "index": 0}]]},
    "Fetch Apple App Profile & Reviews": {"main": [[{"node": "Alert on 1-2 Star Reviews", "type": "main", "index": 0}]]}
  },
  "active": false,
  "settings": {"executionOrder": "v1"}
}
