الذكاء الاصطناعي يقرأ إيصالات البريد إلى جدول المصروفات
الذكاء الاصطناعي يستخرج البائع والمبلغ والعملة والتاريخ من رسائل الإيصالات ويسجلها.
كيف تعمل
المشغّل: Gmail — بريد جديد يبدو كإيصال
- راقب Gmail للإيصالات والفواتير وتأكيدات الطلب.
- اطلب من الذكاء الاصطناعي استخراج البائع والمبلغ والعملة والتاريخ والتصنيف.
- أضف صفًا إلى جدول Expenses.
المخطط
مشغّل تطبيق منطق كود ذكاء اصطناعي
الكود
كود JavaScript المستخدم في خطوات Code، وهو مضمَّن بالفعل في القالب بالأسفل.
// Mode: Run Once for Each Item
// The AI was asked for JSON like:
// {"vendor": "Uber", "amount": 12.5, "currency": "USD", "date": "2026-10-01", "category": "Transport"}
const match = $json.text.match(/\{[\s\S]*\}/);
const r = match ? JSON.parse(match[0]) : {};
const email = $("Receipt email").item.json;
if (!r.amount) return { json: { skip: true } };
return {
json: {
date: r.date || new Date(email.date).toISOString().slice(0, 10),
vendor: r.vendor || email.from?.value?.[0]?.name || "",
amount: Number(r.amount),
currency: r.currency || "",
category: r.category || "Other",
email_subject: email.subject,
},
};ابنِها بأداتك
اختر أداتك — نفس الأتمتة، خطوة بخطوة.
انسخه والصقه مباشرة في مساحة عمل n8n (Ctrl+V)، أو حمّله واستخدم Import from File. بعد ذلك اربط حساباتك واستبدل كل قيمة تبدأ بـ YOUR_. خطوات الذكاء الاصطناعي تستخدم نموذج Claude، ويمكنك استبداله بـ OpenAI أو Gemini أو Ollama.
عرض الكود (215 سطر)
{
"name": "الذكاء الاصطناعي يقرأ إيصالات البريد إلى جدول المصروفات (Flowngn)",
"nodes": [
{
"parameters": {
"content": "## الذكاء الاصطناعي يقرأ إيصالات البريد إلى جدول المصروفات\nالذكاء الاصطناعي يستخرج البائع والمبلغ والعملة والتاريخ من رسائل الإيصالات ويسجلها.\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": "292cf932-28a7-4296-a76d-5cdfef5c8244",
"name": "Setup notes",
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [
-420,
-60
]
},
{
"parameters": {
"pollTimes": {
"item": [
{
"mode": "everyHour"
}
]
},
"simple": false,
"filters": {
"q": "receipt OR invoice OR \"order confirmation\""
},
"options": {}
},
"id": "292cf932-28a7-4296-a76d-5cdfef5c8244",
"name": "Receipt email",
"type": "n8n-nodes-base.gmailTrigger",
"typeVersion": 1.2,
"position": [
0,
0
]
},
{
"parameters": {
"promptType": "define",
"text": "=Read this email. If it is a receipt or invoice for a purchase, reply ONLY with JSON: {\"vendor\": \"...\", \"amount\": 0, \"currency\": \"USD\", \"date\": \"YYYY-MM-DD\", \"category\": \"Software|Travel|Food|Office|Other\"}. If it is not a receipt, reply with {}.\n\nFrom: {{ $json.from.text }}\nSubject: {{ $json.subject }}\n\n{{ ($json.text || \"\").slice(0, 4000) }}"
},
"id": "292cf932-28a7-4296-a76d-5cdfef5c8244",
"name": "Extract expense",
"type": "@n8n/n8n-nodes-langchain.chainLlm",
"typeVersion": 1.5,
"position": [
300,
0
]
},
{
"parameters": {
"model": {
"__rl": true,
"value": "claude-sonnet-5",
"mode": "list"
},
"options": {}
},
"id": "292cf932-28a7-4296-a76d-5cdfef5c8244",
"name": "Claude model",
"type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
"typeVersion": 1.3,
"position": [
300,
220
]
},
{
"parameters": {
"jsCode": "// Mode: Run Once for Each Item\n// The AI was asked for JSON like:\n// {\"vendor\": \"Uber\", \"amount\": 12.5, \"currency\": \"USD\", \"date\": \"2026-10-01\", \"category\": \"Transport\"}\nconst match = $json.text.match(/\\{[\\s\\S]*\\}/);\nconst r = match ? JSON.parse(match[0]) : {};\nconst email = $(\"Receipt email\").item.json;\n\nif (!r.amount) return { json: { skip: true } };\n\nreturn {\n json: {\n date: r.date || new Date(email.date).toISOString().slice(0, 10),\n vendor: r.vendor || email.from?.value?.[0]?.name || \"\",\n amount: Number(r.amount),\n currency: r.currency || \"\",\n category: r.category || \"Other\",\n email_subject: email.subject,\n },\n};",
"mode": "runOnceForEachItem"
},
"id": "292cf932-28a7-4296-a76d-5cdfef5c8244",
"name": "Read expense",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
600,
0
]
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "loose"
},
"conditions": [
{
"id": "c1",
"leftValue": "={{ $json.skip }}",
"rightValue": true,
"operator": {
"type": "boolean",
"operation": "notEquals"
}
}
],
"combinator": "and"
},
"options": {}
},
"id": "292cf932-28a7-4296-a76d-5cdfef5c8244",
"name": "Is a receipt?",
"type": "n8n-nodes-base.if",
"typeVersion": 2.2,
"position": [
900,
0
]
},
{
"parameters": {
"operation": "append",
"documentId": {
"__rl": true,
"value": "YOUR_SPREADSHEET_ID",
"mode": "id"
},
"sheetName": {
"__rl": true,
"value": "Expenses",
"mode": "name"
},
"columns": {
"mappingMode": "autoMapInputData",
"value": {}
},
"options": {}
},
"id": "292cf932-28a7-4296-a76d-5cdfef5c8244",
"name": "Add to Expenses",
"type": "n8n-nodes-base.googleSheets",
"typeVersion": 4.5,
"position": [
1200,
0
]
}
],
"connections": {
"Receipt email": {
"main": [
[
{
"node": "Extract expense",
"type": "main",
"index": 0
}
]
]
},
"Extract expense": {
"main": [
[
{
"node": "Read expense",
"type": "main",
"index": 0
}
]
]
},
"Read expense": {
"main": [
[
{
"node": "Is a receipt?",
"type": "main",
"index": 0
}
]
]
},
"Is a receipt?": {
"main": [
[
{
"node": "Add to Expenses",
"type": "main",
"index": 0
}
]
]
},
"Claude model": {
"ai_languageModel": [
[
{
"node": "Extract expense",
"type": "ai_languageModel",
"index": 0
}
]
]
}
},
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"meta": {
"templateCredsSetupCompleted": false
},
"tags": []
}في Make، أنشئ سيناريو جديدًا وأضف هذه الوحدات بالترتيب:
- Gmail › Watch Emails (search: receipt OR invoice OR "order confirmation")
- Anthropic Claude › Create a Prompt (or OpenAI › Create a Completion)
- Tools › Set variable / Iterator + Array aggregator (same logic as the Code step)
- Filter on the next route: “Is a receipt?”
- إذا نعمGoogle Sheets › Add a Row
- كل تشغيل لوحدة يستهلك عمليات (operations) في Make — والباقة المجانية تتضمن حصة شهرية.
- دوال Make المدمجة (map و sum و formatDate…) تغني عن معظم خطوات Code؛ وللمنطق المعقد استخدم وحدة كود.
- قد تختلف أسماء الوحدات والخطوات قليلًا مع تحديث Make و Zapier لتطبيقاتهما.
في Zapier، أنشئ Zap جديدًا وأضف هذه الخطوات بالترتيب:
- Gmail — New Email Matching Search (receipt OR invoice OR "order confirmation")
- Anthropic (Claude) — Send Message (or ChatGPT — Conversation)
- Code by Zapier — Run JavaScript (paste the code from the Code section)
- Filter by Zapier: “Is a receipt?”
- إذا نعمGoogle Sheets — Create Spreadsheet Row
- الـ Zaps التي فيها أكثر من خطوتين تحتاج باقة Zapier مدفوعة.
- الـ Webhooks والفلاتر/المسارات و Code by Zapier ميزات مدفوعة في بعض باقات Zapier.
- Code by Zapier يشغّل JavaScript: أعد استخدام الكود بالأعلى، مع قراءة المدخلات من inputData بدلًا من $json.
- قد تختلف أسماء الوحدات والخطوات قليلًا مع تحديث Make و Zapier لتطبيقاتهما.
نصائح
- راجع الجدول أسبوعيًا في البداية — الذكاء الاصطناعي جيد في هذا لكنه ليس مثاليًا.
أتمتات مشابهة
المالية والإدارةمتوسط
تقرير مؤشرات الأداء الأسبوعي بالبريد
كل يوم اثنين، يصلك ملخص قصير لأهم أرقام الأسبوع الماضي من جدولك.
Google Sheets → Gmail3 س/شهر
المالية والإدارةمتوسط
تذكيرات تلقائية بالفواتير المتأخرة
كل صباح، يصل العملاء أصحاب الفواتير المتأخرة تذكير مهذب بالبريد.
Google Sheets → Gmail4 س/شهر
المالية والإدارةمتوسط
رسائل البنك والمحفظة ← متابعة الفلوس
حوّل رسائل البنك والبطاقة والمحفظة إلى webhook؛ فيسجل الذكاء الاصطناعي كل مصروف ودخل في جدول.
Webhook → AI model → Google Sheets4 س/شهر