Parseur de factures DocSumo
Ceci est unInvoice Processing, AI Summarizationworkflow d'automatisation du domainecontenant 7 nœuds.Utilise principalement des nœuds comme Code, FormTrigger, HttpRequest, ConvertToFile. Extraire et structurer les données de factures avec DocSumo, et les exporter vers Excel
- •Peut nécessiter les informations d'identification d'authentification de l'API cible
Nœuds utilisés (7)
Catégorie
{
"id": "5s26gAyizRhbNI15",
"meta": {
"instanceId": "2d34387799014884b6bb4a0dc8b683ee92ad2bcf5aadb21177a0062d65f47540"
},
"name": "DocSumo Invoice Parser",
"tags": [],
"nodes": [
{
"id": "a35d21e3-7139-4a75-9deb-04a61e21ab20",
"name": "On form submission",
"type": "n8n-nodes-base.formTrigger",
"position": [
40,
-100
],
"webhookId": "468f964f-3060-4d4d-a0f0-225e1d6eddac",
"parameters": {
"options": {},
"formTitle": "file",
"formFields": {
"values": [
{
"fieldType": "file",
"fieldLabel": "file",
"multipleFiles": false
}
]
}
},
"typeVersion": 2.2
},
{
"id": "c5ebb140-2292-424a-81e9-3438d7142673",
"name": "Requête HTTP",
"type": "n8n-nodes-base.httpRequest",
"position": [
260,
-100
],
"parameters": {
"url": "https://app.docsumo.com/api/v1/eevee/apikey/upload/",
"method": "POST",
"options": {
"redirect": {
"redirect": {
"followRedirects": false
}
}
},
"sendBody": true,
"contentType": "multipart-form-data",
"sendHeaders": true,
"authentication": "genericCredentialType",
"bodyParameters": {
"parameters": [
{
"name": "type",
"value": "invoice"
},
{
"name": "file",
"parameterType": "formBinaryData",
"inputDataFieldName": "file"
},
{
"name": "skip_review",
"value": "true"
}
]
},
"genericAuthType": "httpHeaderAuth",
"headerParameters": {
"parameters": [
{}
]
}
},
"typeVersion": 4.2
},
{
"id": "b76f3d26-c582-4c87-b2f7-9f973ecf6dd0",
"name": "Requête HTTP1",
"type": "n8n-nodes-base.httpRequest",
"position": [
440,
-100
],
"parameters": {
"url": "=https://app.docsumo.com/api/v1/eevee/apikey/documents/detail/{{ $json.data.document[0].doc_id }}",
"options": {},
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth"
},
"typeVersion": 4.2
},
{
"id": "78a90dab-233f-42f9-9d97-2a8220c77ceb",
"name": "Requête HTTP2",
"type": "n8n-nodes-base.httpRequest",
"position": [
620,
-100
],
"parameters": {
"url": "=https://app.docsumo.com/api/v1/eevee/apikey/data/simplified/{{ $json.data.document.doc_id }}/",
"options": {
"response": {
"response": {}
}
},
"sendHeaders": true,
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"headerParameters": {
"parameters": [
{
"name": "accept",
"value": "application/json"
}
]
}
},
"typeVersion": 4.2
},
{
"id": "d5f56d5b-b7e6-41f1-9e7a-81c97eb2c191",
"name": "Code",
"type": "n8n-nodes-base.code",
"position": [
780,
-100
],
"parameters": {
"jsCode": "// Process each document item\nconst processInvoice = (doc) => {\n // Extract header information (excluding Document Title and Processed At)\n const headerData = {\n \"Invoice Number\": doc?.data?.[\"Basic Information\"]?.[\"Invoice Number\"]?.value || \"\",\n \"Issue Date\": doc?.data?.[\"Basic Information\"]?.[\"Issue Date\"]?.value || \"\",\n \"Order ID\": doc?.data?.[\"Basic Information\"]?.[\"Order Id/Tracking No\"]?.value || \"\",\n \"Payment Terms\": doc?.data?.[\"Basic Information\"]?.[\"Terms\"]?.value || \"\",\n \"Buyer Name\": doc?.data?.[\"Buyer Detail\"]?.[\"Name\"]?.value || \"\",\n \"Buyer Address\": doc?.data?.[\"Buyer Detail\"]?.[\"Address\"]?.value || \"\",\n \"Buyer GST\": doc?.data?.[\"Buyer Detail\"]?.[\"GST/ VAT Number\"]?.value || \"\",\n \"Seller Name\": doc?.data?.[\"Seller Detail\"]?.[\"Name\"]?.value || \"\",\n \"Seller Address\": doc?.data?.[\"Seller Detail\"]?.[\"Address\"]?.value || \"\",\n \"Seller GST\": doc?.data?.[\"Seller Detail\"]?.[\"GST/ VAT Number\"]?.value || \"\",\n \"Subtotal\": doc?.data?.[\"GST & Amount\"]?.[\"Subtotal\"]?.value || 0,\n \"Tax Total\": doc?.data?.[\"GST & Amount\"]?.[\"Tax Total\"]?.value || 0,\n \"Total Due\": doc?.data?.[\"GST & Amount\"]?.[\"Total Due\"]?.value || 0\n };\n\n // Process line items with all original columns\n return doc?.data?.Table?.[\"Line Items\"]?.map(item => ({\n ...headerData, // Include all header fields\n \"Sr No.\": item?.[\"Sr No.\"]?.value || \"\",\n \"Item Code\": item?.[\"Item Code\"]?.value || \"\",\n \"Item Desc\": item?.Description?.value || \"\",\n \"HSN/SAC Code\": item?.HSN?.value || \"\",\n \"Qty\": item?.Quantity?.value || 0,\n \"Unit Price (INR)\": item?.[\"Unit Price\"]?.value || 0,\n \"Per\": item?.[\"Per\"]?.value || \"\",\n \"UoM\": item?.UoM?.value || \"\",\n \"Net Amount (INR)\": item?.[\"Subtotal Line\"]?.value || 0,\n \"Tax Rate\": item?.[\"Tax Rate Line\"]?.value || \"\",\n \"TGST\": item?.TGST?.value || 0,\n \"CGST\": item?.CGST?.value || 0,\n \"SGST\": item?.SGST?.value || 0,\n \"TCS\": item?.TCS?.value || 0,\n \"Gross Amt (INR)\": item?.[\"Gross Amount\"]?.value || 0,\n \"Delivery Date\": item?.[\"Delivery Date\"]?.value || \"\"\n })) || [];\n};\n\n// Main processing\nconst allResults = [];\nfor (const item of items) {\n try {\n const doc = Array.isArray(item.json) ? item.json[0] : item.json;\n if (doc?.data) {\n allResults.push(...processInvoice(doc));\n }\n } catch (error) {\n console.log(`Error processing item: ${error.message}`);\n }\n}\n\n// Return formatted results\nreturn allResults.length > 0 \n ? allResults.map(result => ({ json: result }))\n : [{ json: { error: \"No valid data processed\", raw: items[0]?.json }}];"
},
"typeVersion": 2
},
{
"id": "ca39a45f-5ea1-40a2-a68f-49e62ead1973",
"name": "Convert to File",
"type": "n8n-nodes-base.convertToFile",
"position": [
980,
-100
],
"parameters": {
"options": {},
"operation": "xls",
"binaryPropertyName": "="
},
"typeVersion": 1.1
},
{
"id": "01c14879-d3f3-4185-a30c-609de127c0d7",
"name": "Note adhésive",
"type": "n8n-nodes-base.stickyNote",
"position": [
720,
40
],
"parameters": {
"height": 100,
"content": "PLease adjust Code ou can customize header or line item extraction by editing the Code node as needed."
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "2c8d10c9-6226-47ef-ad9d-9690fed6df9b",
"connections": {
"d5f56d5b-b7e6-41f1-9e7a-81c97eb2c191": {
"main": [
[
{
"node": "ca39a45f-5ea1-40a2-a68f-49e62ead1973",
"type": "main",
"index": 0
}
]
]
},
"HTTP Request": {
"main": [
[
{
"node": "HTTP Request1",
"type": "main",
"index": 0
}
]
]
},
"HTTP Request1": {
"main": [
[
{
"node": "HTTP Request2",
"type": "main",
"index": 0
}
]
]
},
"HTTP Request2": {
"main": [
[
{
"node": "d5f56d5b-b7e6-41f1-9e7a-81c97eb2c191",
"type": "main",
"index": 0
}
]
]
},
"a35d21e3-7139-4a75-9deb-04a61e21ab20": {
"main": [
[
{
"node": "HTTP Request",
"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é ?
Intermédiaire - Traitement des factures, Résumé IA
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
Anurag
@aiautoeyePartager ce workflow