This workflow follows the Agent → Gmail recipe pattern — see all workflows that pair these two integrations.
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": "Ecommerce Bot v6 \u2014 Mode Switch",
"nodes": [
{
"id": "telegram_trigger",
"name": "Telegram Trigger",
"type": "n8n-nodes-base.telegramTrigger",
"typeVersion": 1,
"position": [
-1300,
200
],
"parameters": {
"updates": [
"message"
],
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"name": "<your credential>"
}
}
},
{
"id": "detect_language",
"name": "Detect Language",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
-1060,
200
],
"parameters": {
"jsCode": "\nconst msg = $input.item.json.message;\nconst text = (msg.text || '').toLowerCase();\nconst langMap = {\n hi: ['\u0928\u092e\u0938\u094d\u0924\u0947','\u0911\u0930\u094d\u0921\u0930','\u091a\u093e\u0939\u093f\u090f','\u0916\u0930\u0940\u0926\u0928\u093e','\u0930\u0926\u094d\u0926','\u092c\u0926\u0932\u0928\u093e'],\n bn: ['\u09b9\u09cd\u09af\u09be\u09b2\u09cb','\u0985\u09b0\u09cd\u09a1\u09be\u09b0','\u099a\u09be\u0987','\u0995\u09bf\u09a8\u09a4\u09c7','\u09ac\u09be\u09a4\u09bf\u09b2','\u09aa\u09b0\u09bf\u09ac\u09b0\u09cd\u09a4\u09a8'],\n es: ['hola','orden','quiero','necesito','comprar','cancelar','cambiar'],\n ar: ['\u0645\u0631\u062d\u0628\u0627','\u0637\u0644\u0628','\u0623\u0631\u064a\u062f','\u0634\u0631\u0627\u0621','\u0625\u0644\u063a\u0627\u0621','\u062a\u063a\u064a\u064a\u0631'],\n fr: ['bonjour','commande','veux','acheter','annuler','changer'],\n zh: ['\u4f60\u597d','\u8ba2\u5355','\u60f3\u8981','\u8d2d\u4e70','\u53d6\u6d88','\u66f4\u6539']\n};\nlet detectedLang = 'en';\nfor (const [lang, kws] of Object.entries(langMap)) {\n if (kws.some(kw => text.includes(kw))) { detectedLang = lang; break; }\n}\nreturn [{ json: {\n chat_id: msg.chat.id,\n message_text: msg.text || '',\n username: msg.chat.username || '',\n first_name: msg.chat.first_name || '',\n detectedLang\n}}];\n"
}
},
{
"id": "session_mode_router",
"name": "Session Mode Router",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
-820,
200
],
"parameters": {
"jsCode": "\nconst data = $input.first().json;\nconst chatId = String(data.chat_id);\n\n// Read stored session from workflow static data\nconst store = $getWorkflowStaticData('global');\nconst sessions = store.sessions || {};\nconst session = sessions[chatId] || { mode: 'CHAT', context: {} };\n\nreturn [{ json: {\n ...data,\n session_mode: session.mode,\n session_context: session.context\n}}];\n"
}
},
{
"id": "mode_switch",
"name": "Mode Switch",
"type": "n8n-nodes-base.switch",
"typeVersion": 3,
"position": [
-580,
200
],
"parameters": {
"rules": {
"values": [
{
"conditions": {
"conditions": [
{
"leftValue": "={{ $json.session_mode }}",
"rightValue": "CHAT",
"operator": {
"type": "string",
"operation": "equals"
}
}
],
"combinator": "and"
},
"renameOutput": true,
"outputKey": "CHAT"
},
{
"conditions": {
"conditions": [
{
"leftValue": "={{ $json.session_mode }}",
"rightValue": "ORDER",
"operator": {
"type": "string",
"operation": "equals"
}
}
],
"renameOutput": true,
"outputKey": "ORDER"
},
"combinator": "and"
},
{
"conditions": {
"conditions": [
{
"leftValue": "={{ $json.session_mode }}",
"rightValue": "UPDATE",
"operator": {
"type": "string",
"operation": "equals"
}
}
],
"renameOutput": true,
"outputKey": "UPDATE"
},
"combinator": "and"
},
{
"conditions": {
"conditions": [
{
"leftValue": "={{ $json.session_mode }}",
"rightValue": "CANCEL",
"operator": {
"type": "string",
"operation": "equals"
}
}
],
"renameOutput": true,
"outputKey": "CANCEL"
},
"combinator": "and"
}
]
},
"fallbackOutput": "extra"
}
},
{
"id": "intent_classifier",
"name": "Intent Classifier",
"type": "@n8n/n8n-nodes-langchain.agent",
"typeVersion": 1.7,
"position": [
-300,
60
],
"parameters": {
"promptType": "define",
"text": "=Message: {{ $json.message_text }}\nLanguage: {{ $json.detectedLang }}",
"options": {
"systemMessage": "You are an intent classifier for an ecommerce Telegram bot.\n\nClassify the user message into EXACTLY ONE intent:\n- CHAT: greetings, questions, general conversation (hi, hello, how are you, what products, price, help)\n- ORDER: user wants to buy something, place a new order, or mentions ordering/purchasing\n- UPDATE: user wants to change something in an existing order (address, phone, quantity, product)\n- CANCEL: user wants to cancel an existing order\n\nReturn ONLY valid JSON, no explanation, no markdown:\n{\n \"intent\": \"CHAT\",\n \"confidence\": \"high\",\n \"reason\": \"user said hello\"\n}\n\nExamples:\n- 'hi' -> CHAT\n- 'hello' -> CHAT\n- 'what products do you have?' -> CHAT\n- 'I want to order' -> ORDER\n- 'I want to buy 2 shoes' -> ORDER\n- 'please change my delivery address' -> UPDATE\n- 'cancel my order' -> CANCEL\n- 'cancel order ORD-123' -> CANCEL\n\nNEVER return anything other than the JSON object.",
"maxIterations": 1
}
}
},
{
"id": "groq_model_(intent)",
"name": "Groq Model (Intent)",
"type": "@n8n/n8n-nodes-langchain.lmChatGroq",
"typeVersion": 1,
"position": [
-300,
240
],
"parameters": {
"model": "llama-3.3-70b-versatile",
"options": {}
},
"credentials": {
"groqApi": {
"name": "<your credential>"
}
}
},
{
"id": "parse_intent",
"name": "Parse Intent",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
-60,
60
],
"parameters": {
"jsCode": "\ntry {\n const rawOutput = $input.first().json.output || '';\n const prevData = $('Session Mode Router').first().json || {};\n const cleaned = rawOutput.replace(/```json|```/g,'').trim();\n let parsed = {};\n try { parsed = JSON.parse(cleaned); } catch(e) {\n return [{ json: { ...prevData, detected_intent: 'CHAT' } }];\n }\n const intent = (parsed.intent || 'CHAT').toUpperCase();\n const valid = ['CHAT','ORDER','UPDATE','CANCEL'];\n return [{ json: {\n ...prevData,\n detected_intent: valid.includes(intent) ? intent : 'CHAT',\n intent_confidence: parsed.confidence || 'medium',\n intent_reason: parsed.reason || ''\n }}];\n} catch(e) {\n const prevData = $('Session Mode Router').first().json || {};\n return [{ json: { ...prevData, detected_intent: 'CHAT' } }];\n}\n"
}
},
{
"id": "intent_router",
"name": "Intent Router",
"type": "n8n-nodes-base.switch",
"typeVersion": 3,
"position": [
200,
60
],
"parameters": {
"rules": {
"values": [
{
"conditions": {
"conditions": [
{
"leftValue": "={{ $json.detected_intent }}",
"rightValue": "CHAT",
"operator": {
"type": "string",
"operation": "equals"
}
}
],
"combinator": "and"
},
"renameOutput": true,
"outputKey": "CHAT"
},
{
"conditions": {
"conditions": [
{
"leftValue": "={{ $json.detected_intent }}",
"rightValue": "ORDER",
"operator": {
"type": "string",
"operation": "equals"
}
}
],
"combinator": "and"
},
"renameOutput": true,
"outputKey": "ORDER"
},
{
"conditions": {
"conditions": [
{
"leftValue": "={{ $json.detected_intent }}",
"rightValue": "UPDATE",
"operator": {
"type": "string",
"operation": "equals"
}
}
],
"combinator": "and"
},
"renameOutput": true,
"outputKey": "UPDATE"
},
{
"conditions": {
"conditions": [
{
"leftValue": "={{ $json.detected_intent }}",
"rightValue": "CANCEL",
"operator": {
"type": "string",
"operation": "equals"
}
}
],
"combinator": "and"
},
"renameOutput": true,
"outputKey": "CANCEL"
}
]
},
"fallbackOutput": "extra"
}
},
{
"id": "set_mode_order",
"name": "Set Mode ORDER",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
460,
120
],
"parameters": {
"jsCode": "\nconst data = $input.first().json;\nconst chatId = String(data.chat_id);\nconst store = $getWorkflowStaticData('global');\nif (!store.sessions) store.sessions = {};\nstore.sessions[chatId] = { mode: 'ORDER', context: {} };\nreturn [{ json: { ...data, session_mode: 'ORDER' } }];\n"
}
},
{
"id": "set_mode_update",
"name": "Set Mode UPDATE",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
460,
240
],
"parameters": {
"jsCode": "\nconst data = $input.first().json;\nconst chatId = String(data.chat_id);\nconst store = $getWorkflowStaticData('global');\nif (!store.sessions) store.sessions = {};\nstore.sessions[chatId] = { mode: 'UPDATE', context: {} };\nreturn [{ json: { ...data, session_mode: 'UPDATE' } }];\n"
}
},
{
"id": "set_mode_cancel",
"name": "Set Mode CANCEL",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
460,
360
],
"parameters": {
"jsCode": "\nconst data = $input.first().json;\nconst chatId = String(data.chat_id);\nconst store = $getWorkflowStaticData('global');\nif (!store.sessions) store.sessions = {};\nstore.sessions[chatId] = { mode: 'CANCEL', context: {} };\nreturn [{ json: { ...data, session_mode: 'CANCEL' } }];\n"
}
},
{
"id": "ai_chat_reply",
"name": "AI Chat Reply",
"type": "@n8n/n8n-nodes-langchain.agent",
"typeVersion": 1.7,
"position": [
460,
0
],
"parameters": {
"promptType": "define",
"text": "={{ $json.message_text }}\n\nDetected language: {{ $json.detectedLang }}\nUser first name: {{ $json.first_name }}",
"options": {
"systemMessage": "You are a friendly, warm multilingual customer support agent for an online ecommerce store.\n\nAlways reply in the SAME language the customer used.\n\nYou can:\n- Greet customers warmly\n- Answer questions about products (we sell premium goods at $25 each)\n- Explain how to place an order: just say \"I want to order\" and I will guide you step by step\n- Tell customers they can update or cancel existing orders by just saying \"update my order\" or \"cancel my order\"\n- Make small talk\n\nBe natural, concise, helpful. Use a friendly emoji occasionally.\n\nNEVER process orders yourself. NEVER ask for name/address/phone in CHAT mode.",
"maxIterations": 3
}
}
},
{
"id": "groq_model_(chat)",
"name": "Groq Model (Chat)",
"type": "@n8n/n8n-nodes-langchain.lmChatGroq",
"typeVersion": 1,
"position": [
460,
160
],
"parameters": {
"model": "llama-3.3-70b-versatile",
"options": {}
},
"credentials": {
"groqApi": {
"name": "<your credential>"
}
}
},
{
"id": "send_chat_reply",
"name": "Send Chat Reply",
"type": "n8n-nodes-base.telegram",
"typeVersion": 1.2,
"position": [
720,
0
],
"parameters": {
"chatId": "={{ $json.chat_id }}",
"text": "={{ $json.output }}",
"additionalFields": {
"parse_mode": "HTML"
}
},
"credentials": {
"telegramApi": {
"name": "<your credential>"
}
}
},
{
"id": "ai_order_parser",
"name": "AI Order Parser",
"type": "@n8n/n8n-nodes-langchain.agent",
"typeVersion": 1.7,
"position": [
720,
220
],
"parameters": {
"promptType": "define",
"text": "={{ $json.message_text }}\n\nDetected language: {{ $json.detectedLang }}\nSession context: {{ JSON.stringify($json.session_context) }}",
"options": {
"systemMessage": "You are a dedicated multilingual order-taking assistant for an ecommerce store. You ONLY focus on collecting order information.\n\nCollect these 6 required fields:\n1. product_name\n2. quantity\n3. customer_name\n4. delivery_address\n5. phone_number\n6. email\n\nRULES:\n- If ANY field is missing: ask ONLY for the ONE missing field at a time in a friendly way in the customer's language. Do NOT output JSON.\n- Ask one question at a time. Keep it short and friendly.\n- If ALL 6 fields are present: output ONLY this exact JSON with no extra text:\n{\n \"product_name\": \"\",\n \"quantity\": \"\",\n \"customer_name\": \"\",\n \"delivery_address\": \"\",\n \"phone_number\": \"\",\n \"email\": \"\"\n}\n\nNEVER invent data. NEVER output JSON until ALL 6 fields are confirmed.",
"maxIterations": 10
}
}
},
{
"id": "groq_model_(order)",
"name": "Groq Model (Order)",
"type": "@n8n/n8n-nodes-langchain.lmChatGroq",
"typeVersion": 1,
"position": [
720,
400
],
"parameters": {
"model": "llama-3.3-70b-versatile",
"options": {}
},
"credentials": {
"groqApi": {
"name": "<your credential>"
}
}
},
{
"id": "parse_order_json",
"name": "Parse Order JSON",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
980,
220
],
"parameters": {
"jsCode": "\ntry {\n const rawOutput = $input.first().json.output || '';\n const prevData = $('Session Mode Router').first().json || {};\n const cleaned = (typeof rawOutput === 'string' ? rawOutput : JSON.stringify(rawOutput)).replace(/```json|```/g,'').trim();\n\n if (!cleaned.startsWith('{')) {\n return [{ json: { __is_complete: false, chat_id: prevData.chat_id, reply_text: cleaned, session_mode: prevData.session_mode } }];\n }\n\n let orderData = {};\n try { orderData = JSON.parse(cleaned); } catch(e) {\n return [{ json: { __is_complete: false, chat_id: prevData.chat_id, reply_text: rawOutput, session_mode: prevData.session_mode } }];\n }\n\n if (!orderData.product_name || !orderData.quantity || !orderData.customer_name ||\n !orderData.delivery_address || !orderData.phone_number || !orderData.email) {\n return [{ json: { __is_complete: false, chat_id: prevData.chat_id, reply_text: rawOutput, session_mode: prevData.session_mode } }];\n }\n\n return [{ json: {\n __is_complete: true,\n chat_id: prevData.chat_id,\n username: prevData.username,\n first_name: prevData.first_name,\n detectedLang: prevData.detectedLang,\n message_text: prevData.message_text,\n product_name: orderData.product_name,\n quantity: orderData.quantity,\n customer_name: orderData.customer_name,\n delivery_address: orderData.delivery_address,\n phone_number: orderData.phone_number,\n email: orderData.email\n }}];\n} catch(error) {\n const prevData = $('Session Mode Router').first().json || {};\n return [{ json: { __is_complete: false, chat_id: prevData.chat_id, reply_text: 'Sorry, something went wrong. Please try again.', session_mode: prevData.session_mode } }];\n}\n"
}
},
{
"id": "order_complete?",
"name": "Order Complete?",
"type": "n8n-nodes-base.switch",
"typeVersion": 3,
"position": [
1220,
220
],
"parameters": {
"rules": {
"values": [
{
"conditions": {
"conditions": [
{
"leftValue": "={{ $json.__is_complete }}",
"rightValue": false,
"operator": {
"type": "boolean",
"operation": "equals"
}
}
],
"combinator": "and"
},
"renameOutput": true,
"outputKey": "incomplete"
},
{
"conditions": {
"conditions": [
{
"leftValue": "={{ $json.__is_complete }}",
"rightValue": true,
"operator": {
"type": "boolean",
"operation": "equals"
}
}
],
"combinator": "and"
},
"renameOutput": true,
"outputKey": "complete"
}
]
}
}
},
{
"id": "ask_for_more_info",
"name": "Ask For More Info",
"type": "n8n-nodes-base.telegram",
"typeVersion": 1.2,
"position": [
1460,
120
],
"parameters": {
"chatId": "={{ $json.chat_id }}",
"text": "={{ $json.reply_text }}",
"additionalFields": {
"parse_mode": "HTML"
}
},
"credentials": {
"telegramApi": {
"name": "<your credential>"
}
}
},
{
"id": "generate_order_id",
"name": "Generate Order ID",
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
1460,
340
],
"parameters": {
"assignments": {
"assignments": [
{
"id": "1",
"name": "order_id",
"value": "={{ \"ORD-\" + Date.now() }}",
"type": "string"
},
{
"id": "2",
"name": "timestamp",
"value": "={{ $now.toISO() }}",
"type": "string"
},
{
"id": "3",
"name": "status",
"value": "Pending Payment",
"type": "string"
},
{
"id": "4",
"name": "unit_price",
"value": 25,
"type": "number"
},
{
"id": "5",
"name": "total",
"value": "={{ (() => { const qty = Number(String($json.quantity).match(/\\d+/)?.[0]); return (!qty || isNaN(qty)) ? 0 : qty * 25; })() }}",
"type": "number"
}
]
},
"includeOtherFields": true,
"options": {}
}
},
{
"id": "save_to_google_sheets",
"name": "Save to Google Sheets",
"type": "n8n-nodes-base.googleSheets",
"typeVersion": 4.5,
"position": [
1700,
340
],
"parameters": {
"operation": "append",
"documentId": {
"__rl": true,
"value": "https://docs.google.com/spreadsheets/d/1yC02_hcX1Tnm31jLHFGQgovfL6GuWQveA1a2IHI4l2I/edit?usp=sharing",
"mode": "url"
},
"sheetName": {
"__rl": true,
"value": "gid=0",
"mode": "list",
"cachedResultName": "Sheet1"
},
"columns": {
"mappingMode": "autoMapInputData",
"value": {},
"matchingColumns": [],
"schema": []
},
"options": {}
},
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
}
},
{
"id": "clear_session_(order)",
"name": "Clear Session (Order)",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
1940,
340
],
"parameters": {
"jsCode": "\nconst data = $input.first().json;\nconst chatId = String(data.chat_id);\nconst store = $getWorkflowStaticData('global');\nif (!store.sessions) store.sessions = {};\nstore.sessions[chatId] = { mode: 'CHAT', context: {} };\nreturn [{ json: data }];\n"
}
},
{
"id": "build_payment_message",
"name": "Build Payment Message",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
2180,
340
],
"parameters": {
"jsCode": "\nconst data = $input.item.json;\nconst templates = {\n en: `\u2705 Order Confirmed!\\n\\nOrder ID: ${data.order_id}\\nProduct: ${data.product_name}\\nQuantity: ${data.quantity}\\nTotal: $${data.total}\\n\\nPayment Instructions:\\nPlease pay within 24 hours via:\\n- Bank Transfer: [Your Bank Details]\\n- UPI: [Your UPI ID]\\n- PayPal: [Your PayPal Link]\\n\\nReference: ${data.order_id}`,\n hi: `\u2705 \u0911\u0930\u094d\u0921\u0930 \u0915\u0940 \u092a\u0941\u0937\u094d\u091f\u093f!\\n\\n\u0911\u0930\u094d\u0921\u0930 \u0906\u0908\u0921\u0940: ${data.order_id}\\n\u0909\u0924\u094d\u092a\u093e\u0926: ${data.product_name}\\n\u092e\u093e\u0924\u094d\u0930\u093e: ${data.quantity}\\n\u0915\u0941\u0932: $${data.total}\\n\\n\u0938\u0902\u0926\u0930\u094d\u092d: ${data.order_id}`,\n bn: `\u2705 \u0985\u09b0\u09cd\u09a1\u09be\u09b0 \u09a8\u09bf\u09b6\u09cd\u099a\u09bf\u09a4!\\n\\n\u0985\u09b0\u09cd\u09a1\u09be\u09b0 \u0986\u0987\u09a1\u09bf: ${data.order_id}\\n\u09aa\u09a3\u09cd\u09af: ${data.product_name}\\n\u09aa\u09b0\u09bf\u09ae\u09be\u09a3: ${data.quantity}\\n\u09ae\u09cb\u099f: $${data.total}\\n\\n\u09b0\u09c7\u09ab\u09be\u09b0\u09c7\u09a8\u09cd\u09b8: ${data.order_id}`,\n es: `\u2705 \u00a1Pedido Confirmado!\\n\\nID: ${data.order_id}\\nProducto: ${data.product_name}\\nCantidad: ${data.quantity}\\nTotal: $${data.total}\\n\\nReferencia: ${data.order_id}`,\n ar: `\u2705 \u062a\u0645 \u062a\u0623\u0643\u064a\u062f \u0627\u0644\u0637\u0644\u0628!\\n\\n\u0645\u0639\u0631\u0641 \u0627\u0644\u0637\u0644\u0628: ${data.order_id}\\n\u0627\u0644\u0645\u0646\u062a\u062c: ${data.product_name}\\n\u0627\u0644\u0643\u0645\u064a\u0629: ${data.quantity}\\n\u0627\u0644\u0645\u062c\u0645\u0648\u0639: $${data.total}\\n\\n\u0627\u0644\u0645\u0631\u062c\u0639: ${data.order_id}`,\n fr: `\u2705 Commande Confirm\u00e9e!\\n\\nID: ${data.order_id}\\nProduit: ${data.product_name}\\nQuantit\u00e9: ${data.quantity}\\nTotal: $${data.total}\\n\\nR\u00e9f\u00e9rence: ${data.order_id}`,\n zh: `\u2705 \u8ba2\u5355\u5df2\u786e\u8ba4\uff01\\n\\n\u8ba2\u5355\u7f16\u53f7: ${data.order_id}\\n\u4ea7\u54c1: ${data.product_name}\\n\u6570\u91cf: ${data.quantity}\\n\u603b\u8ba1: $${data.total}\\n\\n\u53c2\u8003: ${data.order_id}`\n};\nconst msg = templates[data.detectedLang] || templates.en;\nreturn [{ json: { ...data, paymentMessage: msg } }];\n"
}
},
{
"id": "send_payment_prompt",
"name": "Send Payment Prompt",
"type": "n8n-nodes-base.telegram",
"typeVersion": 1.2,
"position": [
2420,
340
],
"parameters": {
"chatId": "={{ $json.chat_id }}",
"text": "={{ $json.paymentMessage }}",
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"name": "<your credential>"
}
}
},
{
"id": "update_status_awaiting_payment",
"name": "Update Status Awaiting Payment",
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
2660,
340
],
"parameters": {
"assignments": {
"assignments": [
{
"id": "1",
"name": "status",
"value": "Awaiting Payment",
"type": "string"
}
]
},
"includeOtherFields": true,
"options": {}
}
},
{
"id": "build_invoice_email",
"name": "Build Invoice Email",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
2900,
340
],
"parameters": {
"jsCode": "\nconst data = $input.item.json;\nconst subjectTemplates = {\n en: `Your Order Confirmation \u2014 ${data.order_id}`,\n hi: `\u0906\u092a\u0915\u0947 \u0911\u0930\u094d\u0921\u0930 \u0915\u0940 \u092a\u0941\u0937\u094d\u091f\u093f \u2014 ${data.order_id}`,\n bn: `\u0986\u09aa\u09a8\u09be\u09b0 \u0985\u09b0\u09cd\u09a1\u09be\u09b0 \u09a8\u09bf\u09b6\u09cd\u099a\u09bf\u09a4\u0995\u09b0\u09a3 \u2014 ${data.order_id}`,\n es: `Confirmaci\u00f3n de su Pedido \u2014 ${data.order_id}`,\n ar: `\u062a\u0623\u0643\u064a\u062f \u0637\u0644\u0628\u0643 \u2014 ${data.order_id}`,\n fr: `Confirmation de votre Commande \u2014 ${data.order_id}`,\n zh: `\u60a8\u7684\u8ba2\u5355\u786e\u8ba4 \u2014 ${data.order_id}`\n};\nconst htmlBody = `<!DOCTYPE html><html><head><style>body{font-family:Arial,sans-serif;line-height:1.6;color:#333}.container{max-width:600px;margin:0 auto;padding:20px}h2{color:#4CAF50}table{width:100%;border-collapse:collapse;margin:20px 0}th,td{padding:12px;text-align:left;border-bottom:1px solid #ddd}th{background-color:#4CAF50;color:white}</style></head><body><div class=\"container\"><h2>Order Confirmation</h2><p><strong>Order ID:</strong> ${data.order_id}</p><p><strong>Date:</strong> ${data.timestamp}</p><p><strong>Customer:</strong> ${data.customer_name || data.first_name}</p><table><tr><th>Product</th><th>Qty</th><th>Unit Price</th><th>Total</th></tr><tr><td>${data.product_name}</td><td>${data.quantity}</td><td>$${data.unit_price}</td><td>$${data.total}</td></tr></table><p><strong>Delivery Address:</strong><br>${data.delivery_address}</p><h3>Payment Instructions</h3><p>Please complete payment within 24 hours.</p><p><strong>Reference:</strong> ${data.order_id}</p></div></body></html>`;\nreturn [{ json: { ...data, emailSubject: subjectTemplates[data.detectedLang] || subjectTemplates.en, emailBody: htmlBody } }];\n"
}
},
{
"id": "send_invoice_email",
"name": "Send Invoice Email",
"type": "n8n-nodes-base.gmail",
"typeVersion": 2.1,
"position": [
3140,
340
],
"parameters": {
"sendTo": "={{ $json.email }}",
"subject": "={{ $json.emailSubject }}",
"message": "={{ $json.emailBody }}",
"options": {}
},
"credentials": {
"gmailOAuth2": {
"name": "<your credential>"
}
}
},
{
"id": "update_status_invoice_sent",
"name": "Update Status Invoice Sent",
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
3380,
340
],
"parameters": {
"assignments": {
"assignments": [
{
"id": "1",
"name": "status",
"value": "Invoice Sent",
"type": "string"
}
]
},
"includeOtherFields": true,
"options": {}
}
},
{
"id": "update_sheet_invoice_sent",
"name": "Update Sheet Invoice Sent",
"type": "n8n-nodes-base.googleSheets",
"typeVersion": 4.5,
"position": [
3620,
340
],
"parameters": {
"operation": "appendOrUpdate",
"documentId": {
"__rl": true,
"value": "https://docs.google.com/spreadsheets/d/1yC02_hcX1Tnm31jLHFGQgovfL6GuWQveA1a2IHI4l2I/edit?usp=sharing",
"mode": "url"
},
"sheetName": {
"__rl": true,
"value": "gid=0",
"mode": "list",
"cachedResultName": "Sheet1"
},
"columns": {
"mappingMode": "defineBelow",
"value": {
"order_id": "={{ $json.order_id }}",
"status": "={{ $json.status }}"
},
"matchingColumns": [
"order_id"
],
"schema": [
{
"id": "order_id",
"displayName": "order_id",
"required": true,
"defaultMatch": true,
"display": true,
"type": "string",
"canBeUsedToMatch": true
}
]
},
"options": {}
},
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
}
},
{
"id": "ai_update_parser",
"name": "AI Update Parser",
"type": "@n8n/n8n-nodes-langchain.agent",
"typeVersion": 1.7,
"position": [
720,
560
],
"parameters": {
"promptType": "define",
"text": "={{ $json.message_text }}\n\nDetected language: {{ $json.detectedLang }}",
"options": {
"systemMessage": "You are an order update parser for an ecommerce system. You ONLY handle order updates.\n\nExtract what the customer wants to change in their order.\n\nReturn ONLY valid JSON, no extra text, no markdown:\n{\n \"field_to_update\": \"delivery_address\",\n \"new_value\": \"the new value\",\n \"order_id\": \"ORD-xxx or null\"\n}\n\nIf the customer has NOT provided the new value yet, return:\n{\n \"needs_more_info\": true,\n \"ask_message\": \"Friendly question in customer's language asking for the new value\"\n}",
"maxIterations": 3
}
}
},
{
"id": "groq_model_(update)",
"name": "Groq Model (Update)",
"type": "@n8n/n8n-nodes-langchain.lmChatGroq",
"typeVersion": 1,
"position": [
720,
720
],
"parameters": {
"model": "llama-3.3-70b-versatile",
"options": {}
},
"credentials": {
"groqApi": {
"name": "<your credential>"
}
}
},
{
"id": "parse_update_request",
"name": "Parse Update Request",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
980,
560
],
"parameters": {
"jsCode": "\ntry {\n const rawOutput = $input.first().json.output || '';\n const prevData = $('Session Mode Router').first().json || {};\n const cleaned = rawOutput.replace(/```json|```/g,'').trim();\n let parsed = {};\n try { parsed = JSON.parse(cleaned); } catch(e) {\n return [{ json: { ...prevData, __needs_more_info: true, ask_message: 'Could you clarify what you would like to change?' } }];\n }\n if (parsed.needs_more_info) {\n return [{ json: { ...prevData, __needs_more_info: true, ask_message: parsed.ask_message } }];\n }\n return [{ json: { ...prevData, __needs_more_info: false, field_to_update: parsed.field_to_update, new_value: parsed.new_value, order_id: parsed.order_id } }];\n} catch(e) {\n const prevData = $('Session Mode Router').first().json || {};\n return [{ json: { ...prevData, __needs_more_info: true, ask_message: 'Could you clarify what you would like to change?' } }];\n}\n"
}
},
{
"id": "update_has_info?",
"name": "Update Has Info?",
"type": "n8n-nodes-base.switch",
"typeVersion": 3,
"position": [
1220,
560
],
"parameters": {
"rules": {
"values": [
{
"conditions": {
"conditions": [
{
"leftValue": "={{ $json.__needs_more_info }}",
"rightValue": true,
"operator": {
"type": "boolean",
"operation": "equals"
}
}
],
"combinator": "and"
},
"renameOutput": true,
"outputKey": "needs_info"
},
{
"conditions": {
"conditions": [
{
"leftValue": "={{ $json.__needs_more_info }}",
"rightValue": false,
"operator": {
"type": "boolean",
"operation": "equals"
}
}
],
"combinator": "and"
},
"renameOutput": true,
"outputKey": "has_info"
}
]
}
}
},
{
"id": "ask_update_info",
"name": "Ask Update Info",
"type": "n8n-nodes-base.telegram",
"typeVersion": 1.2,
"position": [
1460,
480
],
"parameters": {
"chatId": "={{ $json.chat_id }}",
"text": "={{ $json.ask_message }}",
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"name": "<your credential>"
}
}
},
{
"id": "find_order_(update)",
"name": "Find Order (Update)",
"type": "n8n-nodes-base.googleSheets",
"typeVersion": 4.5,
"position": [
1460,
660
],
"parameters": {
"documentId": {
"__rl": true,
"value": "https://docs.google.com/spreadsheets/d/1yC02_hcX1Tnm31jLHFGQgovfL6GuWQveA1a2IHI4l2I/edit?usp=sharing",
"mode": "url"
},
"sheetName": {
"__rl": true,
"value": "gid=0",
"mode": "list",
"cachedResultName": "Sheet1"
},
"filtersUI": {
"values": [
{
"lookupColumn": "chat_id",
"lookupValue": "={{ $json.chat_id }}"
}
]
},
"options": {}
},
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
}
},
{
"id": "merge_update_data",
"name": "Merge Update Data",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
1700,
660
],
"parameters": {
"jsCode": "\nconst updateData = $('Parse Update Request').first().json;\nconst orderRow = $input.first().json;\nif (!orderRow || !orderRow.order_id) {\n return [{ json: { ...updateData, __no_order_found: true } }];\n}\nreturn [{ json: { ...updateData, found_order_id: orderRow.order_id, existing_order: orderRow } }];\n"
}
},
{
"id": "update_order_in_sheet",
"name": "Update Order in Sheet",
"type": "n8n-nodes-base.googleSheets",
"typeVersion": 4.5,
"position": [
1940,
660
],
"parameters": {
"operation": "update",
"documentId": {
"__rl": true,
"value": "https://docs.google.com/spreadsheets/d/1yC02_hcX1Tnm31jLHFGQgovfL6GuWQveA1a2IHI4l2I/edit?usp=sharing",
"mode": "url"
},
"sheetName": {
"__rl": true,
"value": "gid=0",
"mode": "list",
"cachedResultName": "Sheet1"
},
"columns": {
"mappingMode": "defineBelow",
"value": {
"order_id": "={{ $json.found_order_id }}",
"={{ $json.field_to_update }}": "={{ $json.new_value }}"
},
"matchingColumns": [
"order_id"
],
"schema": [
{
"id": "order_id",
"displayName": "order_id",
"required": true,
"defaultMatch": true,
"display": true,
"type": "string",
"canBeUsedToMatch": true
}
]
},
"options": {}
},
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
}
},
{
"id": "clear_session_(update)",
"name": "Clear Session (Update)",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
2180,
660
],
"parameters": {
"jsCode": "\nconst data = $input.first().json;\nconst chatId = String(data.chat_id);\nconst store = $getWorkflowStaticData('global');\nif (!store.sessions) store.sessions = {};\nstore.sessions[chatId] = { mode: 'CHAT', context: {} };\nreturn [{ json: data }];\n"
}
},
{
"id": "build_update_confirmation",
"name": "Build Update Confirmation",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
2420,
660
],
"parameters": {
"jsCode": "\nconst data = $('Merge Update Data').first().json;\nconst lang = data.detectedLang || 'en';\nconst templates = {\n en: `\u2705 Your order has been updated!\\nOrder ID: ${data.found_order_id}\\nChanged: ${data.field_to_update} \u2192 ${data.new_value}`,\n hi: `\u2705 \u0906\u092a\u0915\u093e \u0911\u0930\u094d\u0921\u0930 \u0905\u092a\u0921\u0947\u091f \u0939\u094b \u0917\u092f\u093e!\\n\u0911\u0930\u094d\u0921\u0930 \u0906\u0908\u0921\u0940: ${data.found_order_id}\\n\u092c\u0926\u0932\u093e: ${data.field_to_update} \u2192 ${data.new_value}`,\n bn: `\u2705 \u0986\u09aa\u09a8\u09be\u09b0 \u0985\u09b0\u09cd\u09a1\u09be\u09b0 \u0986\u09aa\u09a1\u09c7\u099f \u09b9\u09af\u09bc\u09c7\u099b\u09c7!\\n\u0985\u09b0\u09cd\u09a1\u09be\u09b0 \u0986\u0987\u09a1\u09bf: ${data.found_order_id}`,\n es: `\u2705 \u00a1Su pedido ha sido actualizado!\\nID: ${data.found_order_id}`,\n ar: `\u2705 \u062a\u0645 \u062a\u062d\u062f\u064a\u062b \u0637\u0644\u0628\u0643!\\n\u0645\u0639\u0631\u0641 \u0627\u0644\u0637\u0644\u0628: ${data.found_order_id}`,\n fr: `\u2705 Votre commande a \u00e9t\u00e9 mise \u00e0 jour!\\nID: ${data.found_order_id}`,\n zh: `\u2705 \u60a8\u7684\u8ba2\u5355\u5df2\u66f4\u65b0\uff01\\n\u8ba2\u5355\u7f16\u53f7: ${data.found_order_id}`\n};\nreturn [{ json: { ...data, confirmMessage: templates[lang] || templates.en } }];\n"
}
},
{
"id": "send_update_confirmation",
"name": "Send Update Confirmation",
"type": "n8n-nodes-base.telegram",
"typeVersion": 1.2,
"position": [
2660,
660
],
"parameters": {
"chatId": "={{ $json.chat_id }}",
"text": "={{ $json.confirmMessage }}",
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"name": "<your credential>"
}
}
},
{
"id": "extract_order_id",
"name": "Extract Order ID",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
720,
900
],
"parameters": {
"jsCode": "\nconst item = $input.first().json;\nconst text = item.message_text || '';\nconst match = text.match(/ORD-\\d+/i);\nreturn [{ json: { ...item, extracted_order_id: match ? match[0] : null } }];\n"
}
},
{
"id": "find_order_(cancel)",
"name": "Find Order (Cancel)",
"type": "n8n-nodes-base.googleSheets",
"typeVersion": 4.5,
"position": [
980,
900
],
"parameters": {
"documentId": {
"__rl": true,
"value": "https://docs.google.com/spreadsheets/d/1yC02_hcX1Tnm31jLHFGQgovfL6GuWQveA1a2IHI4l2I/edit?usp=sharing",
"mode": "url"
},
"sheetName": {
"__rl": true,
"value": "gid=0",
"mode": "list",
"cachedResultName": "Sheet1"
},
"filtersUI": {
"values": [
{
"lookupColumn": "chat_id",
"lookupValue": "={{ $json.chat_id }}"
}
]
},
"options": {}
},
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
}
},
{
"id": "check_cancel_order",
"name": "Check Cancel Order",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
1220,
900
],
"parameters": {
"jsCode": "\nconst orderRow = $input.first().json;\nconst prevData = $('Session Mode Router').first().json || {};\nif (!orderRow || !orderRow.order_id) {\n return [{ json: { ...prevData, __no_order_found: true } }];\n}\nreturn [{ json: { ...prevData, __no_order_found: false, found_order_id: orderRow.order_id, existing_status: orderRow.status || 'Unknown', customer_name: orderRow.customer_name || prevData.first_name } }];\n"
}
},
{
"id": "cancel_order_found?",
"name": "Cancel Order Found?",
"type": "n8n-nodes-base.switch",
"typeVersion": 3,
"position": [
1460,
900
],
"parameters": {
"rules": {
"values": [
{
"conditions": {
"conditions": [
{
"leftValue": "={{ $json.__no_order_found }}",
"rightValue": true,
"operator": {
"type": "boolean",
"operation": "equals"
}
}
],
"combinator": "and"
},
"renameOutput": true,
"outputKey": "not_found"
},
{
"conditions": {
"conditions": [
{
"leftValue": "={{ $json.__no_order_found }}",
"rightValue": false,
"operator": {
"type": "boolean",
"operation": "equals"
}
}
],
"combinator": "and"
},
"renameOutput": true,
"outputKey": "found"
}
]
}
}
},
{
"id": "order_not_found_reply",
"name": "Order Not Found Reply",
"type": "n8n-nodes-base.telegram",
"typeVersion": 1.2,
"position": [
1700,
820
],
"parameters": {
"chatId": "={{ $json.chat_id }}",
"text": "\u274c No order found for your account. Please check your order ID and try again.",
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"name": "<your credential>"
}
}
},
{
"id": "set_status_cancelled",
"name": "Set Status CANCELLED",
"type": "n8n-nodes-base.googleSheets",
"typeVersion": 4.5,
"position": [
1700,
1000
],
"parameters": {
"operation": "update",
"documentId": {
"__rl": true,
"value": "https://docs.google.com/spreadsheets/d/1yC02_hcX1Tnm31jLHFGQgovfL6GuWQveA1a2IHI4l2I/edit?usp=sharing",
"mode": "url"
},
"sheetName": {
"__rl": true,
"value": "gid=0",
"mode": "list",
"cachedResultName": "Sheet1"
},
"columns": {
"mappingMode": "defineBelow",
"value": {
"order_id": "={{ $json.found_order_id }}",
"status": "CANCELLED"
},
"matchingColumns": [
"order_id"
],
"schema": [
{
"id": "order_id",
"displayName": "order_id",
"required": true,
"defaultMatch": true,
"display": true,
"type": "string",
"canBeUsedToMatch": true
}
]
},
"options": {}
},
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
}
},
{
"id": "clear_session_(cancel)",
"name": "Clear Session (Cancel)",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
1940,
1000
],
"parameters": {
"jsCode": "\nconst data = $input.first().json;\nconst chatId = String(data.chat_id);\nconst store = $getWorkflowStaticData('global');\nif (!store.sessions) store.sessions = {};\nstore.sessions[chatId] = { mode: 'CHAT', context: {} };\nreturn [{ json: data }];\n"
}
},
{
"id": "build_cancel_confirmation",
"name": "Build Cancel Confirmation",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
2180,
1000
],
"parameters": {
"jsCode": "\nconst data = $('Check Cancel Order').first().json;\nconst lang = data.detectedLang || 'en';\nconst templates = {\n en: `\u274c Your order has been cancelled.\\n\\nOrder ID: ${data.found_order_id}\\nStatus: CANCELLED\\n\\nSorry to see you go! If you change your mind, we're here to help. \ud83d\ude0a`,\n hi: `\u274c \u0906\u092a\u0915\u093e \u0911\u0930\u094d\u0921\u0930 \u0930\u0926\u094d\u0926 \u0939\u094b \u0917\u092f\u093e\u0964\\n\\n\u0911\u0930\u094d\u0921\u0930 \u0906\u0908\u0921\u0940: ${data.found_order_id}\\n\u0938\u094d\u0925\u093f\u0924\u093f: \u0930\u0926\u094d\u0926`,\n bn: `\u274c \u0986\u09aa\u09a8\u09be\u09b0 \u0985\u09b0\u09cd\u09a1\u09be\u09b0 \u09ac\u09be\u09a4\u09bf\u09b2 \u09b9\u09af\u09bc\u09c7\u099b\u09c7\u0964\\n\\n\u0985\u09b0\u09cd\u09a1\u09be\u09b0 \u0986\u0987\u09a1\u09bf: ${data.found_order_id}`,\n es: `\u274c Su pedido ha sido cancelado.\\n\\nID: ${data.found_order_id}`,\n ar: `\u274c \u062a\u0645 \u0625\u0644\u063a\u0627\u0621 \u0637\u0644\u0628\u0643.\\n\\n\u0645\u0639\u0631\u0641 \u0627\u0644\u0637\u0644\u0628: ${data.found_order_id}`,\n fr: `\u274c Votre commande a \u00e9t\u00e9 annul\u00e9e.\\n\\nID: ${data.found_order_id}`,\n zh: `\u274c \u60a8\u7684\u8ba2\u5355\u5df2\u53d6\u6d88\u3002\\n\\n\u8ba2\u5355\u7f16\u53f7: ${data.found_order_id}`\n};\nreturn [{ json: { ...data, cancelMessage: templates[lang] || templates.en } }];\n"
}
},
{
"id": "send_cancel_confirmation",
"name": "Send Cancel Confirmation",
"type": "n8n-nodes-base.telegram",
"typeVersion": 1.2,
"position": [
2420,
1000
],
"parameters": {
"chatId": "={{ $json.chat_id }}",
"text": "={{ $json.cancelMessage }}",
"additionalFields": {}
},
"credentials": {
"telegramApi": {
"name": "<your credential>"
}
}
}
],
"connections": {
"Telegram Trigger": {
"main": [
[
{
"node": "Detect Language",
"type": "main",
"index": 0
}
]
]
},
"Detect Language": {
"main": [
[
{
"node": "Session Mode Router",
"type": "main",
"index": 0
}
]
]
},
"Session Mode Router": {
"main": [
[
{
"node": "Mode Switch",
"type": "main",
"index": 0
}
]
]
},
"Mode Switch": {
"main": [
[
{
"node": "Intent Classifier",
"type": "main",
"index": 0
}
],
[
{
"node": "AI Order Parser",
"type": "main",
"index": 0
}
],
[
{
"node": "AI Update Parser",
"type": "main",
"index": 0
}
],
[
{
"node": "Extract Order ID",
"type": "main",
"index": 0
}
]
]
},
"Groq Model (Intent)": {
"ai_languageModel": [
[
{
"node": "Intent Classifier",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Intent Classifier": {
"main": [
[
{
"node": "Parse Intent",
"type": "main",
"index": 0
}
]
]
},
"Parse Intent": {
"main": [
[
{
"node": "Intent Router",
"type": "main",
"index": 0
}
]
]
},
"Intent Router": {
"main": [
[
{
"node": "AI Chat Reply",
"type": "main",
"index": 0
}
],
[
{
"node": "Set Mode ORDER",
"type": "main",
"index": 0
}
],
[
{
"node": "Set Mode UPDATE",
"type": "main",
"index": 0
}
],
[
{
"node": "Set Mode CANCEL",
"type": "main",
"index": 0
}
]
]
},
"Groq Model (Chat)": {
"ai_languageModel": [
[
{
"node": "AI Chat Reply",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"AI Chat Reply": {
"main": [
[
{
"node": "Send Chat Reply",
"type": "main",
"index": 0
}
]
]
},
"Set Mode ORDER": {
"main": [
[
{
"node": "AI Order Parser",
"type": "main",
"index": 0
}
]
]
},
"Set Mode UPDATE": {
"main": [
[
{
"node": "AI Update Parser",
"type": "main",
"index": 0
}
]
]
},
"Set Mode CANCEL": {
"main": [
[
{
"node": "Extract Order ID",
"type": "main",
"index": 0
}
]
]
},
"Groq Model (Order)": {
"ai_languageModel": [
[
{
"node": "AI Order Parser",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"AI Order Parser": {
"main": [
[
{
"node": "Parse Order JSON",
"type": "main",
"index": 0
}
]
]
},
"Parse Order JSON": {
"main": [
[
{
"node": "Order Complete?",
"type": "main",
"index": 0
}
]
]
},
"Order Complete?": {
"main": [
[
{
"node": "Ask For More Info",
"type": "main",
"index": 0
}
],
[
{
"node": "Generate Order ID",
"type": "main",
"index": 0
}
]
]
},
"Generate Order ID": {
"main": [
[
{
"node": "Save to Google Sheets",
"type": "main",
"index": 0
}
]
]
},
"Save to Google Sheets": {
"main": [
[
{
"node": "Clear Session (Order)",
"type": "main",
"index": 0
}
]
]
},
"Clear Session (Order)": {
"main": [
[
{
"node": "Build Payment Message",
"type": "main",
"index": 0
}
]
]
},
"Build Payment Message": {
"main": [
[
{
"node": "Send Payment Prompt",
"type": "main",
"index": 0
}
]
]
},
"Send Payment Prompt": {
"main": [
[
{
"node": "Update Status Awaiting Payment",
"type": "main",
"index": 0
}
]
]
},
"Update Status Awaiting Payment": {
"main": [
[
{
"node": "Build Invoice Email",
"type": "main",
"index": 0
}
]
]
},
"Build Invoice Email": {
"main": [
[
{
"node": "Send Invoice Email",
"type": "main",
"index": 0
}
]
]
},
"Send Invoice Email": {
"main": [
[
{
"node": "Update Status Invoice Sent",
"type": "main",
"index": 0
}
]
]
},
"Update Status Invoice Sent": {
"main": [
[
{
"node": "Update Sheet Invoice Sent",
"type": "main",
"index": 0
}
]
]
},
"Groq Model (Update)": {
"ai_languageModel": [
[
{
"node": "AI Update Parser",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"AI Update Parser": {
"main": [
[
{
"node": "Parse Update Request",
"type": "main",
"index": 0
}
]
]
},
"Parse Update Request": {
"main": [
[
{
"node": "Update Has Info?",
"type": "main",
"index": 0
}
]
]
},
"Update Has Info?": {
"main": [
[
{
"node": "Ask Update Info",
"type": "main",
"index": 0
}
],
[
{
"node": "Find Order (Update)",
"type": "main",
"index": 0
}
]
]
},
"Find Order (Update)": {
"main": [
[
{
"node": "Merge Update Data",
"type": "main",
"index": 0
}
]
]
},
"Merge Update Data": {
"main": [
[
{
"node": "Update Order in Sheet",
"type": "main",
"index": 0
}
]
]
},
"Update Order in Sheet": {
"main": [
[
{
"node": "Clear Session (Update)",
"type": "main",
"index": 0
}
]
]
},
"Clear Session (Update)": {
"main": [
[
{
"node": "Build Update Confirmation",
"type": "main",
"index": 0
}
]
]
},
"Build Update Confirmation": {
"main": [
[
{
"node": "Send Update Confirmation",
"type": "main",
"index": 0
}
]
]
},
"Extract Order ID": {
"main": [
[
{
"node": "Find Order (Cancel)",
"type": "main",
"index": 0
}
]
]
},
"Find Order (Cancel)": {
"main": [
[
{
"node": "Check Cancel Order",
"type": "main",
"index": 0
}
]
]
},
"Check Cancel Order": {
"main": [
[
{
"node": "Cancel Order Found?",
"type": "main",
"index": 0
}
]
]
},
"Cancel Order Found?": {
"main": [
[
{
"node": "Order Not Found Reply",
"type": "main",
"index": 0
}
],
[
{
"node": "Set Status CANCELLED",
"type": "main",
"index": 0
}
]
]
},
"Set Status CANCELLED": {
"main": [
[
{
"node": "Clear Session (Cancel)",
"type": "main",
"index": 0
}
]
]
},
"Clear Session (Cancel)": {
"main": [
[
{
"node": "Build Cancel Confirmation",
"type": "main",
"index": 0
}
]
]
},
"Build Cancel Confirmation": {
"main": [
[
{
"node": "Send Cancel Confirmation",
"type": "main",
"index": 0
}
]
]
}
},
"settings": {
"executionOrder": "v1"
}
}
Credentials you'll need
Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.
gmailOAuth2googleSheetsOAuth2ApigroqApitelegramApi
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
Ecommerce Bot v6 — Mode Switch. Uses telegramTrigger, agent, lmChatGroq, telegram. Event-driven trigger; 49 nodes.
Source: https://github.com/Aditya2005-cloud/N8Nproject-main/blob/main/ecommerce_bot_v6_FINAL.json — 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.
BoomerBobBot.TP. Uses agent, telegramTrigger, telegram, memoryBufferWindow. Event-driven trigger; 95 nodes.
Arvifund - Supabase (Fixed v5). Uses httpRequest, telegram, googleSheets, telegramTrigger. Event-driven trigger; 91 nodes.
Arvifund - Supabase. Uses httpRequest, telegram, googleSheets, telegramTrigger. Event-driven trigger; 90 nodes.
Arvifund - Supabase (Fixed v2). Uses httpRequest, telegram, googleSheets, telegramTrigger. Event-driven trigger; 90 nodes.
Arvifund - Supabase (Fixed v4). Uses httpRequest, telegram, googleSheets, telegramTrigger. Event-driven trigger; 90 nodes.