This workflow corresponds to n8n.io template #17418 — we link there as the canonical source.
This workflow follows the Error Trigger → Google Sheets 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 →
{
"id": "R43h60lZiszMuEYu",
"meta": {
"templateCredsSetupCompleted": true
},
"name": "AI COD Order Confirmation & Cart Recovery Automation",
"tags": [],
"nodes": [
{
"id": "b05d30b3-4740-4144-a534-1949532d17ec",
"name": "\ud83d\udccc Overview \u2013 How This Workflow Works",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1824,
176
],
"parameters": {
"content": ""
},
"typeVersion": 1
},
{
"id": "a68355cb-ad6a-45c2-a7ff-4688ab013677",
"name": "Section \u2013 Order Placement & Confirmation",
"type": "n8n-nodes-base.stickyNote",
"position": [
-160,
592
],
"parameters": {
"content": ""
},
"typeVersion": 1
},
{
"id": "23198453-1576-4ce7-b220-a6356c85587c",
"name": "Section \u2013 Confirm / Cancel Handler",
"type": "n8n-nodes-base.stickyNote",
"position": [
-320,
1088
],
"parameters": {
"content": ""
},
"typeVersion": 1
},
{
"id": "29e1811c-0607-4fd0-93fa-9cd2c81f1d6b",
"name": "Section \u2013 Auto Follow-Up & RTO Flagging",
"type": "n8n-nodes-base.stickyNote",
"position": [
-368,
1840
],
"parameters": {
"content": ""
},
"typeVersion": 1
},
{
"id": "26f2155f-ea53-4687-9991-3d73ba408eda",
"name": "Section \u2013 Abandoned Cart Recovery",
"type": "n8n-nodes-base.stickyNote",
"position": [
-368,
2576
],
"parameters": {
"content": ""
},
"typeVersion": 1
},
{
"id": "ea4a3e6a-8368-4b7c-8dd5-5a4ccec95f65",
"name": "\ud83d\udd11 Credentials & Setup",
"type": "n8n-nodes-base.stickyNote",
"position": [
1472,
352
],
"parameters": {
"content": ""
},
"typeVersion": 1
},
{
"id": "f41bc584-b417-4f10-904c-1020ee60cd0e",
"name": "Listen for Button Replies",
"type": "n8n-nodes-base.telegramTrigger",
"position": [
-32,
1392
],
"parameters": {},
"typeVersion": 1.1
},
{
"id": "9449582d-fbd5-4955-af6b-2e6e95dea239",
"name": "Route Confirm vs Cancel",
"type": "n8n-nodes-base.switch",
"position": [
240,
1392
],
"parameters": {},
"typeVersion": 3.2
},
{
"id": "4794aee1-7077-43e2-920d-f3760607aa55",
"name": "Update Sheet \u2014 Confirmed",
"type": "n8n-nodes-base.googleSheets",
"position": [
624,
1280
],
"parameters": {},
"typeVersion": 4.5
},
{
"id": "309a9e0c-8b57-4505-9b6d-4d172dacabea",
"name": "Send Confirmation Thanks",
"type": "n8n-nodes-base.telegram",
"position": [
928,
1280
],
"parameters": {},
"typeVersion": 1.2
},
{
"id": "991dd0f2-b4fe-48d2-bc33-b4f99c02dbdd",
"name": "Update Sheet \u2014 Cancelled",
"type": "n8n-nodes-base.googleSheets",
"position": [
512,
1472
],
"parameters": {},
"typeVersion": 4.5
},
{
"id": "efaa1363-c053-460c-8f86-18d0609debbe",
"name": "Send Cancellation Ack",
"type": "n8n-nodes-base.telegram",
"position": [
752,
1472
],
"parameters": {},
"typeVersion": 1.2
},
{
"id": "c15fdcfc-40af-4a5f-af57-a3b9bba20d23",
"name": "Notify Admin \u2014 Order Cancelled",
"type": "n8n-nodes-base.telegram",
"position": [
992,
1472
],
"parameters": {},
"typeVersion": 1.2
},
{
"id": "9511c497-78ca-4101-88d0-4afbe0f45fc1",
"name": "Every 15 Minutes",
"type": "n8n-nodes-base.scheduleTrigger",
"position": [
-128,
2176
],
"parameters": {},
"typeVersion": 1.2
},
{
"id": "7a024afd-2889-4932-8db4-0fe0e6a1d247",
"name": "Get Pending Orders",
"type": "n8n-nodes-base.googleSheets",
"position": [
112,
2176
],
"parameters": {},
"typeVersion": 4.5
},
{
"id": "6f8a2c13-01ba-4296-a8ed-59d6ddb7a9c6",
"name": "Calculate Elapsed & Nudge Stage",
"type": "n8n-nodes-base.code",
"position": [
368,
2176
],
"parameters": {},
"typeVersion": 2
},
{
"id": "a1b714f2-5049-495b-8544-e98f1d6a05cf",
"name": "Filter \u2014 Due for Nudge Now",
"type": "n8n-nodes-base.filter",
"position": [
608,
2080
],
"parameters": {},
"typeVersion": 2.2
},
{
"id": "b72df243-7ab7-4e8f-a558-7df0a9be81b2",
"name": "Generate Nudge Message (AI)",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
800,
2080
],
"parameters": {},
"typeVersion": 1.8
},
{
"id": "0c5f08b6-d160-4038-9237-ba3e6a4e8963",
"name": "Send Follow-Up Nudge",
"type": "n8n-nodes-base.telegram",
"position": [
1136,
2080
],
"parameters": {},
"typeVersion": 1.2
},
{
"id": "5b27e12c-7270-428a-8185-69de2a5ea427",
"name": "Update Nudge Count",
"type": "n8n-nodes-base.googleSheets",
"position": [
1392,
2080
],
"parameters": {},
"typeVersion": 4.5
},
{
"id": "d72eb4f3-e9cf-41ae-9919-eb8cfb38f066",
"name": "Filter \u2014 RTO Risk (2hr+)",
"type": "n8n-nodes-base.filter",
"position": [
672,
2320
],
"parameters": {},
"typeVersion": 2.2
},
{
"id": "1b948bb8-3421-4a9b-bc7d-3d03d94aa58b",
"name": "Notify Admin \u2014 RTO Risk",
"type": "n8n-nodes-base.telegram",
"position": [
912,
2320
],
"parameters": {},
"typeVersion": 1.2
},
{
"id": "c1d108d8-53a7-48b6-8530-c799c1122d04",
"name": "Mark RTO Risk in Sheet",
"type": "n8n-nodes-base.googleSheets",
"position": [
1152,
2320
],
"parameters": {},
"typeVersion": 4.5
},
{
"id": "f4be9251-c2bd-45fe-9315-2464dd00d37b",
"name": "New Order Placed",
"type": "n8n-nodes-base.webhook",
"position": [
32,
784
],
"parameters": {},
"typeVersion": 2
},
{
"id": "06a8054f-1eff-4cd1-b9d5-eb69833dc7e9",
"name": "Normalize Order Data",
"type": "n8n-nodes-base.set",
"position": [
272,
784
],
"parameters": {},
"typeVersion": 3.4
},
{
"id": "54d3d82d-24ef-4bc3-952e-43525719514b",
"name": "Log Order to Sheet",
"type": "n8n-nodes-base.googleSheets",
"position": [
528,
784
],
"parameters": {},
"typeVersion": 4.5
},
{
"id": "1e5baff6-9f04-4194-a0af-7886d7800394",
"name": "Send Order Confirmation",
"type": "n8n-nodes-base.telegram",
"position": [
768,
784
],
"parameters": {},
"typeVersion": 1.2
},
{
"id": "cc1b2cfb-4bbf-402c-8c0b-c1cb789bcfcf",
"name": "Cart Abandoned",
"type": "n8n-nodes-base.webhook",
"position": [
-256,
2816
],
"parameters": {},
"typeVersion": 2
},
{
"id": "549bd5a7-f5dc-4493-9cd0-51fbfdc47a14",
"name": "Normalize Cart Data",
"type": "n8n-nodes-base.set",
"position": [
-16,
2816
],
"parameters": {},
"typeVersion": 3.4
},
{
"id": "f4a74895-4039-4fcc-8646-7e19c8922c61",
"name": "Log Abandoned Cart",
"type": "n8n-nodes-base.googleSheets",
"position": [
240,
2816
],
"parameters": {},
"typeVersion": 4.5
},
{
"id": "659b01a3-0419-4101-9ccc-a92067628859",
"name": "Wait 30 Minutes",
"type": "n8n-nodes-base.wait",
"position": [
480,
2816
],
"parameters": {},
"typeVersion": 1.1
},
{
"id": "788687bf-55ea-44d7-bd11-f0bcdf46dba3",
"name": "Check If Order Placed",
"type": "n8n-nodes-base.googleSheets",
"position": [
720,
2816
],
"parameters": {},
"typeVersion": 4.5
},
{
"id": "cdc9167b-256e-40e5-92fb-b6d7a7cb5a9a",
"name": "Order Already Placed?",
"type": "n8n-nodes-base.if",
"position": [
960,
2816
],
"parameters": {},
"typeVersion": 2.2
},
{
"id": "c4e16788-e1f9-49e7-bb6e-ffa048322329",
"name": "Generate Discount Message (AI)",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
1216,
3008
],
"parameters": {},
"typeVersion": 1.8
},
{
"id": "95964cdf-8029-43ed-b0d7-7c4209d53220",
"name": "Send Discount Recovery",
"type": "n8n-nodes-base.telegram",
"position": [
1552,
3008
],
"parameters": {},
"typeVersion": 1.2
},
{
"id": "7e9c5591-7725-4bee-8233-98a56ca72758",
"name": "Update Cart \u2014 Recovery Sent",
"type": "n8n-nodes-base.googleSheets",
"position": [
1824,
3008
],
"parameters": {},
"typeVersion": 4.5
},
{
"id": "14870760-df31-4aa1-ab0a-0713699d4378",
"name": "Skip \u2014 Already Ordered",
"type": "n8n-nodes-base.noOp",
"position": [
1200,
2800
],
"parameters": {},
"typeVersion": 1
},
{
"id": "770e5114-b1f8-419a-a635-8e279d2a694c",
"name": "Section \u2013 Error Handling",
"type": "n8n-nodes-base.stickyNote",
"position": [
1616,
1088
],
"parameters": {
"content": ""
},
"typeVersion": 1
},
{
"id": "14d88502-6077-4c65-9389-67c1a9b3c3b7",
"name": "On Workflow Error",
"type": "n8n-nodes-base.errorTrigger",
"position": [
1744,
1344
],
"parameters": {},
"typeVersion": 1
},
{
"id": "6773a693-15d3-46f7-8ba0-6135bc753c9a",
"name": "Slack \u2013 Post Workflow Error Alert",
"type": "n8n-nodes-base.slack",
"position": [
2016,
1344
],
"parameters": {},
"typeVersion": 2.3
}
],
"active": false,
"settings": {
"binaryMode": "separate",
"availableInMCP": false,
"executionOrder": "v1"
},
"versionId": "bb62d955-567b-48cc-b718-9e23f377c053",
"nodeGroups": [],
"connections": {
"Cart Abandoned": {
"main": [
[
{
"node": "Normalize Cart Data",
"type": "main",
"index": 0
}
]
]
},
"Wait 30 Minutes": {
"main": [
[
{
"node": "Check If Order Placed",
"type": "main",
"index": 0
}
]
]
},
"Every 15 Minutes": {
"main": [
[
{
"node": "Get Pending Orders",
"type": "main",
"index": 0
}
]
]
},
"New Order Placed": {
"main": [
[
{
"node": "Normalize Order Data",
"type": "main",
"index": 0
}
]
]
},
"On Workflow Error": {
"main": [
[
{
"node": "Slack \u2013 Post Workflow Error Alert",
"type": "main",
"index": 0
}
]
]
},
"Get Pending Orders": {
"main": [
[
{
"node": "Calculate Elapsed & Nudge Stage",
"type": "main",
"index": 0
}
]
]
},
"Log Abandoned Cart": {
"main": [
[
{
"node": "Wait 30 Minutes",
"type": "main",
"index": 0
}
]
]
},
"Log Order to Sheet": {
"main": [
[
{
"node": "Send Order Confirmation",
"type": "main",
"index": 0
}
]
]
},
"Normalize Cart Data": {
"main": [
[
{
"node": "Log Abandoned Cart",
"type": "main",
"index": 0
}
]
]
},
"Normalize Order Data": {
"main": [
[
{
"node": "Log Order to Sheet",
"type": "main",
"index": 0
}
]
]
},
"Send Follow-Up Nudge": {
"main": [
[
{
"node": "Update Nudge Count",
"type": "main",
"index": 0
}
]
]
},
"Check If Order Placed": {
"main": [
[
{
"node": "Order Already Placed?",
"type": "main",
"index": 0
}
]
]
},
"Order Already Placed?": {
"main": [
[
{
"node": "Skip \u2014 Already Ordered",
"type": "main",
"index": 0
}
],
[
{
"node": "Generate Discount Message (AI)",
"type": "main",
"index": 0
}
]
]
},
"Send Cancellation Ack": {
"main": [
[
{
"node": "Notify Admin \u2014 Order Cancelled",
"type": "main",
"index": 0
}
]
]
},
"Send Discount Recovery": {
"main": [
[
{
"node": "Update Cart \u2014 Recovery Sent",
"type": "main",
"index": 0
}
]
]
},
"Route Confirm vs Cancel": {
"main": [
[
{
"node": "Update Sheet \u2014 Confirmed",
"type": "main",
"index": 0
}
],
[
{
"node": "Update Sheet \u2014 Cancelled",
"type": "main",
"index": 0
}
]
]
},
"Listen for Button Replies": {
"main": [
[
{
"node": "Route Confirm vs Cancel",
"type": "main",
"index": 0
}
]
]
},
"Notify Admin \u2014 RTO Risk": {
"main": [
[
{
"node": "Mark RTO Risk in Sheet",
"type": "main",
"index": 0
}
]
]
},
"Filter \u2014 RTO Risk (2hr+)": {
"main": [
[
{
"node": "Notify Admin \u2014 RTO Risk",
"type": "main",
"index": 0
}
]
]
},
"Update Sheet \u2014 Cancelled": {
"main": [
[
{
"node": "Send Cancellation Ack",
"type": "main",
"index": 0
}
]
]
},
"Update Sheet \u2014 Confirmed": {
"main": [
[
{
"node": "Send Confirmation Thanks",
"type": "main",
"index": 0
}
]
]
},
"Generate Nudge Message (AI)": {
"main": [
[
{
"node": "Send Follow-Up Nudge",
"type": "main",
"index": 0
}
]
]
},
"Filter \u2014 Due for Nudge Now": {
"main": [
[
{
"node": "Generate Nudge Message (AI)",
"type": "main",
"index": 0
}
]
]
},
"Generate Discount Message (AI)": {
"main": [
[
{
"node": "Send Discount Recovery",
"type": "main",
"index": 0
}
]
]
},
"Calculate Elapsed & Nudge Stage": {
"main": [
[
{
"node": "Filter \u2014 Due for Nudge Now",
"type": "main",
"index": 0
},
{
"node": "Filter \u2014 RTO Risk (2hr+)",
"type": "main",
"index": 0
}
]
]
}
}
}
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
This workflow handles COD order confirmation and abandoned-cart recovery by combining webhooks, Google Sheets logging, OpenAI message generation, and Telegram messaging with inline buttons, plus Slack alerts for execution errors. Receives a new COD order via a webhook,…
Source: https://n8n.io/workflows/17418/ — 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 workflow handles customer order complaints submitted via Telegram by looking up order details in Google Sheets, using OpenAI to classify message sentiment, and routing each case to auto-approval,
This workflow runs a Telegram restaurant ordering flow that uses OpenAI to parse orders and suggest an upsell, sends a Razorpay payment link, confirms paid orders via a Razorpay webhook, logs orders a
This workflow handles dental clinic patient conversations in Telegram, using OpenAI to answer treatment-plan and general questions, logging bookings and payment plans in Google Sheets, sending automat
This workflow lets customers order and refill prescriptions via Telegram by extracting medicines from prescription images with Google Gemini, checking and updating inventory in Google Sheets, and send
This workflow runs weekly to pull HR datasets from Google Sheets, calculate rule-based attrition risk signals, and enrich them with an OpenAI (GPT-4o-mini) risk assessment. It logs results back to Goo