Robot automatisé pour clients pour la création de factures et les rappels de paiement
Ceci est unInvoice Processingworkflow d'automatisation du domainecontenant 19 nœuds.Utilise principalement des nœuds comme Code, Cron, Switch, EmailSend, GoogleSheets. Création de factures et système de rappels de paiement par e-mail automatisé avec Google Sheets
- •Informations d'identification Google Sheets API
Nœuds utilisés (19)
Catégorie
{
"id": "yaudVbewTA3Zxsb4",
"meta": {
"instanceId": "dd69efaf8212c74ad206700d104739d3329588a6f3f8381a46a481f34c9cc281",
"templateCredsSetupCompleted": true
},
"name": "Automated Invoice Creator & Payment Reminder Bot for Clients",
"tags": [],
"nodes": [
{
"id": "d75d7591-4afa-427c-b436-ada9d8eb90dc",
"name": "Déclencheur mensuel de facturation",
"type": "n8n-nodes-base.cron",
"position": [
-180,
-180
],
"parameters": {},
"typeVersion": 1
},
{
"id": "442fcd9c-dcff-4b5f-8d3e-17823048e40a",
"name": "Vérification quotidienne des rappels de paiement",
"type": "n8n-nodes-base.cron",
"position": [
-180,
380
],
"parameters": {},
"typeVersion": 1
},
{
"id": "e291b555-c948-48c4-b5a8-0e39b4c16e0b",
"name": "Obtenir les clients à facturer",
"type": "n8n-nodes-base.googleSheets",
"position": [
40,
-180
],
"parameters": {
"options": {},
"sheetName": "Clients",
"documentId": "YOUR_GOOGLE_SHEET_ID",
"authentication": "serviceAccount"
},
"credentials": {
"googleApi": {
"id": "ScSS2KxGQULuPtdy",
"name": "Google Sheets- test"
}
},
"typeVersion": 4
},
{
"id": "d17d13ca-cf7b-42a2-8c0a-c41858b936ec",
"name": "Obtenir les factures en retard",
"type": "n8n-nodes-base.googleSheets",
"position": [
40,
380
],
"parameters": {
"options": {},
"sheetName": "Invoices",
"documentId": "YOUR_GOOGLE_SHEET_ID",
"authentication": "serviceAccount"
},
"credentials": {
"googleApi": {
"id": "ScSS2KxGQULuPtdy",
"name": "Google Sheets- test"
}
},
"typeVersion": 4
},
{
"id": "b7838069-c5ef-4a6b-8003-f976f5952c55",
"name": "Filtrer les clients actifs",
"type": "n8n-nodes-base.code",
"position": [
260,
-180
],
"parameters": {
"jsCode": "// Filter active clients ready for invoicing\nconst allClients = $input.all();\nconst today = new Date();\ntoday.setHours(0, 0, 0, 0);\n\nconst clientsToInvoice = allClients.filter(item => {\n const client = item.json;\n // Skip header row\n if (client.A === 'client_id' || !client.A) return false;\n \n const status = client.F; // Column F = status\n const billingDate = new Date(client.E); // Column E = billing_date\n billingDate.setHours(0, 0, 0, 0);\n \n return status === 'active' && billingDate <= today;\n});\n\n// Transform to readable format\nconst transformedClients = clientsToInvoice.map(item => {\n const client = item.json;\n return {\n json: {\n client_id: client.A,\n client_name: client.B,\n email: client.C,\n service_description: client.D,\n billing_date: client.E,\n status: client.F,\n amount: parseFloat(client.G) || 0\n }\n };\n});\n\nreturn transformedClients;"
},
"typeVersion": 2
},
{
"id": "66d888dd-020c-4d3b-845b-f93cd867e6a8",
"name": "Filtrer les factures en retard",
"type": "n8n-nodes-base.code",
"position": [
260,
380
],
"parameters": {
"jsCode": "// Filter overdue invoices\nconst allInvoices = $input.all();\nconst today = new Date();\ntoday.setHours(0, 0, 0, 0);\n\nconst overdueInvoices = allInvoices.filter(item => {\n const invoice = item.json;\n // Skip header row\n if (invoice.A === 'invoice_id' || !invoice.A) return false;\n \n const status = invoice.G; // Column G = status\n const dueDate = new Date(invoice.F); // Column F = due_date\n dueDate.setHours(0, 0, 0, 0);\n \n // Get yesterday's date\n const yesterday = new Date(today);\n yesterday.setDate(yesterday.getDate() - 1);\n \n return status === 'pending' && dueDate <= yesterday;\n});\n\n// Transform to readable format\nconst transformedInvoices = overdueInvoices.map(item => {\n const invoice = item.json;\n return {\n json: {\n invoice_id: invoice.A,\n invoice_number: invoice.B,\n client_name: invoice.C,\n email: invoice.D,\n amount: parseFloat(invoice.E) || 0,\n due_date: invoice.F,\n status: invoice.G,\n last_reminder_sent: invoice.H,\n reminder_count: parseInt(invoice.I) || 0\n }\n };\n});\n\nreturn transformedInvoices;"
},
"typeVersion": 2
},
{
"id": "0253a4de-ca69-4dd0-9c75-7bb686d296be",
"name": "Générer les données de facture",
"type": "n8n-nodes-base.code",
"position": [
480,
-180
],
"parameters": {
"jsCode": "// Generate invoice number\nconst now = new Date();\nconst invoiceNumber = `INV-${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, '0')}-${String(now.getDate()).padStart(2, '0')}-${String(Math.floor(Math.random() * 1000)).padStart(3, '0')}`;\n\n// Calculate due date (30 days from now)\nconst dueDate = new Date();\ndueDate.setDate(dueDate.getDate() + 30);\n\n// Get client data\nconst clientData = $input.first().json;\n\n// Create invoice data\nconst invoiceData = {\n invoice_number: invoiceNumber,\n client_id: clientData.client_id,\n client_name: clientData.client_name,\n email: clientData.email,\n service_description: clientData.service_description,\n amount: clientData.amount,\n issue_date: now.toISOString().split('T')[0],\n due_date: dueDate.toISOString().split('T')[0],\n status: 'pending'\n};\n\nreturn { json: invoiceData };"
},
"typeVersion": 2
},
{
"id": "b2bebed5-0a36-4d7f-9ae1-ce5aeb17803d",
"name": "Enregistrer la facture dans Google Sheets",
"type": "n8n-nodes-base.googleSheets",
"position": [
700,
-180
],
"parameters": {
"columns": {
"value": {},
"schema": [],
"mappingMode": "defineBelow",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "appendOrUpdate",
"sheetName": "Invoices",
"documentId": "YOUR_GOOGLE_SHEET_ID",
"authentication": "serviceAccount"
},
"credentials": {
"googleApi": {
"id": "ScSS2KxGQULuPtdy",
"name": "Google Sheets- test"
}
},
"typeVersion": 4
},
{
"id": "d22a9ad6-41a6-4601-9fe4-6bb194854fbd",
"name": "Envoyer l'email de facture",
"type": "n8n-nodes-base.emailSend",
"position": [
920,
-180
],
"webhookId": "039267b7-9d76-4d9e-aa27-c38630f6a340",
"parameters": {
"text": "={{ $json.result }}",
"options": {
"allowUnauthorizedCerts": true
},
"subject": "New Invoice - {{ $json.invoice_number }}",
"toEmail": "={{ $json.email }}",
"fromEmail": "billing@yourcompany.com"
},
"credentials": {
"smtp": {
"id": "G1kyF8cSWTZ4vouN",
"name": "SMTP -test"
}
},
"typeVersion": 2
},
{
"id": "bb3d4b79-3a7e-4d7a-914a-4dbd85a8bca3",
"name": "Calculer le type de rappel",
"type": "n8n-nodes-base.code",
"position": [
480,
380
],
"parameters": {
"jsCode": "// Calculate days overdue\nconst dueDate = new Date($json.due_date);\nconst today = new Date();\nconst daysOverdue = Math.floor((today - dueDate) / (1000 * 60 * 60 * 24));\n\n// Determine reminder type based on days overdue\nlet reminderType = 'gentle';-\nlet subject = 'Payment Reminder';\n\nif (daysOverdue >= 30) {\n reminderType = 'final';\n subject = 'FINAL NOTICE - Payment Required';\n} else if (daysOverdue >= 14) {\n reminderType = 'urgent';\n subject = 'URGENT - Payment Overdue';\n} else if (daysOverdue >= 7) {\n reminderType = 'follow-up';\n subject = 'Payment Follow-up Required';\n}\n\nreturn {\n json: {\n ...($json),\n days_overdue: daysOverdue,\n reminder_type: reminderType,\n email_subject: subject\n }\n};"
},
"typeVersion": 2
},
{
"id": "8eacfac6-b3f0-41f8-9d45-6587f3f59333",
"name": "Aiguilleur de type de rappel",
"type": "n8n-nodes-base.switch",
"position": [
700,
359
],
"parameters": {
"rules": {
"values": [
{
"conditions": {
"options": {
"version": 1,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "613ef87a-e0f6-45ee-9347-9db597b7dbf9",
"operator": {
"type": "string",
"operation": "equals"
},
"leftValue": "={{$json.reminder_type}}",
"rightValue": "gentle"
}
]
}
},
{
"conditions": {
"options": {
"version": 1,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "7c82cc7e-9659-48e8-9143-bc3bca67c8f4",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{$json.reminder_type}}",
"rightValue": "follow-up"
}
]
}
},
{
"conditions": {
"options": {
"version": 1,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "66f7c6ba-5f18-4290-84c3-1ab9de84ef21",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{$json.reminder_type}}",
"rightValue": "urgent"
}
]
}
},
{
"conditions": {
"options": {
"version": 1,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "6e481655-1f66-4b4c-9717-3564e811ace6",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{$json.reminder_type}}",
"rightValue": "final"
}
]
}
}
]
},
"options": {}
},
"typeVersion": 3
},
{
"id": "aa11ccd1-090e-4544-8c89-1957368268ff",
"name": "Envoyer un rappel courtois",
"type": "n8n-nodes-base.emailSend",
"position": [
920,
80
],
"webhookId": "7e1cb363-765e-44ab-8b06-87986f45f32b",
"parameters": {
"options": {},
"subject": "={{ $json.email_subject }} - Invoice {{ $json.invoice_id }}",
"toEmail": "={{ $json.email }}",
"fromEmail": "billing@yourcompany.com"
},
"credentials": {
"smtp": {
"id": "G1kyF8cSWTZ4vouN",
"name": "SMTP -test"
}
},
"typeVersion": 2
},
{
"id": "aa04fbde-36fc-4c9d-bc0e-ef3725de3879",
"name": "Envoyer un rappel de suivi",
"type": "n8n-nodes-base.emailSend",
"position": [
920,
280
],
"webhookId": "4bbdea59-2c15-462b-ab02-55bebc8ef40d",
"parameters": {
"options": {},
"subject": "={{ $json.email_subject }} - Invoice {{ $json.invoice_id }}",
"toEmail": "={{ $json.email }}",
"fromEmail": "billing@yourcompany.com"
},
"credentials": {
"smtp": {
"id": "G1kyF8cSWTZ4vouN",
"name": "SMTP -test"
}
},
"typeVersion": 2
},
{
"id": "da991ec5-fa55-4cbb-8fe2-d9ee1f231ca1",
"name": "Envoyer un rappel urgent",
"type": "n8n-nodes-base.emailSend",
"position": [
920,
480
],
"webhookId": "4ef3d5cc-ccb7-4c9e-9b1e-1c85e1ead937",
"parameters": {
"options": {},
"subject": "={{ $json.email_subject }} - Invoice {{ $json.invoice_id }}",
"toEmail": "={{ $json.email }}",
"fromEmail": "billing@yourcompany.com"
},
"credentials": {
"smtp": {
"id": "G1kyF8cSWTZ4vouN",
"name": "SMTP -test"
}
},
"typeVersion": 2
},
{
"id": "03806211-8278-4e6e-9aa3-9511ae7b2d6a",
"name": "Envoyer un dernier avertissement",
"type": "n8n-nodes-base.emailSend",
"position": [
920,
680
],
"webhookId": "2cd79d98-5ef3-4d4e-a8f1-d9f48bc2417b",
"parameters": {
"options": {},
"subject": "={{ $json.email_subject }} - Invoice {{ $json.invoice_id }}",
"toEmail": "={{ $json.email }}",
"fromEmail": "billing@yourcompany.com"
},
"credentials": {
"smtp": {
"id": "G1kyF8cSWTZ4vouN",
"name": "SMTP -test"
}
},
"typeVersion": 2
},
{
"id": "b8d9735c-cf50-4b4e-b913-f21093e68dc2",
"name": "Mettre à jour le journal de rappels",
"type": "n8n-nodes-base.googleSheets",
"position": [
1140,
380
],
"parameters": {
"columns": {
"value": {},
"schema": [],
"mappingMode": "defineBelow",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "update",
"sheetName": "Invoices",
"documentId": "YOUR_GOOGLE_SHEET_ID",
"authentication": "serviceAccount"
},
"credentials": {
"googleApi": {
"id": "ScSS2KxGQULuPtdy",
"name": "Google Sheets- test"
}
},
"typeVersion": 4
},
{
"id": "11ef4edf-e5d2-4f0a-874c-af270b75b338",
"name": "Journaliser la création de facture",
"type": "n8n-nodes-base.googleSheets",
"position": [
1140,
-180
],
"parameters": {
"columns": {
"value": {},
"schema": [],
"mappingMode": "defineBelow",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "appendOrUpdate",
"sheetName": "Activity_Log",
"documentId": "YOUR_GOOGLE_SHEET_ID",
"authentication": "serviceAccount"
},
"credentials": {
"googleApi": {
"id": "ScSS2KxGQULuPtdy",
"name": "Google Sheets- test"
}
},
"typeVersion": 4
},
{
"id": "b41db4f5-4b6a-481a-b7ef-60028e651eff",
"name": "Note adhésive",
"type": "n8n-nodes-base.stickyNote",
"position": [
100,
-620
],
"parameters": {
"width": 760,
"height": 340,
"content": "## Invoice Creation Flow\n\n\n**Monthly Invoice Trigger** – Triggers workflow on a set monthly schedule.\n\n**Get Clients for Invoicing** – Reads client data from Google Sheet.\n\n**Filter Active Clients** – Filters out inactive clients.\n\n**Generate Invoice Data** – Creates invoice details in required format.\n\n**Save Invoice to Google Sheets** – Appends or updates invoice record in the sheet.\n\n**Send Invoice Email** – Sends the invoice to the client via email.\n\n**Log Invoice Creation** – Logs invoice creation for records/auditing."
},
"typeVersion": 1
},
{
"id": "e50bfca0-4cc7-4837-a480-a29ef3d675e6",
"name": "Note adhésive1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-280,
80
],
"parameters": {
"color": 4,
"width": 980,
"height": 220,
"content": "## **Reminder Flow**\n\n**Daily Payment Reminder Check** – Triggers workflow daily to check overdue invoices.\n**Get Overdue Invoices** – Reads overdue invoices from Google Sheet.\n**Filter Overdue Invoices** – Filters invoices still unpaid.\n**Calculate Reminder Type** – Calculates how many days overdue.\n**Switch Reminder Type** – Decides which type of reminder to send.\n**Send Gentle / Follow-up / Urgent / Final Notice** – Sends respective reminder email.\n**Update Reminder Log** – Updates reminder status in the sheet."
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "af210e95-bedc-44a9-ab43-8129618f3429",
"connections": {
"03806211-8278-4e6e-9aa3-9511ae7b2d6a": {
"main": [
[
{
"node": "b8d9735c-cf50-4b4e-b913-f21093e68dc2",
"type": "main",
"index": 0
}
]
]
},
"d22a9ad6-41a6-4601-9fe4-6bb194854fbd": {
"main": [
[
{
"node": "11ef4edf-e5d2-4f0a-874c-af270b75b338",
"type": "main",
"index": 0
}
]
]
},
"d17d13ca-cf7b-42a2-8c0a-c41858b936ec": {
"main": [
[
{
"node": "66d888dd-020c-4d3b-845b-f93cd867e6a8",
"type": "main",
"index": 0
}
]
]
},
"aa11ccd1-090e-4544-8c89-1957368268ff": {
"main": [
[
{
"node": "b8d9735c-cf50-4b4e-b913-f21093e68dc2",
"type": "main",
"index": 0
}
]
]
},
"da991ec5-fa55-4cbb-8fe2-d9ee1f231ca1": {
"main": [
[
{
"node": "b8d9735c-cf50-4b4e-b913-f21093e68dc2",
"type": "main",
"index": 0
}
]
]
},
"8eacfac6-b3f0-41f8-9d45-6587f3f59333": {
"main": [
[
{
"node": "aa11ccd1-090e-4544-8c89-1957368268ff",
"type": "main",
"index": 0
}
],
[
{
"node": "aa04fbde-36fc-4c9d-bc0e-ef3725de3879",
"type": "main",
"index": 0
}
],
[
{
"node": "da991ec5-fa55-4cbb-8fe2-d9ee1f231ca1",
"type": "main",
"index": 0
}
],
[
{
"node": "03806211-8278-4e6e-9aa3-9511ae7b2d6a",
"type": "main",
"index": 0
}
]
]
},
"b7838069-c5ef-4a6b-8003-f976f5952c55": {
"main": [
[
{
"node": "0253a4de-ca69-4dd0-9c75-7bb686d296be",
"type": "main",
"index": 0
}
]
]
},
"0253a4de-ca69-4dd0-9c75-7bb686d296be": {
"main": [
[
{
"node": "b2bebed5-0a36-4d7f-9ae1-ce5aeb17803d",
"type": "main",
"index": 0
}
]
]
},
"bb3d4b79-3a7e-4d7a-914a-4dbd85a8bca3": {
"main": [
[
{
"node": "8eacfac6-b3f0-41f8-9d45-6587f3f59333",
"type": "main",
"index": 0
}
]
]
},
"66d888dd-020c-4d3b-845b-f93cd867e6a8": {
"main": [
[
{
"node": "bb3d4b79-3a7e-4d7a-914a-4dbd85a8bca3",
"type": "main",
"index": 0
}
]
]
},
"d75d7591-4afa-427c-b436-ada9d8eb90dc": {
"main": [
[
{
"node": "e291b555-c948-48c4-b5a8-0e39b4c16e0b",
"type": "main",
"index": 0
}
]
]
},
"aa04fbde-36fc-4c9d-bc0e-ef3725de3879": {
"main": [
[
{
"node": "b8d9735c-cf50-4b4e-b913-f21093e68dc2",
"type": "main",
"index": 0
}
]
]
},
"e291b555-c948-48c4-b5a8-0e39b4c16e0b": {
"main": [
[
{
"node": "b7838069-c5ef-4a6b-8003-f976f5952c55",
"type": "main",
"index": 0
}
]
]
},
"442fcd9c-dcff-4b5f-8d3e-17823048e40a": {
"main": [
[
{
"node": "d17d13ca-cf7b-42a2-8c0a-c41858b936ec",
"type": "main",
"index": 0
}
]
]
},
"b2bebed5-0a36-4d7f-9ae1-ce5aeb17803d": {
"main": [
[
{
"node": "d22a9ad6-41a6-4601-9fe4-6bb194854fbd",
"type": "main",
"index": 0
}
]
]
}
}
}Comment utiliser ce workflow ?
Copiez le code de configuration JSON ci-dessus, créez un nouveau workflow dans votre instance n8n et sélectionnez "Importer depuis le JSON", collez la configuration et modifiez les paramètres d'authentification selon vos besoins.
Dans quelles scénarios ce workflow est-il adapté ?
Avancé - Traitement des factures
Est-ce payant ?
Ce workflow est entièrement gratuit et peut être utilisé directement. Veuillez noter que les services tiers utilisés dans le workflow (comme l'API OpenAI) peuvent nécessiter un paiement de votre part.
Workflows recommandés
Oneclick AI Squad
@oneclick-aiThe AI Squad Initiative is a pioneering effort to build, automate and scale AI-powered workflows using n8n.io. Our mission is to help individuals and businesses integrate AI agents seamlessly into their daily operations from automating tasks and enhancing productivity to creating innovative, intelligent solutions. We design modular, reusable AI workflow templates that empower creators, developers and teams to supercharge their automation with minimal effort and maximum impact.
Partager ce workflow