سجّل مصروفاتك برسالة لبوت تيليجرام
أرسل "12.50 غداء" إلى البوت فتُحفظ فورًا في Google Sheet.
كيف تعمل
المشغّل: تيليجرام — رسالة جديدة للبوت
- استقبل الرسالة من بوت تيليجرام.
- اقرأ المبلغ والملاحظة من نص مثل "تاكسي 40".
- إن كانت صحيحة، أضف صفًا إلى ورقة "Expenses" وأكّد بـ ✅.
- وإلا، رد بمثال للصيغة الصحيحة.
المخطط
مشغّل تطبيق منطق كود
الكود
كود JavaScript المستخدم في خطوات Code، وهو مضمَّن بالفعل في القالب بالأسفل.
// Understands messages like "12.50 lunch", "taxi 40" or "coffee 3,5".
const msg = $input.first().json.message;
const text = (msg.text || "").trim();
const match = text.match(/\d+(?:[.,]\d+)?/);
if (!match) {
return [{ json: { valid: false, chatId: msg.chat.id } }];
}
const amount = parseFloat(match[0].replace(",", "."));
const note = text.replace(match[0], "").trim() || "expense";
return [{
json: {
valid: true,
chatId: msg.chat.id,
date: new Date(msg.date * 1000).toISOString().slice(0, 10),
amount,
note,
},
}];ابنِها بأداتك
اختر أداتك — نفس الأتمتة، خطوة بخطوة.
انسخه والصقه مباشرة في مساحة عمل n8n (Ctrl+V)، أو حمّله واستخدم Import from File. بعد ذلك اربط حساباتك واستبدل كل قيمة تبدأ بـ YOUR_.
عرض الكود (210 سطر)
{
"name": "سجّل مصروفاتك برسالة لبوت تيليجرام (Flowngn)",
"nodes": [
{
"parameters": {
"content": "## سجّل مصروفاتك برسالة لبوت تيليجرام\nأرسل \"12.50 غداء\" إلى البوت فتُحفظ فورًا في Google 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": "3da33d1f-b8e3-42d1-aace-213b83d434e0",
"name": "Setup notes",
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [
-420,
-60
]
},
{
"parameters": {
"updates": [
"message"
],
"additionalFields": {}
},
"id": "3da33d1f-b8e3-42d1-aace-213b83d434e0",
"name": "New message",
"type": "n8n-nodes-base.telegramTrigger",
"typeVersion": 1.1,
"position": [
0,
0
],
"webhookId": "3da33d1f-b8e3-42d1-aace-213b83d434e0"
},
{
"parameters": {
"jsCode": "// Understands messages like \"12.50 lunch\", \"taxi 40\" or \"coffee 3,5\".\nconst msg = $input.first().json.message;\nconst text = (msg.text || \"\").trim();\nconst match = text.match(/\\d+(?:[.,]\\d+)?/);\n\nif (!match) {\n return [{ json: { valid: false, chatId: msg.chat.id } }];\n}\n\nconst amount = parseFloat(match[0].replace(\",\", \".\"));\nconst note = text.replace(match[0], \"\").trim() || \"expense\";\n\nreturn [{\n json: {\n valid: true,\n chatId: msg.chat.id,\n date: new Date(msg.date * 1000).toISOString().slice(0, 10),\n amount,\n note,\n },\n}];"
},
"id": "3da33d1f-b8e3-42d1-aace-213b83d434e0",
"name": "Parse expense",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
300,
0
]
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "loose"
},
"conditions": [
{
"id": "c1",
"leftValue": "={{ $json.valid }}",
"rightValue": "",
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
}
}
],
"combinator": "and"
},
"options": {}
},
"id": "3da33d1f-b8e3-42d1-aace-213b83d434e0",
"name": "Valid expense?",
"type": "n8n-nodes-base.if",
"typeVersion": 2.2,
"position": [
600,
0
]
},
{
"parameters": {
"operation": "append",
"documentId": {
"__rl": true,
"value": "YOUR_SPREADSHEET_ID",
"mode": "id"
},
"sheetName": {
"__rl": true,
"value": "Expenses",
"mode": "name"
},
"columns": {
"mappingMode": "defineBelow",
"value": {
"date": "={{ $json.date }}",
"amount": "={{ $json.amount }}",
"note": "={{ $json.note }}"
}
},
"options": {}
},
"id": "3da33d1f-b8e3-42d1-aace-213b83d434e0",
"name": "Add to Expenses",
"type": "n8n-nodes-base.googleSheets",
"typeVersion": 4.5,
"position": [
900,
0
]
},
{
"parameters": {
"chatId": "={{ $('Parse expense').item.json.chatId }}",
"text": "=✅ Saved {{ $('Parse expense').item.json.amount }} — {{ $('Parse expense').item.json.note }}",
"additionalFields": {
"appendAttribution": false
}
},
"id": "3da33d1f-b8e3-42d1-aace-213b83d434e0",
"name": "Confirm",
"type": "n8n-nodes-base.telegram",
"typeVersion": 1.2,
"position": [
1200,
0
]
},
{
"parameters": {
"chatId": "={{ $json.chatId }}",
"text": "Send an amount and a note, for example \"12.50 lunch\" or \"taxi 40\".",
"additionalFields": {
"appendAttribution": false
}
},
"id": "3da33d1f-b8e3-42d1-aace-213b83d434e0",
"name": "Explain format",
"type": "n8n-nodes-base.telegram",
"typeVersion": 1.2,
"position": [
900,
220
]
}
],
"connections": {
"New message": {
"main": [
[
{
"node": "Parse expense",
"type": "main",
"index": 0
}
]
]
},
"Parse expense": {
"main": [
[
{
"node": "Valid expense?",
"type": "main",
"index": 0
}
]
]
},
"Valid expense?": {
"main": [
[
{
"node": "Add to Expenses",
"type": "main",
"index": 0
}
],
[
{
"node": "Explain format",
"type": "main",
"index": 0
}
]
]
},
"Add to Expenses": {
"main": [
[
{
"node": "Confirm",
"type": "main",
"index": 0
}
]
]
}
},
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"meta": {
"templateCredsSetupCompleted": false
},
"tags": []
}في Make، أنشئ سيناريو جديدًا وأضف هذه الوحدات بالترتيب:
- Telegram Bot › Watch Updates
- Tools › Set variable / Iterator + Array aggregator (same logic as the Code step)
- Router with two routes: “Valid expense?” (yes / no filters)
- إذا نعمGoogle Sheets › Add a Row
- إذا لاTelegram Bot › Send a Text Message or a Reply
- إذا نعمTelegram Bot › Send a Text Message or a Reply
- كل تشغيل لوحدة يستهلك عمليات (operations) في Make — والباقة المجانية تتضمن حصة شهرية.
- دوال Make المدمجة (map و sum و formatDate…) تغني عن معظم خطوات Code؛ وللمنطق المعقد استخدم وحدة كود.
- قد تختلف أسماء الوحدات والخطوات قليلًا مع تحديث Make و Zapier لتطبيقاتهما.
في Zapier، أنشئ Zap جديدًا وأضف هذه الخطوات بالترتيب:
- Telegram — New Message
- Code by Zapier — Run JavaScript (paste the code from the Code section)
- Paths by Zapier: “Valid expense?” (yes / no)
- إذا نعمGoogle Sheets — Create Spreadsheet Row
- إذا لاTelegram — Send Message
- إذا نعمTelegram — Send Message
- الـ Zaps التي فيها أكثر من خطوتين تحتاج باقة Zapier مدفوعة.
- الـ Webhooks والفلاتر/المسارات و Code by Zapier ميزات مدفوعة في بعض باقات Zapier.
- Code by Zapier يشغّل JavaScript: أعد استخدام الكود بالأعلى، مع قراءة المدخلات من inputData بدلًا من $json.
- قد تختلف أسماء الوحدات والخطوات قليلًا مع تحديث Make و Zapier لتطبيقاتهما.
نصائح
- أضف أتمتة شهرية تجمع الجدول وترسل لك الملخص.
أتمتات مشابهة
المالية والإدارةسهل
تذكير تجديد الاشتراك على واتساب
قبل انتهاء اشتراك العميل بسبعة أيام، ذكّره على واتساب وأخبر فريقك.
Google Sheets → WhatsApp → Telegram5 س/شهر
المالية والإدارةسهل
ملخص التدفق النقدي الأسبوعي على تيليجرام
كل أحد، اعرف الداخل والخارج والصافي وأكبر مصروفات الأسبوع على تيليجرام.
Google Sheets → Telegram2 س/شهر
المالية والإدارةسهل
تنبيه فوري عند فشل دفعة في Stripe
اعرف بالمدفوعات الفاشلة فورًا وسجّلها للمتابعة.
Stripe → Slack → Google Sheets2 س/شهر