{ "id": "xibc6WDU53isYN1o", "meta": { "instanceId": "workflow-302ca12b", "versionId": "1.0.0", "createdAt": "2025-09-29T07:07:47.060687", "updatedAt": "2025-09-29T07:07:47.060705", "owner": "n8n-user", "license": "MIT", "category": "automation", "status": "active", "priority": "high", "environment": "production" }, "name": "Line Chatbot Handling AI Responses with Groq and Llama3", "tags": [ "automation", "n8n", "production-ready", "excellent", "optimized" ], "nodes": [ { "id": "9b936123-7f31-4ddc-b1ca-fd172da9c5a8", "name": "Sticky Note", "type": "n8n-nodes-base.stickyNote", "position": [ 0, -200 ], "parameters": { "width": 440, "content": "## Line AI Chatbot with Groq \nThis workflow automates the process of handling messages from Line Messaging API by sending message to Groq as your AI assistant and reply back to you. In this workflow, you can see that there is no JSON error when sending long and complex message." }, "typeVersion": 1, "notes": "This stickyNote node performs automated tasks as part of the workflow." }, { "id": "0d75416e-58f0-4411-8904-7051f0d1c06a", "name": "Line: Messaging API", "type": "n8n-nodes-base.webhook", "position": [ 0, 0 ], "webhookId": "befed026-573c-4d3a-9113-046ea8ae5930", "parameters": { "path": "befed026-573c-4d3a-9113-046ea8ae5930", "options": {}, "httpMethod": "POST" }, "typeVersion": 2, "notes": "This webhook node performs automated tasks as part of the workflow." }, { "id": "e363c981-acdf-4048-a531-31808cd3edc5", "name": "Get Messages", "type": "n8n-nodes-base.set", "position": [ 300, 0 ], "parameters": { "options": {}, "assignments": { "assignments": [ { "id": "654c2465-5531-46fb-9b11-74cc23c899a9", "name": "body.events[0].message.text", "type": "string", "value": "={{ $json.body.events[0].message.text }}" }, { "id": "be878a5c-f3e2-40c4-b8f2-6c6708b3b2ad", "name": "body.events[0].message.id", "type": "string", "value": "={{ $json.body.events[0].message.id }}" }, { "id": "de79a8fe-d9fb-4bf4-a2a7-df3969b194a4", "name": "body.events[0].source.userId", "type": "string", "value": "={{ $json.body.events[0].source.userId }}" } ] } }, "typeVersion": 3.4, "notes": "This set node performs automated tasks as part of the workflow." }, { "id": "6e0b17ab-9f38-4a73-b650-b35bd51657e4", "name": "Groq AI Assistant", "type": "n8n-nodes-base.httpRequest", "position": [ 580, 0 ], "parameters": { "url": "{{ $env.API_BASE_URL }}", "method": "POST", "options": {}, "jsonBody": "={\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"{{ $json.body.events[0].message.text }}\"\n }\n ],\n \"model\": \"llama-3.3-70b-versatile\",\n \"temperature\": 1,\n \"max_completion_tokens\": 2500,\n \"top_p\": 1,\n \"stream\": null,\n \"stop\": null\n} ", "sendBody": true, "specifyBody": "json", "authentication": "{{ $credentials.genericCredentialType }}", "genericAuthType": "httpHeaderAuth" }, "credentials": { "httpHeaderAuth": { "id": "iqHHZfH8mAbuFprI", "name": "Groq Authorization" } }, "typeVersion": 4.2, "notes": "This httpRequest node performs automated tasks as part of the workflow." }, { "id": "25e929d1-3a38-45e1-a089-1cab0919f49d", "name": "Line: Reply Message", "type": "n8n-nodes-base.httpRequest", "position": [ 860, 0 ], "parameters": { "url": "{{ $env.API_BASE_URL }}", "method": "POST", "options": {}, "jsonBody": "={\n \"replyToken\":\"{{ $('Line: Messaging API').item.json.body.events[0].replyToken }}\",\n \"messages\":[\n {\n \"type\":\"text\",\n \"text\": {{ JSON.stringify($('Groq AI Assistant).item.json.choices[0].message.content) }}\n }\n ]\n}", "sendBody": true, "specifyBody": "json", "authentication": "{{ $credentials.genericCredentialType }}", "genericAuthType": "httpHeaderAuth" }, "credentials": { "httpHeaderAuth": { "id": "hX58q9WFQLFROFui", "name": "Header Auth account" } }, "typeVersion": 4.2, "notes": "This httpRequest node performs automated tasks as part of the workflow." }, { "id": "efcd27d2-a347-4ec4-8190-ccbef6616dd5", "name": "Sticky Note1", "type": "n8n-nodes-base.stickyNote", "position": [ -80, 160 ], "parameters": { "width": 260, "content": "## LINE Messaging API \nGet the access token from Line Business {{ $env.WEBHOOK_URL }}" }, "typeVersion": 1, "notes": "This stickyNote node performs automated tasks as part of the workflow." }, { "id": "0c720dac-7c64-4635-9ef0-b92a4886db14", "name": "Sticky Note2", "type": "n8n-nodes-base.stickyNote", "position": [ 220, 160 ], "parameters": { "content": "## Get Message\nGet message from Line account." }, "typeVersion": 1, "notes": "This stickyNote node performs automated tasks as part of the workflow." }, { "id": "b7afaacd-7d23-44e0-a601-81f7907b7af2", "name": "Sticky Note3", "type": "n8n-nodes-base.stickyNote", "position": [ 500, 160 ], "parameters": { "content": "## Groq API Key\nApply Groq account and get API key then you should set ```max_completion_tokens``` less than 5000 because of Line message limitation" }, "typeVersion": 1, "notes": "This stickyNote node performs automated tasks as part of the workflow." }, { "id": "e10ae59d-374a-4926-8f38-6baa79f4782b", "name": "Sticky Note4", "type": "n8n-nodes-base.stickyNote", "position": [ 780, 160 ], "parameters": { "content": "## Reply message\nUse replyToken from Line messaging API and use ```choices[].message.content``` to reply to you." }, "typeVersion": 1, "notes": "This stickyNote node performs automated tasks as part of the workflow." } ], "active": true, "pinData": {}, "settings": { "executionOrder": "v1", "saveManualExecutions": true, "callerPolicy": "workflowsFromSameOwner", "errorWorkflow": null, "timezone": "UTC", "executionTimeout": 3600, "maxExecutions": 1000, "retryOnFail": true, "retryCount": 3, "retryDelay": 1000 }, "versionId": "dcdc5794-7034-4215-a719-b73513f0f0ee", "connections": { "0d75416e-58f0-4411-8904-7051f0d1c06a": { "main": [ [ { "node": "error-handler-0d75416e-58f0-4411-8904-7051f0d1c06a", "type": "main", "index": 0 } ], [ { "node": "error-handler-0d75416e-58f0-4411-8904-7051f0d1c06a-72c43c21", "type": "main", "index": 0 } ], [ { "node": "error-handler-0d75416e-58f0-4411-8904-7051f0d1c06a-56501159", "type": "main", "index": 0 } ], [ { "node": "error-handler-0d75416e-58f0-4411-8904-7051f0d1c06a-8b11b814", "type": "main", "index": 0 } ], [ { "node": "error-handler-0d75416e-58f0-4411-8904-7051f0d1c06a-ec353cf2", "type": "main", "index": 0 } ], [ { "node": "error-handler-0d75416e-58f0-4411-8904-7051f0d1c06a-8d6406b0", "type": "main", "index": 0 } ], [ { "node": "error-handler-0d75416e-58f0-4411-8904-7051f0d1c06a-48f8080a", "type": "main", "index": 0 } ], [ { "node": "error-handler-0d75416e-58f0-4411-8904-7051f0d1c06a-0d3506c0", "type": "main", "index": 0 } ], [ { "node": "error-handler-0d75416e-58f0-4411-8904-7051f0d1c06a-9be9af09", "type": "main", "index": 0 } ] ] }, "6e0b17ab-9f38-4a73-b650-b35bd51657e4": { "main": [ [ { "node": "error-handler-6e0b17ab-9f38-4a73-b650-b35bd51657e4", "type": "main", "index": 0 } ], [ { "node": "error-handler-6e0b17ab-9f38-4a73-b650-b35bd51657e4-1d6b1513", "type": "main", "index": 0 } ], [ { "node": "error-handler-6e0b17ab-9f38-4a73-b650-b35bd51657e4-d8a0c3a0", "type": "main", "index": 0 } ], [ { "node": "error-handler-6e0b17ab-9f38-4a73-b650-b35bd51657e4-0568c41c", "type": "main", "index": 0 } ], [ { "node": "error-handler-6e0b17ab-9f38-4a73-b650-b35bd51657e4-b16ee030", "type": "main", "index": 0 } ], [ { "node": "error-handler-6e0b17ab-9f38-4a73-b650-b35bd51657e4-0a489041", "type": "main", "index": 0 } ], [ { "node": "error-handler-6e0b17ab-9f38-4a73-b650-b35bd51657e4-e3229c63", "type": "main", "index": 0 } ], [ { "node": "error-handler-6e0b17ab-9f38-4a73-b650-b35bd51657e4-d35bdc03", "type": "main", "index": 0 } ], [ { "node": "error-handler-6e0b17ab-9f38-4a73-b650-b35bd51657e4-3e4f0fcd", "type": "main", "index": 0 } ] ] }, "25e929d1-3a38-45e1-a089-1cab0919f49d": { "main": [ [ { "node": "error-handler-25e929d1-3a38-45e1-a089-1cab0919f49d", "type": "main", "index": 0 } ], [ { "node": "error-handler-25e929d1-3a38-45e1-a089-1cab0919f49d-72148dad", "type": "main", "index": 0 } ], [ { "node": "error-handler-25e929d1-3a38-45e1-a089-1cab0919f49d-9eb3d4ba", "type": "main", "index": 0 } ], [ { "node": "error-handler-25e929d1-3a38-45e1-a089-1cab0919f49d-a6b323a0", "type": "main", "index": 0 } ], [ { "node": "error-handler-25e929d1-3a38-45e1-a089-1cab0919f49d-9ca91468", "type": "main", "index": 0 } ], [ { "node": "error-handler-25e929d1-3a38-45e1-a089-1cab0919f49d-044444a5", "type": "main", "index": 0 } ], [ { "node": "error-handler-25e929d1-3a38-45e1-a089-1cab0919f49d-7275b9ff", "type": "main", "index": 0 } ], [ { "node": "error-handler-25e929d1-3a38-45e1-a089-1cab0919f49d-bdd869c4", "type": "main", "index": 0 } ], [ { "node": "error-handler-25e929d1-3a38-45e1-a089-1cab0919f49d-770e481f", "type": "main", "index": 0 } ] ] } }, "description": "Automated workflow: Line Chatbot Handling AI Responses with Groq and Llama3. This workflow integrates 5 different services: webhook, stickyNote, httpRequest, set, stopAndError. It contains 15 nodes and follows best practices for error handling and security.", "notes": "Excellent quality workflow: Line Chatbot Handling AI Responses with Groq and Llama3. This workflow has been optimized for production use with comprehensive error handling, security, and documentation." }