The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"name": "LINE-Bot-\u547d\u4ee4\u8abf\u5ea6\u5668",
"nodes": [
{
"parameters": {
"httpMethod": "POST",
"path": "line-cmd-dispatch",
"options": {
"rawBody": true
}
},
"type": "n8n-nodes-base.webhook",
"typeVersion": 2,
"position": [
-600,
400
],
"name": "LINE Webhook"
},
{
"parameters": {
"jsCode": "const events = $input.first().json.body.events;\nif (!events || events.length === 0) {\n return [{ json: { command: \"none\", args: \"\", replyToken: \"\" } }];\n}\nconst event = events[0];\nconst replyToken = event.replyToken || \"\";\nconst text = (event.message && event.message.text) || \"\";\nlet command = \"chat\";\nlet args = text;\nif (text.startsWith(\"/\")) {\n const parts = text.split(\" \");\n command = parts[0];\n args = parts.slice(1).join(\" \");\n}\nreturn [{ json: { command, args, replyToken, rawText: text } }];"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
-300,
400
],
"name": "Parse Command"
},
{
"parameters": {
"rules": {
"values": [
{
"conditions": {
"options": {
"caseSensitive": false,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"id": "help-cond",
"leftValue": "={{ $json.command }}",
"rightValue": "/help",
"operator": {
"type": "string",
"operation": "equals"
}
}
],
"combinator": "and"
},
"renameOutput": true,
"outputLabel": "/help"
},
{
"conditions": {
"options": {
"caseSensitive": false,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"id": "weather-cond",
"leftValue": "={{ $json.command }}",
"rightValue": "/\u5929\u6c23",
"operator": {
"type": "string",
"operation": "equals"
}
}
],
"combinator": "and"
},
"renameOutput": true,
"outputLabel": "/\u5929\u6c23"
}
]
},
"options": {
"fallbackOutput": "extra"
}
},
"type": "n8n-nodes-base.switch",
"typeVersion": 3.2,
"position": [
0,
400
],
"name": "Command Dispatcher"
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "h1",
"name": "replyText",
"value": "LINE Bot \u547d\u4ee4\u5217\u8868\uff1a\n\n/help - \u986f\u793a\u6b64\u8aaa\u660e\n/\u5929\u6c23 - \u67e5\u8a62\u53f0\u5317\u5929\u6c23\n\n\u66f4\u591a\u547d\u4ee4\u5373\u5c07\u4e0a\u7dda\uff01",
"type": "string"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
300,
200
],
"name": "Help Text"
},
{
"parameters": {
"method": "GET",
"url": "https://wttr.in/Taipei?format=j1",
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
300,
500
],
"name": "Get Weather"
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "w1",
"name": "replyText",
"value": "={{ '\u53f0\u5317\u5929\u6c23:\n\u6eab\u5ea6: ' + $json.current_condition[0].temp_C + '\u00b0C\n\u6fd5\u5ea6: ' + $json.current_condition[0].humidity + '%\n\u98a8\u901f: ' + $json.current_condition[0].windspeedKmph + ' km/h\n\u5929\u6c23: ' + $json.current_condition[0].weatherDesc[0].value + '\n\u9ad4\u611f\u6eab\u5ea6: ' + $json.current_condition[0].FeelsLikeC + '\u00b0C' }}",
"type": "string"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
550,
500
],
"name": "Format Weather"
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "d1",
"name": "replyText",
"value": "\u76ee\u524d\u50c5\u652f\u63f4 /help \u548c /\u5929\u6c23 \u547d\u4ee4\u3002\u8acb\u8f38\u5165 /help \u67e5\u770b\u53ef\u7528\u547d\u4ee4\u3002",
"type": "string"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
300,
750
],
"name": "Default Reply"
},
{
"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 loGRufQo05yExhEUN4KACsX/BfEgh8ae0pHO2FJj3xyHUk4BuCBoPhzuVW3hNV8aHHtjgUY4D37roXhmTd9VEu+mC3hxzqjnmIGzrEg5mZl66uq2uNND0pwwQEs8sAI8dkcWD26YjijDYSppwJzWkwdB04t89/1O/w1cDnyilFU="
}
]
},
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={\n \"replyToken\": \"{{ $('Parse Command').first().json.replyToken }}\",\n \"messages\": [\n {\n \"type\": \"text\",\n \"text\": \"{{ $json.replyText }}\"\n }\n ]\n}",
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
800,
400
],
"name": "LINE Reply"
},
{
"parameters": {
"respondWith": "noData",
"options": {}
},
"type": "n8n-nodes-base.respondToWebhook",
"typeVersion": 1.1,
"position": [
1050,
400
],
"name": "Respond OK"
}
],
"connections": {
"LINE Webhook": {
"main": [
[
{
"node": "Parse Command",
"type": "main",
"index": 0
}
]
]
},
"Parse Command": {
"main": [
[
{
"node": "Command Dispatcher",
"type": "main",
"index": 0
}
]
]
},
"Command Dispatcher": {
"main": [
[
{
"node": "Help Text",
"type": "main",
"index": 0
}
],
[
{
"node": "Get Weather",
"type": "main",
"index": 0
}
],
[
{
"node": "Default Reply",
"type": "main",
"index": 0
}
]
]
},
"Help Text": {
"main": [
[
{
"node": "LINE Reply",
"type": "main",
"index": 0
}
]
]
},
"Get Weather": {
"main": [
[
{
"node": "Format Weather",
"type": "main",
"index": 0
}
]
]
},
"Format Weather": {
"main": [
[
{
"node": "LINE Reply",
"type": "main",
"index": 0
}
]
]
},
"Default Reply": {
"main": [
[
{
"node": "LINE Reply",
"type": "main",
"index": 0
}
]
]
},
"LINE Reply": {
"main": [
[
{
"node": "Respond OK",
"type": "main",
"index": 0
}
]
]
}
},
"settings": {
"executionOrder": "v1",
"timezone": "Asia/Taipei",
"callerPolicy": "workflowsFromSameOwner"
}
}
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
LINE-Bot-命令調度器. Uses httpRequest. Webhook trigger; 9 nodes.
Source: https://gist.github.com/chenghyang2001/4f3b022b218574a220731a0451f60b33 — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
This n8n template provides enterprise-level version control for your workflows using GitHub integration. Stop losing hours to broken workflows and manual exports – get proper commit history, visual di
This flow creates dummy files for every item added in your *Arrs (Radarr/Sonarr) with the tag .
eek-Go v2 (Batch-Then-Review). Uses httpRequest. Webhook trigger; 75 nodes.
This workflow receives webhook requests from a content calendar and uses the X API v2 to publish text posts, threads, image/video posts, and polls, as well as delete existing posts and run a credentia
This workflow acts as a central API gateway for all technical indicator agents in the Binance Spot Market Quant AI system. It listens for incoming webhook requests and dynamically routes them to the c