{
  "name": "LineSample",
  "nodes": [
    {
      "parameters": {
        "content": "## \u95dc\u65bc\u9019\u500b\u7bc0\u9ede\u7684\u4f5c\u8005\n\n**\u516c\u53f8\u540d\u7a31**: \u597d\u4e8b\u767c\u751f\u6578\u4f4d  \n**\u516c\u53f8\u7db2\u5740**: [https://ohya.co](https://ohya.co)  \n**LINE \u793e\u7fa4**: [\u9ede\u6211\u52a0\u5165 LINE \u7fa4\u7d44](https://line.me/ti/g2/bfnrSbbUE56PISKtQa9KK5gqpMhed_DXf-hmQw)  \n**\u806f\u7d61\u4fe1\u7bb1**: gary@ohya.co  \n**Threads**: [https://www.threads.net/@ohya.studio](https://www.threads.net/@ohya.studio)",
        "height": 220,
        "width": 320
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -480,
        -400
      ],
      "id": "36f6756a-9e81-427a-a292-cbb7496d84a9",
      "name": "\u95dc\u65bc\u9019\u500b\u7bc0\u9ede\u7684\u4f5c\u8005"
    },
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "callback",
        "options": {}
      },
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        -512,
        -32
      ],
      "id": "aec82924-0038-41f9-bc21-3c3296bbcb49",
      "name": "Webhook \u5165\u53e3"
    },
    {
      "parameters": {
        "content": "## Webhook \u5165\u53e3\n\n**\u8aaa\u660e\uff1a**\n- \u76e3\u807d\u4f86\u81ea LINE \u7684\u8a0a\u606f\uff0c\u89f8\u767c\u81ea\u52d5\u56de\u61c9\u6d41\u7a0b\u3002\n\n**\u6ce8\u610f\u4e8b\u9805\uff1a**\n1. \u78ba\u4fdd Webhook \u8a2d\u5b9a\u6b63\u78ba\uff0c\u78ba\u4fdd LINE \u53ef\u767c\u9001\u8acb\u6c42\u3002\n2. \u9700\u8981\u5728 LINE Developers Console \u8a2d\u5b9a Webhook URL\u3002",
        "height": 260,
        "width": 360
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -992,
        -288
      ],
      "id": "b8923055-142f-4c7a-b50a-12ee9ca7fd1f",
      "name": "Webhook \u5165\u53e3\u8aaa\u660e"
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "={{ $json.body.events[0].message.text }}",
        "hasOutputParser": true,
        "options": {
          "systemMessage": "You are a helpful assistant",
          "maxIterations": 10,
          "returnIntermediateSteps": false,
          "passthroughBinaryImages": true
        }
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 1.7,
      "position": [
        -32,
        -32
      ],
      "id": "50e08f2d-1fa4-461b-a4b2-b172f07de49c",
      "name": "AI \u8a9e\u8a00\u6a21\u578b"
    },
    {
      "parameters": {
        "content": "## AI \u8a9e\u8a00\u6a21\u578b\n\n**\u8aaa\u660e\uff1a**\n- \u547c\u53eb AI \u6a21\u578b\uff08\u5982 Google Gemini\uff09\u4f86\u7522\u751f\u9069\u7576\u56de\u61c9\u3002\n\n**\u6ce8\u610f\u4e8b\u9805\uff1a**\n1. \u78ba\u4fdd API Key \u6b63\u78ba\u586b\u5beb\uff0c\u907f\u514d\u8acb\u6c42\u5931\u6557\u3002\n2. \u8a2d\u5b9a `prompt` \u8981\u6c42\u8f38\u51fa JSON\uff0c\u907f\u514d\u683c\u5f0f\u932f\u8aa4\u3002",
        "height": 320
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        64,
        -448
      ],
      "id": "f676be81-1517-4019-8f2a-f3db6b6737bc",
      "name": "AI \u8a9e\u8a00\u6a21\u578b\u8aaa\u660e"
    },
    {
      "parameters": {
        "jsCode": "\n// \u53d6\u5f97 `replyToken` \u548c `output`\nconst replyToken = $('Webhook \u5165\u53e3').first().json.body.events[0].replyToken;\nconst text = $input.first().json.output;\n\n// \u56de\u50b3\u6574\u7406\u5f8c\u7684\u7d50\u679c\nreturn [\n  {\n    json: {\n      replyToken: replyToken,\n      text: text\n    }\n  }\n];\n"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        352,
        -32
      ],
      "id": "456f626c-3f49-4030-9bc7-50817d699a29",
      "name": "\u8655\u7406 AI \u56de\u61c9",
      "alwaysOutputData": false
    },
    {
      "parameters": {
        "content": "## \u8655\u7406 AI \u56de\u61c9\n\n**\u8aaa\u660e\uff1a**\n- \u89e3\u6790 AI \u7522\u751f\u7684\u56de\u61c9\uff0c\u53d6\u5f97 `replyToken` \u548c `text`\u3002\n\n**\u6ce8\u610f\u4e8b\u9805\uff1a**\n1. \u78ba\u4fdd AI Agent \u8f38\u51fa\u7684\u683c\u5f0f\u6b63\u78ba\u3002\n2. \u82e5 AI \u8f38\u51fa\u932f\u8aa4\uff0c\u61c9\u8a72\u8981\u5728\u9019\u88e1\u8655\u7406\u932f\u8aa4\u908f\u8f2f\u3002",
        "height": 280
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        288,
        128
      ],
      "id": "eb0ced79-4aee-46ce-aaa4-bdd5d4e17037",
      "name": "\u8655\u7406 AI \u56de\u61c9\u7684\u8aaa\u660e"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.line.me/v2/bot/message/reply",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            },
            {
              "name": "Authorization",
              "value": "Bearer FWz/gKhiCZ4IvSc+ScIfe7Cvt5QGglU2H8y+Sw9IviD0bOoCS9fBTCq0t8avYqOSHCG++EA5TRPXTJSIdbbsWPPp43i4vuh0TttM/yCx3VGqj3d321/Xl3qUeb6obXX+o+pLlgap/iDSlh3++Pk1nwdB04t89/1O/w1cDnyilFU="
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n  \"replyToken\": \"{{ $json.replyToken }}\",\n  \"messages\": [\n    {\n      \"type\": \"text\",\n      \"text\": \"{{ $json.text }}\"\n    }\n  ]\n}\n",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        576,
        -32
      ],
      "id": "30496aae-2a73-4763-97e8-8ca927c86845",
      "name": "\u767c\u9001\u56de\u61c9\u7d66 LINE"
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "value": "gpt-4.1-mini",
          "mode": "list",
          "cachedResultName": "gpt-4.1-mini"
        },
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.2,
      "position": [
        -160,
        240
      ],
      "id": "ca407b2e-3f24-48d9-8fcf-4566813d3cd1",
      "name": "OpenAI Chat Model",
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    }
  ],
  "connections": {
    "Webhook \u5165\u53e3": {
      "main": [
        [
          {
            "node": "AI \u8a9e\u8a00\u6a21\u578b",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI \u8a9e\u8a00\u6a21\u578b": {
      "main": [
        [
          {
            "node": "\u8655\u7406 AI \u56de\u61c9",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u8655\u7406 AI \u56de\u61c9": {
      "main": [
        [
          {
            "node": "\u767c\u9001\u56de\u61c9\u7d66 LINE",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI \u8a9e\u8a00\u6a21\u578b",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "2e253149-ef7d-4ced-930c-0a37d9410441",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "id": "dTYyXgaFqfus8na9",
  "tags": []
}