{
  "name": "11 LINE Echo Bot - Webhook Reply",
  "nodes": [
    {
      "parameters": {
        "path": "line-echo-demo"
      },
      "type": "n8n-nodes-base.LineWebhook",
      "typeVersion": 1,
      "position": [
        220,
        300
      ],
      "id": "b4de7838-a221-4dcb-b9a4-c9a0f9c50001",
      "name": "Line Webhook"
    },
    {
      "parameters": {
        "keepOnlySet": true,
        "values": {
          "string": [
            {
              "name": "eventType",
              "value": "={{$json.event.type}}"
            },
            {
              "name": "replyToken",
              "value": "={{$json.event.replyToken}}"
            },
            {
              "name": "receivedText",
              "value": "={{$json.event.message.text || ''}}"
            },
            {
              "name": "userId",
              "value": "={{$json.event.source.userId || ''}}"
            },
            {
              "name": "sourceType",
              "value": "={{$json.event.source.type || ''}}"
            },
            {
              "name": "messageId",
              "value": "={{$json.event.message.id || ''}}"
            },
            {
              "name": "receivedAt",
              "value": "={{$json.event.timestamp || $now}}"
            }
          ]
        },
        "options": {}
      },
      "id": "b4de7838-a221-4dcb-b9a4-c9a0f9c50002",
      "name": "Normalize Text Event",
      "type": "n8n-nodes-base.set",
      "typeVersion": 1,
      "position": [
        500,
        300
      ]
    },
    {
      "parameters": {
        "operation": "text",
        "text": "={{'你剛剛說：' + $node[\"Normalize Text Event\"].json.receivedText}}"
      },
      "id": "b4de7838-a221-4dcb-b9a4-c9a0f9c50003",
      "name": "Build Echo Message",
      "type": "n8n-nodes-base.LineMessageNode",
      "typeVersion": 1,
      "position": [
        760,
        300
      ]
    },
    {
      "parameters": {
        "operation": "message",
        "message": "={{$json.message}}",
        "replyToken": "={{$node[\"Normalize Text Event\"].json.replyToken}}"
      },
      "id": "b4de7838-a221-4dcb-b9a4-c9a0f9c50004",
      "name": "Reply to LINE",
      "type": "n8n-nodes-base.LineMessaging",
      "typeVersion": 1,
      "position": [
        1020,
        300
      ]
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "={{ {\"ok\": true, \"message\": \"LINE webhook processed\"} }}",
        "options": {
          "responseCode": 200
        }
      },
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.4,
      "position": [
        1280,
        300
      ],
      "id": "b4de7838-a221-4dcb-b9a4-c9a0f9c50005",
      "name": "Respond to Webhook"
    }
  ],
  "connections": {
    "Line Webhook": {
      "main": [
        [
          {
            "node": "Normalize Text Event",
            "type": "main",
            "index": 0
          }
        ],
        [],
        [],
        [],
        [],
        [],
        [],
        [],
        [],
        [],
        []
      ]
    },
    "Normalize Text Event": {
      "main": [
        [
          {
            "node": "Build Echo Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build Echo Message": {
      "main": [
        [
          {
            "node": "Reply to LINE",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Reply to LINE": {
      "main": [
        [
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "pinData": {},
  "settings": {},
  "meta": {
    "templateNote": "Import this workflow after installing n8n-nodes-linewebhook. Fill LINE credentials, expose n8n with a public URL, then register the webhook path in LINE Developers Console."
  }
}
