{
  "id": "GenD79",
  "name": "\u4e0a\u50b3\u7d20\u6750\u5230\u6307\u5b9a\u5ee3\u544a\u7d44\u5408",
  "nodes": [
    {
      "parameters": {
        "content": "\u26a0\ufe0f \u67b6\u69cb\u7bc4\u672c\uff08\u672a\u63a5 key\uff09\n\n\u9700 Meta Marketing API\uff1aact_XXXX + Token\uff08ads_management\uff09\u3002\nDecide \u70ba\u9580\u6abb\u908f\u8f2f\u7bc4\u4f8b\uff0c\u53ef\u6539\u689d\u4ef6\u3002\u52d5\u4f5c\u7bc0\u9ede\u6703\u6539\u5ee3\u544a\u72c0\u614b/\u9810\u7b97\u3002\n\u6c92 key \u4e0d\u6703\u52d5\u5230\u4f60\u7684\u5ee3\u544a\u3002",
        "height": 320,
        "width": 380,
        "color": 4
      },
      "id": "n-note",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        180,
        100
      ]
    },
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "cronExpression",
              "expression": "0 9 * * *"
            }
          ]
        }
      },
      "id": "n-sched",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [
        240,
        460
      ]
    },
    {
      "parameters": {
        "options": {},
        "method": "GET",
        "url": "https://graph.facebook.com/v21.0/act_YOUR_AD_ACCOUNT/insights?fields=adset_id,ctr,cpc,spend&level=adset",
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "access_token",
              "value": "YOUR_ACCESS_TOKEN"
            }
          ]
        }
      },
      "id": "n-fetch",
      "name": "Fetch Ad Insights",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        460,
        460
      ]
    },
    {
      "parameters": {
        "jsCode": "const rows=$input.all().map(i=>i.json);const T=1.0;\nconst hit=rows.filter(r=>parseFloat(r.ctr||0)<T);\nreturn hit.length?hit.map(r=>({json:r})):[{json:{adset_id:'',note:'\u5171'+rows.length+'\u7b46'}}];"
      },
      "id": "n-decide",
      "name": "Decide (threshold)",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        680,
        460
      ]
    },
    {
      "parameters": {
        "options": {},
        "method": "POST",
        "url": "=https://graph.facebook.com/v21.0/{{ $json.adset_id || 'YOUR_ADSET_ID' }}",
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "access_token",
              "value": "YOUR_ACCESS_TOKEN"
            }
          ]
        }
      },
      "id": "n-act",
      "name": "Attach Creative",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        900,
        460
      ]
    }
  ],
  "connections": {
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Fetch Ad Insights",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Ad Insights": {
      "main": [
        [
          {
            "node": "Decide (threshold)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Decide (threshold)": {
      "main": [
        [
          {
            "node": "Attach Creative",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "tags": []
}