End-of-day orders summary on Telegram
Every night, get today's orders, revenue, cash-on-delivery share and top products from your Orders sheet.
How it works
Trigger: Schedule — every day at 23:00
- Read your Orders sheet.
- Keep today's orders and add up the count and revenue.
- Work out how many were cash on delivery and the top 3 products.
- Send the summary to Telegram.
Diagram
Trigger App Code
Code
JavaScript used in the Code step — already included in the template below.
// Orders sheet columns: date | order_id | customer | phone | city | items | total | payment
// Adds up today's orders and builds a short Telegram message.
const today = new Date().toISOString().slice(0, 10);
const orders = $input.all()
.map((item) => item.json)
.filter((o) => String(o.date).slice(0, 10) === today);
const revenue = orders.reduce((sum, o) => sum + (Number(o.total) || 0), 0);
const cod = orders.filter((o) => /cod|cash/i.test(String(o.payment))).length;
// items look like "2× Black abaya، 1× Scarf"
const counts = {};
for (const o of orders) {
for (const part of String(o.items || "").split(/[,،]/)) {
const m = part.trim().match(/^(\d+)\s*[×x]\s*(.+)$/);
if (m) counts[m[2]] = (counts[m[2]] || 0) + Number(m[1]);
}
}
const top = Object.entries(counts)
.sort((a, b) => b[1] - a[1])
.slice(0, 3)
.map(([name, qty]) => `- ${name}: ${qty}`)
.join("\n");
return [{
json: {
message:
`Orders today (${today}): ${orders.length}\n` +
`Revenue: ${revenue.toLocaleString("en-US")}\n` +
`Cash on delivery: ${cod} of ${orders.length}` +
(top ? `\n\nTop products:\n${top}` : ""),
},
}];Build it
Pick your tool — same automation, step by step.
Copy and paste straight into an n8n canvas (Ctrl+V), or download and use Import from File. Then connect your own credentials and replace every YOUR_… placeholder.
Show code (136 lines)
{
"name": "End-of-day orders summary on Telegram (Flowngn)",
"nodes": [
{
"parameters": {
"content": "## End-of-day orders summary on Telegram\nEvery night, get today's orders, revenue, cash-on-delivery share and top products from your Orders sheet.\n\n**Setup**\n1. Open each node and connect your own credentials.\n2. Replace every YOUR_… placeholder.\n3. Test once, then activate.\n\nFree template from Flowngn",
"height": 260,
"width": 340
},
"id": "2473c6c3-ba78-4235-a758-cbde9e312b58",
"name": "Setup notes",
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [
-420,
-60
]
},
{
"parameters": {
"rule": {
"interval": [
{
"triggerAtHour": 23
}
]
}
},
"id": "2473c6c3-ba78-4235-a758-cbde9e312b58",
"name": "Every day 23:00",
"type": "n8n-nodes-base.scheduleTrigger",
"typeVersion": 1.2,
"position": [
0,
0
]
},
{
"parameters": {
"operation": "read",
"documentId": {
"__rl": true,
"value": "YOUR_SPREADSHEET_ID",
"mode": "id"
},
"sheetName": {
"__rl": true,
"value": "Orders",
"mode": "name"
},
"options": {}
},
"id": "2473c6c3-ba78-4235-a758-cbde9e312b58",
"name": "Read orders",
"type": "n8n-nodes-base.googleSheets",
"typeVersion": 4.5,
"position": [
300,
0
]
},
{
"parameters": {
"jsCode": "// Orders sheet columns: date | order_id | customer | phone | city | items | total | payment\n// Adds up today's orders and builds a short Telegram message.\nconst today = new Date().toISOString().slice(0, 10);\nconst orders = $input.all()\n .map((item) => item.json)\n .filter((o) => String(o.date).slice(0, 10) === today);\n\nconst revenue = orders.reduce((sum, o) => sum + (Number(o.total) || 0), 0);\nconst cod = orders.filter((o) => /cod|cash/i.test(String(o.payment))).length;\n\n// items look like \"2× Black abaya، 1× Scarf\"\nconst counts = {};\nfor (const o of orders) {\n for (const part of String(o.items || \"\").split(/[,،]/)) {\n const m = part.trim().match(/^(\\d+)\\s*[×x]\\s*(.+)$/);\n if (m) counts[m[2]] = (counts[m[2]] || 0) + Number(m[1]);\n }\n}\nconst top = Object.entries(counts)\n .sort((a, b) => b[1] - a[1])\n .slice(0, 3)\n .map(([name, qty]) => `- ${name}: ${qty}`)\n .join(\"\\n\");\n\nreturn [{\n json: {\n message:\n `Orders today (${today}): ${orders.length}\\n` +\n `Revenue: ${revenue.toLocaleString(\"en-US\")}\\n` +\n `Cash on delivery: ${cod} of ${orders.length}` +\n (top ? `\\n\\nTop products:\\n${top}` : \"\"),\n },\n}];"
},
"id": "2473c6c3-ba78-4235-a758-cbde9e312b58",
"name": "Summarize today",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
600,
0
]
},
{
"parameters": {
"chatId": "YOUR_CHAT_ID",
"text": "={{ $json.message }}",
"additionalFields": {
"appendAttribution": false
}
},
"id": "2473c6c3-ba78-4235-a758-cbde9e312b58",
"name": "Send to Telegram",
"type": "n8n-nodes-base.telegram",
"typeVersion": 1.2,
"position": [
900,
0
]
}
],
"connections": {
"Every day 23:00": {
"main": [
[
{
"node": "Read orders",
"type": "main",
"index": 0
}
]
]
},
"Read orders": {
"main": [
[
{
"node": "Summarize today",
"type": "main",
"index": 0
}
]
]
},
"Summarize today": {
"main": [
[
{
"node": "Send to Telegram",
"type": "main",
"index": 0
}
]
]
}
},
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"meta": {
"templateCredsSetupCompleted": false
},
"tags": []
}In Make, create a new scenario and add these modules in order:
- Schedule the scenario: Every day 23:00
- Google Sheets › Search Rows
- Tools › Set variable / Iterator + Array aggregator (same logic as the Code step)
- Telegram Bot › Send a Text Message or a Reply
- Every module run uses Make operations — the free plan includes a monthly quota.
- Make's built-in functions (map, sum, formatDate…) can replace most Code steps; for complex logic use a code module.
- Module and step names can differ slightly as Make and Zapier update their apps.
In Zapier, create a new Zap and add these steps in order:
- Schedule by Zapier — Every day 23:00
- Google Sheets — Lookup Spreadsheet Rows (or Code by Zapier)
- Code by Zapier — Run JavaScript (paste the code from the Code section)
- Telegram — Send Message
- Zaps with more than two steps need a paid Zapier plan.
- Webhooks, Filters/Paths and Code by Zapier are premium features on some Zapier plans.
- Code by Zapier runs JavaScript: reuse the code shown above, reading inputs from inputData instead of $json.
- Module and step names can differ slightly as Make and Zapier update their apps.
Tips
- Pair it with the "orders to Google Sheets" flows for Salla, Zid or WooCommerce, which use the same columns.
Related flows
E-commerceEasy
Log every new order in Google Sheets
Each new Shopify order becomes a row in a spreadsheet you can filter and share.
Shopify → Google Sheets4h/mo
E-commerceEasy
New order alerts on Telegram
Get a Telegram notification with the items and total for every new order.
Shopify → Telegram2h/mo
E-commerceEasy
New WooCommerce orders on Telegram
Get a Telegram message with the items, total and city for every WooCommerce order.
WooCommerce → Telegram2h/mo