{
  "id": "GenP02",
  "name": "\u4e0a\u50b3\u5716\u6587\u767c\u5e03\u5230 FB/IG/Threads",
  "nodes": [
    {
      "parameters": {
        "content": "\u26a0\ufe0f \u67b6\u69cb\u7bc4\u672c\uff08\u672a\u63a5 key\uff09\n\n\u586b Page/\u5e33\u865f ID + Access Token\uff08\u767c\u6587\u6b0a\u9650\uff09\u3002\nIG/Threads \u540c\u67b6\u69cb\u63db Graph API endpoint\u3002\n\u7522\u6587(Ollama)\u514d\u8cbb\uff1b\u767c\u5e03\u6bb5\u8981 token\u3002",
        "height": 320,
        "width": 380,
        "color": 4
      },
      "id": "n-note",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        180,
        100
      ]
    },
    {
      "parameters": {},
      "id": "n-manual",
      "name": "When clicking Execute",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        240,
        460
      ]
    },
    {
      "parameters": {
        "jsCode": "const topic='\uff08\u63db\u6210\u4f60\u7684\u4e3b\u984c\u6216\u7d20\u6750\uff09';\nconst prompt='\u4f60\u662f\u793e\u7fa4\u5c0f\u7de8\u3002\u6839\u64da\u4e3b\u984c\u5beb\u4e00\u5247\u8cbc\u6587\uff08\u7e41\u4e2d\u3001\u53e3\u8a9e\u3001\u4e0d\u91e3\u4e92\u52d5\uff09\uff1a\\n\\n\u4e3b\u984c\uff1a'+topic;\nreturn [{json:{topic,prompt}}];"
      },
      "id": "n-input",
      "name": "Input (edit me)",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        460,
        460
      ]
    },
    {
      "parameters": {
        "options": {
          "timeout": 180000
        },
        "method": "POST",
        "url": "http://host.docker.internal:11434/api/chat",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify({ model: 'qwen2.5:latest', messages: [ { role: 'system', content: '\u4f60\u662f\u53f0\u7063\u4eba\uff0c\u4e00\u5f8b\u4f7f\u7528\u53f0\u7063\u7e41\u9ad4\u4e2d\u6587\u8207\u53f0\u7063\u6163\u7528\u8a9e\u56de\u8986\uff0c\u7d55\u5c0d\u4e0d\u8981\u51fa\u73fe\u4efb\u4f55\u7c21\u9ad4\u5b57\u6216\u4e2d\u570b\u7528\u8a9e\u3002' }, { role: 'user', content: $json.prompt } ], stream: false }) }}"
      },
      "id": "n-ollama",
      "name": "Generate with Ollama",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        680,
        460
      ]
    },
    {
      "parameters": {
        "jsCode": "const data=$input.first().json;let postText='';try{postText=(data.message&&data.message.content)||'';}catch(e){}\nif(!postText)postText=JSON.stringify(data);return [{json:{postText}}];"
      },
      "id": "n-extract",
      "name": "Extract Text",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        900,
        460
      ]
    },
    {
      "parameters": {
        "options": {},
        "method": "POST",
        "url": "https://graph.facebook.com/v21.0/YOUR_PAGE_ID/feed",
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "access_token",
              "value": "YOUR_PAGE_ACCESS_TOKEN"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify({ message: $json.postText }) }}"
      },
      "id": "n-pub",
      "name": "Post to Facebook",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        1120,
        460
      ]
    }
  ],
  "connections": {
    "When clicking Execute": {
      "main": [
        [
          {
            "node": "Input (edit me)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Input (edit me)": {
      "main": [
        [
          {
            "node": "Generate with Ollama",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate with Ollama": {
      "main": [
        [
          {
            "node": "Extract Text",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Text": {
      "main": [
        [
          {
            "node": "Post to Facebook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "tags": []
}