Confirm COD orders and recover carts with Telegram, Google Sheets, OpenAI and Slack
Ready for 3.0Ready for 3.0. This template uses no nodes that n8n 3.0 removes. No removed nodes, versions or helpers found. Static check, last run 2026-10-19.
Nodes used (15)
- Telegram Trigger
n8n-nodes-base.telegramTrigger - Switch
n8n-nodes-base.switch - Google Sheets
n8n-nodes-base.googleSheets - Telegram
n8n-nodes-base.telegram - Schedule Trigger
n8n-nodes-base.scheduleTrigger - Code
n8n-nodes-base.code - Filter
n8n-nodes-base.filter - OpenAI
@n8n/n8n-nodes-langchain.openAi - Webhook
n8n-nodes-base.webhook - Edit Fields (Set)
n8n-nodes-base.set - Wait
n8n-nodes-base.wait - If
n8n-nodes-base.if - No Operation, do nothing
n8n-nodes-base.noOp - Error Trigger
n8n-nodes-base.errorTrigger - Slack
n8n-nodes-base.slack
What it does
Quick overview 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. How it works 1. Receives a new COD order via a webhook, normalizes the payload, appends it to an Orders Google Sheets tab, and sends the customer a Telegram message with Confirm/Cancel buttons. 2. Listens for Telegram button callbacks and routes the response to either confirm or cancel the order. 3. On confirmation, updates the matching order in Google Sheets and sends a Telegram thank-you message to the customer. 4. On cancellation, updates the order in Google Sheets, acknowledges the cancellation in Telegram, and notifies an admin via Telegram. 5. Runs every 15 minutes, reads orders from Google Sheets, calculates how long each order has been pending, and uses OpenAI (gpt-4o-mini) to generate and send timed Telegram nudges at 30 minutes, 1 hour, and 2 hours. 6. Flags orders with no response after 2 hours as RTO risk, alerts the admin in Telegram, and updates the RTO flag in Google Sheets. 7. Receives an abandoned-cart event via a webhook, logs it to an AbandonedCarts Google Sheets tab, waits 30 minutes, checks Google Sheets for an order, and if none is found sends an OpenAI-written discount message over Telegram and marks the cart as contacted. 8. Posts a Slack message when the workflow encounters an execution error. Setup 1. Create and connect credentials for Telegram Bot API, Google Sheets OAuth2, OpenAI, and Slack OAuth2. 2. Create a Google Sheets document with Orders and AbandonedCarts tabs and ensure the columns match the workflow’s expected fields. 3. Replace YOURGOOGLESHEETID in all Google Sheets nodes and set YOURADMINTELEGRAMCHATID in the admin notification nodes. 4. Update the Slack channel ID (YOURSLACKCHANNELID) used for error alerts. 5. Copy the two webhook URLs (/codos/new-order and /codos/cart-abandoned) and configure them in your store/checkout system to send POST requests with the required fields (including telegramchatid).