Last active
May 23, 2025 14:32
-
-
Save vtanathip/31966f55254e79c491e2c8be4eb6d1b8 to your computer and use it in GitHub Desktop.
N8N + Line messaging setup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker volume create n8n_data | |
docker run -it --name n8n -p 5678:5678 -v n8n_data:/home/node/.n8n docker.n8n.io/n8nio/n8n | |
--- | |
ngrok http --url=teal-awaited-gorilla.ngrok-free.app 80 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "Gemini and Line Assitance", | |
"nodes": [ | |
{ | |
"parameters": { | |
"httpMethod": "POST", | |
"path": "0692e7e5-0b00-465f-8e97-ed3f9698ac9e", | |
"options": {} | |
}, | |
"type": "n8n-nodes-base.webhook", | |
"typeVersion": 2, | |
"position": [ | |
0, | |
0 | |
], | |
"id": "11004452-b2a1-403b-aed2-ba2227bdd5c1", | |
"name": "Webhook", | |
"webhookId": "0692e7e5-0b00-465f-8e97-ed3f9698ac9e" | |
}, | |
{ | |
"parameters": { | |
"assignments": { | |
"assignments": [ | |
{ | |
"id": "7b11e548-b804-449c-bc92-524080bfd9fc", | |
"name": "body.events[0].message.text", | |
"value": "={{ $json.body.events[0].message.text }}", | |
"type": "string" | |
}, | |
{ | |
"id": "5a96e6e8-0fee-4573-9a30-5deff0f3c8ed", | |
"name": "body.events[0].replyToken", | |
"value": "={{ $json.body.events[0].replyToken }}", | |
"type": "string" | |
} | |
] | |
}, | |
"options": {} | |
}, | |
"type": "n8n-nodes-base.set", | |
"typeVersion": 3.4, | |
"position": [ | |
220, | |
0 | |
], | |
"id": "fc96e52c-25f0-43db-89c0-7a7dcfe09fa3", | |
"name": "Edit Fields" | |
}, | |
{ | |
"parameters": { | |
"promptType": "define", | |
"text": "=Guess why they're typing this {{ $json.body.events[0].message.text }}", | |
"options": { | |
"systemMessage": "You are a helpful assistant" | |
} | |
}, | |
"type": "@n8n/n8n-nodes-langchain.agent", | |
"typeVersion": 1.9, | |
"position": [ | |
440, | |
0 | |
], | |
"id": "c9f5ee0d-2202-41bb-b1a6-f404ed9907f2", | |
"name": "AI Agent" | |
}, | |
{ | |
"parameters": { | |
"modelName": "models/gemini-2.5-flash-preview-04-17", | |
"options": {} | |
}, | |
"type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini", | |
"typeVersion": 1, | |
"position": [ | |
340, | |
240 | |
], | |
"id": "e77f6487-08f3-424a-84e2-59eedfce182b", | |
"name": "Google Gemini Chat Model", | |
"credentials": { | |
"googlePalmApi": { | |
"id": "RtUQQhjbMarTERDf", | |
"name": "Google Gemini(PaLM) Api account" | |
} | |
} | |
}, | |
{ | |
"parameters": { | |
"method": "POST", | |
"url": "https://api.line.me/v2/bot/message/reply", | |
"authentication": "genericCredentialType", | |
"genericAuthType": "httpHeaderAuth", | |
"sendBody": true, | |
"specifyBody": "json", | |
"jsonBody": "={\n \"replyToken\":\"{{$('Edit Fields').first().json.body.events[0].replyToken}}\",\n \"messages\":[\n {\n \"type\":\"text\",\n \"text\":{{ JSON.stringify($json['output'])}}\n }\n ]\n}", | |
"options": {} | |
}, | |
"type": "n8n-nodes-base.httpRequest", | |
"typeVersion": 4.2, | |
"position": [ | |
800, | |
0 | |
], | |
"id": "d8a6e3cb-ccff-4486-b68d-469ad865818b", | |
"name": "HTTP Request", | |
"credentials": { | |
"httpHeaderAuth": { | |
"id": "quSOjfhybYgdtknE", | |
"name": "Header Auth account" | |
} | |
} | |
} | |
], | |
"pinData": {}, | |
"connections": { | |
"Webhook": { | |
"main": [ | |
[ | |
{ | |
"node": "Edit Fields", | |
"type": "main", | |
"index": 0 | |
} | |
] | |
] | |
}, | |
"Edit Fields": { | |
"main": [ | |
[ | |
{ | |
"node": "AI Agent", | |
"type": "main", | |
"index": 0 | |
} | |
] | |
] | |
}, | |
"Google Gemini Chat Model": { | |
"ai_languageModel": [ | |
[ | |
{ | |
"node": "AI Agent", | |
"type": "ai_languageModel", | |
"index": 0 | |
} | |
] | |
] | |
}, | |
"AI Agent": { | |
"main": [ | |
[ | |
{ | |
"node": "HTTP Request", | |
"type": "main", | |
"index": 0 | |
} | |
] | |
] | |
} | |
}, | |
"active": false, | |
"settings": { | |
"executionOrder": "v1" | |
}, | |
"versionId": "83403144-38ed-494e-839d-5c309213e406", | |
"meta": { | |
"templateCredsSetupCompleted": true, | |
"instanceId": "6ea6758a8a88c864c0b1af9f886503bb67c3e3a2a99bef4c32284ecbf88285c2" | |
}, | |
"id": "3h51xndHkzOG1MwG", | |
"tags": [] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment