Envoi automatique de factures aux clients
Ceci est unAI Summarization, Multimodal AIworkflow d'automatisation du domainecontenant 29 nœuds.Utilise principalement des nœuds comme If, Set, Code, Gmail, Merge. Automatisation du traitement des factures avec OCR.Space, GPT-4 et Google Drive vers Gmail
- •Compte Google et informations d'identification Gmail API
- •Informations d'identification Google Drive API
- •Peut nécessiter les informations d'identification d'authentification de l'API cible
- •Informations d'identification Google Sheets API
- •Clé API OpenAI
Nœuds utilisés (29)
Catégorie
{
"id": "Invzq7tJ1X0LQ3rb",
"meta": {
"instanceId": "00761fd5aea81495387b0889e15912dcc912b73b7bf62f5ca3898afbd7a79723",
"templateCredsSetupCompleted": true
},
"name": "Send Invoice to clients automatically",
"tags": [
{
"id": "j0SNhalFSbPAhdWo",
"name": "n8n creator",
"createdAt": "2025-09-02T01:40:23.866Z",
"updatedAt": "2025-09-02T01:40:23.866Z"
}
],
"nodes": [
{
"id": "43908db1-0163-41c4-8c0b-a127e575c058",
"name": "Fusion",
"type": "n8n-nodes-base.merge",
"position": [
-688,
144
],
"parameters": {
"mode": "combine",
"options": {},
"combineBy": "combineByPosition"
},
"typeVersion": 3
},
{
"id": "e10c62a4-8c0c-49e6-9672-68a0aee51b5a",
"name": "Boucle sur les éléments",
"type": "n8n-nodes-base.splitInBatches",
"position": [
-2320,
464
],
"parameters": {
"options": {}
},
"typeVersion": 3
},
{
"id": "5a37b5e5-40e8-4888-ac24-66367e65969a",
"name": "HTTP Request1",
"type": "n8n-nodes-base.httpRequest",
"position": [
-1744,
464
],
"parameters": {
"url": "https://api.ocr.space/parse/image",
"method": "POST",
"options": {},
"sendBody": true,
"contentType": "multipart-form-data",
"authentication": "genericCredentialType",
"bodyParameters": {
"parameters": [
{
"name": "language",
"value": "eng"
},
{
"name": "file",
"parameterType": "formBinaryData",
"inputDataFieldName": "data"
}
]
},
"genericAuthType": "httpHeaderAuth"
},
"credentials": {
"httpHeaderAuth": {
"id": "qh2jhNdxpHOM9SGZ",
"name": "PiAPI"
}
},
"typeVersion": 4.2
},
{
"id": "9e72ec12-aba0-474e-97f3-7d7958905e70",
"name": "Google Drive",
"type": "n8n-nodes-base.googleDrive",
"position": [
-2016,
464
],
"parameters": {
"fileId": {
"__rl": true,
"mode": "id",
"value": "={{ $('Google Drive Trigger').item.json.id }}"
},
"options": {},
"operation": "download"
},
"credentials": {
"googleDriveOAuth2Api": {
"id": "KZY6CHPvoIbIxMKd",
"name": "Google Drive account"
}
},
"typeVersion": 3
},
{
"id": "73e4f62d-80c4-483f-8c00-f5fc7c8b9882",
"name": "Google Sheets",
"type": "n8n-nodes-base.googleSheetsTool",
"position": [
-1024,
688
],
"parameters": {
"options": {},
"sheetName": {
"__rl": true,
"mode": "list",
"value": "gid=0",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1UDlHvLgcZn714etZxtgm7bJCATvDcutVyugrvqM2kaM/edit#gid=0",
"cachedResultName": "Feuille 1"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1UDlHvLgcZn714etZxtgm7bJCATvDcutVyugrvqM2kaM",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1UDlHvLgcZn714etZxtgm7bJCATvDcutVyugrvqM2kaM/edit?usp=drivesdk",
"cachedResultName": "list of company names and emails"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "6UWtW8DQlbmfYbkk",
"name": "Google Sheets account"
}
},
"typeVersion": 4.5
},
{
"id": "550dbd6b-b691-43eb-afbd-b3a16a7f59d0",
"name": "OpenAI Chat Model",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
-1120,
864
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4o-mini"
},
"options": {}
},
"credentials": {
"openAiApi": {
"id": "QsPyEUltWeliSiFb",
"name": "OpenAi account"
}
},
"typeVersion": 1.2
},
{
"id": "ebb1c8f5-cbf0-4d00-b171-1f6040c38300",
"name": "Agent IA",
"type": "@n8n/n8n-nodes-langchain.agent",
"onError": "continueRegularOutput",
"position": [
-1088,
480
],
"parameters": {
"text": "={{ $json.company }}",
"options": {
"systemMessage": "=You will receive a company name as plain text.\n\nYour task is to:\n\t1.\tCross-reference the given name against a Google Sheet database.\n\t2.\tThe database contains two columns: Company Name and Email.\n\t3.\tPerform a case-insensitive search to find an exact match for the company name.\n\t4.\tIf a match is found, return a JSON object \n{\n \"company_name\": \"Matched Company Name\",\n \"email\": \"matched@email.com\"\n}\n\n5. If no match is found, return a JSON object with an error message:\n{\n \"error\": \"Company not found in the database.\"\n}",
"returnIntermediateSteps": false
},
"promptType": "define",
"hasOutputParser": true
},
"retryOnFail": true,
"typeVersion": 1.7,
"waitBetweenTries": 5000
},
{
"id": "dd8d6365-6a12-4150-82d3-a3ee0bbb74d5",
"name": "Modifier les champs",
"type": "n8n-nodes-base.set",
"position": [
-1536,
464
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "32dbf33f-9c71-4d84-ab7c-cdb1df189210",
"name": "text",
"type": "string",
"value": "={{ $json.ParsedResults[0].ParsedText}}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "a901f0d8-f5a5-4d01-9e86-73980cd74e47",
"name": "Code",
"type": "n8n-nodes-base.code",
"onError": "continueErrorOutput",
"position": [
-1328,
464
],
"parameters": {
"jsCode": "const inputText = $json[\"text\"];\nconst lines = inputText.split(/\\r?\\n/);\n\nlet factureIndex = lines.findIndex(line => line.toLowerCase().includes(\"billed to\"));\nlet name = null;\n\nif (factureIndex >= 0) {\n const lineAfter = lines[factureIndex + 1]?.trim();\n const nextLine = lines[factureIndex + 2]?.trim();\n\n const isProbablyName = (line) => (\n /[a-z]/.test(line) && // has lowercase\n line.length >= 5 && // not too short\n line !== line.toUpperCase() // not all uppercase\n );\n\n if (isProbablyName(lineAfter)) {\n name = lineAfter;\n } else if (isProbablyName(nextLine)) {\n name = nextLine;\n }\n}\n\nif (!name) {\n throw new Error(\"No company name found after 'Billed to'\");\n}\n\nreturn [{ company: name }];"
},
"typeVersion": 2
},
{
"id": "a7ad5822-78d6-48cb-b9d8-b60017a52a30",
"name": "Aucune opération",
"type": "n8n-nodes-base.noOp",
"position": [
-2016,
128
],
"parameters": {},
"typeVersion": 1
},
{
"id": "999cb1c3-3ce1-44b1-bcdd-b6a7399e903a",
"name": "Fusion1",
"type": "n8n-nodes-base.merge",
"position": [
-1504,
816
],
"parameters": {
"mode": "combine",
"options": {},
"combineBy": "combineByPosition"
},
"typeVersion": 3
},
{
"id": "944af94f-6a2a-4cd2-9334-5548e8645303",
"name": "Aucune opération1",
"type": "n8n-nodes-base.noOp",
"position": [
-1728,
128
],
"parameters": {},
"typeVersion": 1
},
{
"id": "14ea1466-6532-42f8-a717-c716a92647dd",
"name": "Erreur",
"type": "n8n-nodes-base.gmail",
"position": [
-512,
816
],
"webhookId": "7c52b689-dd98-44dd-969d-6c8d45d975bb",
"parameters": {
"sendTo": "Email Here",
"message": "The error in the workflow pertains to the attached document. Please check if it has not been sent and manually send it. Also check the database to make sure the name of the corresponding company is in the database. ",
"options": {
"attachmentsUi": {
"attachmentsBinary": [
{}
]
},
"appendAttribution": false
},
"subject": "Error in Workflow",
"emailType": "text"
},
"credentials": {
"gmailOAuth2": {
"id": "aMOyqTwb2YTJyW5F",
"name": "Gmail account"
}
},
"typeVersion": 2.1
},
{
"id": "28926b1c-ce6a-4d1d-a42e-199d11d302f7",
"name": "Envoyer un email",
"type": "n8n-nodes-base.gmail",
"position": [
-160,
816
],
"webhookId": "7c52b689-dd98-44dd-969d-6c8d45d975bb",
"parameters": {
"sendTo": "Email Here",
"message": "The error in the workflow pertains to the attached document. Please check if it has not been sent and manually send it. Also check the database to make sure the name of the corresponding company is in the database. ",
"options": {
"attachmentsUi": {
"attachmentsBinary": [
{}
]
},
"appendAttribution": false
},
"subject": "Error in Workflow",
"emailType": "text"
},
"credentials": {
"gmailOAuth2": {
"id": "aMOyqTwb2YTJyW5F",
"name": "Gmail account"
}
},
"typeVersion": 2.1
},
{
"id": "b0fcd4e0-2875-419e-b3e8-23082150e0a0",
"name": "Erreur1",
"type": "n8n-nodes-base.gmail",
"position": [
-1328,
816
],
"webhookId": "5ae6fbe2-35d9-4482-9ca9-9d579460f356",
"parameters": {
"sendTo": "Email Here",
"message": "The error in the workflow pertains to the attached document. Please check if it has not been sent and manually send it. Also check the database to make sure the name of the corresponding company is in the database. ",
"options": {},
"subject": "Error in workflow",
"emailType": "text"
},
"credentials": {
"gmailOAuth2": {
"id": "aMOyqTwb2YTJyW5F",
"name": "Gmail account"
}
},
"typeVersion": 2.1
},
{
"id": "00a3bd30-62c6-40e5-ad29-89f9ec811aa5",
"name": "Si",
"type": "n8n-nodes-base.if",
"position": [
-512,
144
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "dcfbe432-fc35-438e-8e4b-4fa109107376",
"operator": {
"type": "object",
"operation": "notEmpty",
"singleValue": true
},
"leftValue": "={{ $('AI Agent').item.json.output }}",
"rightValue": ""
}
]
}
},
"typeVersion": 2.2
},
{
"id": "5b9ce018-3103-4c30-ab83-bdb440eb9ae1",
"name": "Structured Output Parser1",
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
"position": [
-896,
704
],
"parameters": {
"autoFix": true,
"jsonSchemaExample": "{\n\t\"email\":\"email of recipient\",\n \"name\":\"name of recipient\"\n}"
},
"typeVersion": 1.3
},
{
"id": "c34d9478-0acb-492b-807e-a57bfb269a23",
"name": "Note adhésive1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-2608,
272
],
"parameters": {
"width": 176,
"height": 352,
"content": "### Here we set a google drive folder, where any time an invoice is added, the automation will be triggered automatically"
},
"typeVersion": 1
},
{
"id": "8f83d6d0-bc12-4cd9-9a3c-cc291400016a",
"name": "Note adhésive2",
"type": "n8n-nodes-base.stickyNote",
"position": [
-2352,
272
],
"parameters": {
"width": 160,
"height": 352,
"content": "### Here we loop over the items, because we may have more than 1 invoice placed in the folder"
},
"typeVersion": 1
},
{
"id": "4e45b1c4-0051-4cb9-bee7-a19819da906d",
"name": "Note adhésive3",
"type": "n8n-nodes-base.stickyNote",
"position": [
-2048,
272
],
"parameters": {
"width": 150,
"height": 352,
"content": "### Here we download the invoice to pass it on to the OCR from ocr space"
},
"typeVersion": 1
},
{
"id": "47c4d010-9870-4514-8879-a6a37c174663",
"name": "Note adhésive4",
"type": "n8n-nodes-base.stickyNote",
"position": [
-3760,
80
],
"parameters": {
"width": 1056,
"height": 1232,
"content": "# Setting up the workflow\n\n## 1. Connect google drive to your account, and create a folder that will serve as the input. \n\n## 2. Connect your Gmail account to n8n. \n\n## 3. Create an OCR space account (free). For the authentication, choose Generic Credential Type, then Header Auth. In the Header Auth, create new credential, with the Name as apikey and the Value as YOUR-API-KEY\n\n## 4. Connect your preferred LLM credentials, and connect it to the AI Agent\n\n## 5. Create a copy of the Google Sheet Database, fill it with your list and connect it to the AI Agent\n\n# OCR Space: https://ocr.space\n\n# Google Sheet Database: https://docs.google.com/spreadsheets/d/1M0sS7KZzOn9Bu8Dy0lcrh2jWqVkLa0qFQfki1jecxeE/edit?usp=sharing (Make a copy)\n\n# Workflow Summary: This workflow takes in from a google drive folder, scanned pdf invoices. The workflow then extracts the text from the file using OCR space. Once the text is returned, the AI agent cross references the company name, with the database (excel sheet) to find the company name and the email of the recipient in the company. If it is found the email is sent with the invoice attached. "
},
"typeVersion": 1
},
{
"id": "ae882eb4-d4a9-4ffa-a49f-95e4d78b5cd8",
"name": "Note adhésive5",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1776,
272
],
"parameters": {
"width": 150,
"height": 352,
"content": "### Here we are sending the downloaded file to OCR space, and getting the extracted information from the invoice"
},
"typeVersion": 1
},
{
"id": "2948912f-1bd6-42a9-a630-e3e24a00a45a",
"name": "Note adhésive6",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1568,
272
],
"parameters": {
"width": 150,
"height": 352,
"content": "### Assigning name to the text. "
},
"typeVersion": 1
},
{
"id": "518d1756-b601-4c9c-8b87-c5fc2d601370",
"name": "Note adhésive7",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1360,
272
],
"parameters": {
"width": 150,
"height": 352,
"content": "### Extracting company name. In this case after the billed to:"
},
"typeVersion": 1
},
{
"id": "c7f521dd-dc76-4be8-92db-b3de9bf2946e",
"name": "Note adhésive8",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1120,
272
],
"parameters": {
"width": 320,
"height": 352,
"content": "### AI Agent cross references name with Database and returns the recipients email address"
},
"typeVersion": 1
},
{
"id": "337d3670-0c2e-4507-8c75-eb235286e97c",
"name": "Note adhésive9",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1360,
688
],
"parameters": {
"width": 160,
"height": 272,
"content": "### If we have any errors, we send an email to the operator for manual review"
},
"typeVersion": 1
},
{
"id": "e8c25552-0d00-4285-858f-cc30348f33d3",
"name": "Note adhésive10",
"type": "n8n-nodes-base.stickyNote",
"position": [
-544,
672
],
"parameters": {
"width": 160,
"height": 256,
"content": "### If we have any errors, we send an email to the operator for manual review"
},
"typeVersion": 1
},
{
"id": "95716bac-97bd-4e1f-b7e6-9478cdf151dd",
"name": "Note adhésive11",
"type": "n8n-nodes-base.stickyNote",
"position": [
-192,
672
],
"parameters": {
"width": 150,
"height": 256,
"content": "### Send email to recipient with the invoice attached"
},
"typeVersion": 1
},
{
"id": "46d6e0ac-7555-48a8-b57d-e97a42bec8b0",
"name": "Google Drive Trigger1",
"type": "n8n-nodes-base.googleDriveTrigger",
"position": [
-2576,
464
],
"parameters": {
"pollTimes": {
"item": [
{
"mode": "everyMinute"
}
]
},
"triggerOn": "specificFolder",
"folderToWatch": {
"__rl": true,
"mode": "list",
"value": ""
}
},
"credentials": {
"googleDriveOAuth2Api": {
"id": "KZY6CHPvoIbIxMKd",
"name": "Google Drive account"
}
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "1fb1901c-362e-41f9-8f14-2ac208b59826",
"connections": {
"00a3bd30-62c6-40e5-ad29-89f9ec811aa5": {
"main": [
[
{
"node": "28926b1c-ce6a-4d1d-a42e-199d11d302f7",
"type": "main",
"index": 0
}
],
[
{
"node": "14ea1466-6532-42f8-a717-c716a92647dd",
"type": "main",
"index": 0
}
]
]
},
"a901f0d8-f5a5-4d01-9e86-73980cd74e47": {
"main": [
[
{
"node": "ebb1c8f5-cbf0-4d00-b171-1f6040c38300",
"type": "main",
"index": 0
}
],
[
{
"node": "999cb1c3-3ce1-44b1-bcdd-b6a7399e903a",
"type": "main",
"index": 0
}
]
]
},
"14ea1466-6532-42f8-a717-c716a92647dd": {
"main": [
[
{
"node": "e10c62a4-8c0c-49e6-9672-68a0aee51b5a",
"type": "main",
"index": 0
}
]
]
},
"43908db1-0163-41c4-8c0b-a127e575c058": {
"main": [
[
{
"node": "00a3bd30-62c6-40e5-ad29-89f9ec811aa5",
"type": "main",
"index": 0
}
]
]
},
"b0fcd4e0-2875-419e-b3e8-23082150e0a0": {
"main": [
[
{
"node": "e10c62a4-8c0c-49e6-9672-68a0aee51b5a",
"type": "main",
"index": 0
}
]
]
},
"999cb1c3-3ce1-44b1-bcdd-b6a7399e903a": {
"main": [
[
{
"node": "b0fcd4e0-2875-419e-b3e8-23082150e0a0",
"type": "main",
"index": 0
}
]
]
},
"ebb1c8f5-cbf0-4d00-b171-1f6040c38300": {
"main": [
[
{
"node": "43908db1-0163-41c4-8c0b-a127e575c058",
"type": "main",
"index": 1
}
],
[]
]
},
"28926b1c-ce6a-4d1d-a42e-199d11d302f7": {
"main": [
[
{
"node": "e10c62a4-8c0c-49e6-9672-68a0aee51b5a",
"type": "main",
"index": 0
}
]
]
},
"dd8d6365-6a12-4150-82d3-a3ee0bbb74d5": {
"main": [
[
{
"node": "a901f0d8-f5a5-4d01-9e86-73980cd74e47",
"type": "main",
"index": 0
}
]
]
},
"9e72ec12-aba0-474e-97f3-7d7958905e70": {
"main": [
[
{
"node": "5a37b5e5-40e8-4888-ac24-66367e65969a",
"type": "main",
"index": 0
},
{
"node": "999cb1c3-3ce1-44b1-bcdd-b6a7399e903a",
"type": "main",
"index": 1
},
{
"node": "944af94f-6a2a-4cd2-9334-5548e8645303",
"type": "main",
"index": 0
}
]
]
},
"73e4f62d-80c4-483f-8c00-f5fc7c8b9882": {
"ai_tool": [
[
{
"node": "ebb1c8f5-cbf0-4d00-b171-1f6040c38300",
"type": "ai_tool",
"index": 0
}
]
]
},
"5a37b5e5-40e8-4888-ac24-66367e65969a": {
"main": [
[
{
"node": "dd8d6365-6a12-4150-82d3-a3ee0bbb74d5",
"type": "main",
"index": 0
}
]
]
},
"e10c62a4-8c0c-49e6-9672-68a0aee51b5a": {
"main": [
[
{
"node": "a7ad5822-78d6-48cb-b9d8-b60017a52a30",
"type": "main",
"index": 0
}
],
[
{
"node": "9e72ec12-aba0-474e-97f3-7d7958905e70",
"type": "main",
"index": 0
}
]
]
},
"550dbd6b-b691-43eb-afbd-b3a16a7f59d0": {
"ai_languageModel": [
[
{
"node": "ebb1c8f5-cbf0-4d00-b171-1f6040c38300",
"type": "ai_languageModel",
"index": 0
},
{
"node": "5b9ce018-3103-4c30-ab83-bdb440eb9ae1",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"46d6e0ac-7555-48a8-b57d-e97a42bec8b0": {
"main": [
[
{
"node": "e10c62a4-8c0c-49e6-9672-68a0aee51b5a",
"type": "main",
"index": 0
}
]
]
},
"944af94f-6a2a-4cd2-9334-5548e8645303": {
"main": [
[
{
"node": "43908db1-0163-41c4-8c0b-a127e575c058",
"type": "main",
"index": 0
}
]
]
},
"5b9ce018-3103-4c30-ab83-bdb440eb9ae1": {
"ai_outputParser": [
[
{
"node": "ebb1c8f5-cbf0-4d00-b171-1f6040c38300",
"type": "ai_outputParser",
"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é - Résumé IA, IA Multimodale
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
Michael Taleb
@michaeltalebn8n developer helping businesses save time and scale by automating complex business processes with n8n and smart integrations.
Partager ce workflow