Parser de facturas de DocSumo

Intermedio

Este es unInvoice Processing, AI Summarizationflujo de automatización del dominio deautomatización que contiene 7 nodos.Utiliza principalmente nodos como Code, FormTrigger, HttpRequest, ConvertToFile. Usar DocSumo para extraer y estructurar datos de facturas y exportarlos a Excel

Requisitos previos
  • Pueden requerirse credenciales de autenticación para la API de destino
Vista previa del flujo de trabajo
Visualización de las conexiones entre nodos, con soporte para zoom y panorámica
Exportar flujo de trabajo
Copie la siguiente configuración JSON en n8n para importar y usar este flujo de trabajo
{
  "id": "5s26gAyizRhbNI15",
  "meta": {
    "instanceId": "2d34387799014884b6bb4a0dc8b683ee92ad2bcf5aadb21177a0062d65f47540"
  },
  "name": "DocSumo Invoice Parser",
  "tags": [],
  "nodes": [
    {
      "id": "a35d21e3-7139-4a75-9deb-04a61e21ab20",
      "name": "Al enviar el formulario",
      "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": "HTTP Solicitud",
      "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": "HTTP Solicitud1",
      "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": "HTTP Solicitud2",
      "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": "Código",
      "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": "Convertir a Archivo",
      "type": "n8n-nodes-base.convertToFile",
      "position": [
        980,
        -100
      ],
      "parameters": {
        "options": {},
        "operation": "xls",
        "binaryPropertyName": "="
      },
      "typeVersion": 1.1
    },
    {
      "id": "01c14879-d3f3-4185-a30c-609de127c0d7",
      "name": "Nota Adhesiva",
      "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
          }
        ]
      ]
    },
    "c5ebb140-2292-424a-81e9-3438d7142673": {
      "main": [
        [
          {
            "node": "b76f3d26-c582-4c87-b2f7-9f973ecf6dd0",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "b76f3d26-c582-4c87-b2f7-9f973ecf6dd0": {
      "main": [
        [
          {
            "node": "78a90dab-233f-42f9-9d97-2a8220c77ceb",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "78a90dab-233f-42f9-9d97-2a8220c77ceb": {
      "main": [
        [
          {
            "node": "d5f56d5b-b7e6-41f1-9e7a-81c97eb2c191",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "a35d21e3-7139-4a75-9deb-04a61e21ab20": {
      "main": [
        [
          {
            "node": "c5ebb140-2292-424a-81e9-3438d7142673",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Preguntas frecuentes

¿Cómo usar este flujo de trabajo?

Copie el código de configuración JSON de arriba, cree un nuevo flujo de trabajo en su instancia de n8n y seleccione "Importar desde JSON", pegue la configuración y luego modifique la configuración de credenciales según sea necesario.

¿En qué escenarios es adecuado este flujo de trabajo?

Intermedio - Procesamiento de facturas, Resumen de IA

¿Es de pago?

Este flujo de trabajo es completamente gratuito, puede importarlo y usarlo directamente. Sin embargo, tenga en cuenta que los servicios de terceros utilizados en el flujo de trabajo (como la API de OpenAI) pueden requerir un pago por su cuenta.

Información del flujo de trabajo
Nivel de dificultad
Intermedio
Número de nodos7
Categoría2
Tipos de nodos5
Descripción de la dificultad

Adecuado para usuarios con experiencia intermedia, flujos de trabajo de complejidad media con 6-15 nodos

Enlaces externos
Ver en n8n.io

Compartir este flujo de trabajo

Categorías

Categorías: 34