WORKFLOW · N8N
[n8n Template] Claude AI LINE Chatbot
Prompts👁 0
WORKFLOW JSON
{
"meta": {
"instanceId": "template",
"templateCredsSetupCompleted": false
},
"name": "[n8n Template] Claude AI LINE Chatbot",
"nodes": [
{
"id": "a1b2c3d4-0001-0001-0001-a1b2c3d40001",
"name": "LINE Webhook",
"type": "n8n-nodes-base.webhook",
"position": [
200,
300
],
"webhookId": "claude-line-bot",
"parameters": {
"path": "claude-line-bot",
"options": {},
"httpMethod": "POST",
"responseMode": "responseNode"
},
"typeVersion": 2
},
{
"id": "a1b2c3d4-0002-0002-0002-a1b2c3d40002",
"name": "Extract Message",
"type": "n8n-nodes-base.code",
"position": [
420,
300
],
"parameters": {
"jsCode": "// Validate LINE signature and extract message\nconst body = $input.first().json;\nconst events = body.events || [];\n\nconst textEvent = events.find(\n e => e.type === 'message' && e.message?.type === 'text'\n);\n\nif (!textEvent) {\n // Non-text event (sticker, image, etc.) — skip\n return [];\n}\n\nreturn [{\n json: {\n userId: textEvent.source.userId,\n replyToken: textEvent.replyToken,\n userMessage: textEvent.message.text\n }\n}];"
},
"typeVersion": 2
},
{
"id": "a1b2c3d4-0003-0003-0003-a1b2c3d40003",
"name": "Ask Claude",
"type": "n8n-nodes-base.httpRequest",
"position": [
640,
300
],
"parameters": {
"url": "https://api.anthropic.com/v1/messages",
"method": "POST",
"options": {},
"jsonBody": "={\n \"model\": \"claude-opus-4-5\",\n \"max_tokens\": 500,\n \"system\": \"You are a helpful assistant. Reply concisely in the same language the user writes in.\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"{{ $json.userMessage }}\"\n }\n ]\n}",
"sendBody": true,
"sendHeaders": true,
"specifyBody": "json",
"headerParameters": {
"parameters": [
{
"name": "x-api-key",
"value": "={{ $env.ANTHROPIC_API_KEY }}"
},
{
"name": "anthropic-version",
"value": "2023-06-01"
},
{
"name": "content-type",
"value": "application/json"
}
]
}
},
"typeVersion": 4
},
{
"id": "a1b2c3d4-0004-0004-0004-a1b2c3d40004",
"name": "Reply via LINE",
"type": "n8n-nodes-base.httpRequest",
"position": [
860,
300
],
"parameters": {
"url": "https://api.line.me/v2/bot/message/reply",
"method": "POST",
"options": {},
"jsonBody": "={\n \"replyToken\": \"{{ $('Extract Message').first().json.replyToken }}\",\n \"messages\": [\n {\n \"type\": \"text\",\n \"text\": \"{{ $json.content[0].text }}\"\n }\n ]\n}",
"sendBody": true,
"sendHeaders": true,
"specifyBody": "json",
"headerParameters": {
"parameters": [
{
"name": "Authorization",
"value": "=Bearer {{ $env.LINE_CHANNEL_ACCESS_TOKEN }}"
},
{
"name": "Content-Type",
"value": "application/json"
}
]
}
},
"typeVersion": 4
},
{
"id": "a1b2c3d4-0005-0005-0005-a1b2c3d40005",
"name": "Return 200",
"type": "n8n-nodes-base.respondToWebhook",
"position": [
420,
480
],
"parameters": {
"options": {},
"respondWith": "text",
"responseBody": "OK"
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "n8n-claude-template-01",
"staticData": null,
"connections": {
"Ask Claude": {
"main": [
[
{
"node": "Reply via LINE",
"type": "main",
"index": 0
}
]
]
},
"LINE Webhook": {
"main": [
[
{
"node": "Extract Message",
"type": "main",
"index": 0
},
{
"node": "Return 200",
"type": "main",
"index": 0
}
]
]
},
"Extract Message": {
"main": [
[
{
"node": "Ask Claude",
"type": "main",
"index": 0
}
]
]
}
}
}RELATED WORKFLOWS
COMMENTS
No comments yet — be the first.
