Extracción de datos estructurados de facturas PDF de JotForm (OpenAI GPT-4.1-mini)
Este es unInvoice Processing, AI Summarizationflujo de automatización del dominio deautomatización que contiene 19 nodos.Utiliza principalmente nodos como Webhook, Function, HttpRequest, GoogleSheets, ReadWriteFile. Usar OpenAI GPT-4.1-mini para extraer datos estructurados de facturas PDF de JotForm a una tabla
- •Punto final de HTTP Webhook (n8n generará automáticamente)
- •Pueden requerirse credenciales de autenticación para la API de destino
- •Credenciales de API de Google Sheets
- •Clave de API de OpenAI
Nodos utilizados (19)
{
"id": "QvIVxAgboRsZMMr0",
"meta": {
"instanceId": "885b4fb4a6a9c2cb5621429a7b972df0d05bb724c20ac7dac7171b62f1c7ef40",
"templateCredsSetupCompleted": true
},
"name": "Structured Invoice Data Extraction from JotForm PDFs via Open AI GPT-4.1-mini",
"tags": [
{
"id": "Kujft2FOjmOVQAmJ",
"name": "Engineering",
"createdAt": "2025-04-09T01:31:00.558Z",
"updatedAt": "2025-04-09T01:31:00.558Z"
},
{
"id": "ddPkw7Hg5dZhQu2w",
"name": "AI",
"createdAt": "2025-04-13T05:38:08.053Z",
"updatedAt": "2025-04-13T05:38:08.053Z"
}
],
"nodes": [
{
"id": "bcd1e88b-4435-4862-960e-86f284884681",
"name": "Webhook",
"type": "n8n-nodes-base.webhook",
"position": [
-544,
-32
],
"webhookId": "b3a65dd9-8203-4aff-8005-80d98fb4c030",
"parameters": {
"path": "b3a65dd9-8203-4aff-8005-80d98fb4c030",
"options": {},
"httpMethod": "POST"
},
"typeVersion": 2.1
},
{
"id": "84b85e47-b3aa-4c61-85ce-c17aba383b8e",
"name": "Extracción de datos estructurados formateados",
"type": "@n8n/n8n-nodes-langchain.informationExtractor",
"position": [
-352,
-32
],
"parameters": {
"text": "= Extract Structured Information in JSON from the provided invoice raw request {{ $('Webhook').item.json.body.rawRequest }}",
"options": {},
"schemaType": "fromJson",
"jsonSchemaExample": "{\n \"formSubmission\": {\n \"id\": \"252920932663460\",\n \"source\": \"form\",\n \"submittedAt\": \"2025-10-20T11:45:35.950Z\",\n \"timeToSubmitSeconds\": 20,\n \"eventId\": \"1760940191615_252920932663460_6BZ73Ag\"\n },\n \"user\": {\n \"name\": {\n \"first\": \"Ranjan\",\n \"last\": \"Dailata\"\n },\n \"email\": \"ranjancse@gmail.com\"\n },\n \"invoice\": {\n \"number\": \"INV-3337\",\n \"date\": {\n \"month\": \"\",\n \"day\": \"\",\n \"year\": \"\"\n },\n \"description\": \"Sample Invoice\",\n \"attachments\": [\n {\n \"filename\": \"PDF-Invoice-Sample.pdf\",\n \"url\": \"https://www.jotform.com/uploads/ranjancse/252920932663460/6367495377218625724/PDF-Invoice-Sample.pdf\",\n \"fileServer\": \"jotformfs-e4f4ece4d0a90#019a0038-65e1-79f6-bdb5-c9281000db56\"\n }\n ]\n },\n \"system\": {\n \"uploadServerUrl\": \"https://upload.jotform.com/upload\",\n \"eventObserverEnabled\": true,\n \"validatedFields\": {\n \"new\": 1\n },\n \"buildDate\": \"1760940189728\",\n \"jsExecutionTracker\": {\n \"buildDate\": \"1760940189728\",\n \"initStarted\": \"1760940191614\",\n \"validatorCalled\": \"1760940191680\",\n \"validatorMounted\": false,\n \"initComplete\": \"1760940191684\",\n \"intervalComplete\": \"1760940212688\",\n \"onSubmitFired\": \"1760940335932\",\n \"validationPassed\": \"1760940335944\",\n \"formSubmitted\": \"1760940335950\"\n }\n }\n}\n"
},
"typeVersion": 1.2
},
{
"id": "f7f77bb3-eb70-4000-aace-061d022e2882",
"name": "Descargar factura",
"type": "n8n-nodes-base.httpRequest",
"position": [
0,
-32
],
"parameters": {
"url": "={{ $json.output.invoice.attachments[0].url }}",
"options": {
"redirect": {
"redirect": {}
},
"response": {
"response": {
"responseFormat": "file",
"outputPropertyName": "=PDF-Invoice-Sample.pdf"
}
}
},
"sendHeaders": true,
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"headerParameters": {
"parameters": [
{}
]
}
},
"credentials": {
"httpBearerAuth": {
"id": "m17YVh2yJY7Fl9Wx",
"name": "Thordata SERP Bearer YOUR_TOKEN_HERE Account"
},
"httpHeaderAuth": {
"id": "i2RtoFcQm5F2NqG2",
"name": "Jotform Api Key"
}
},
"typeVersion": 4.2
},
{
"id": "cc1a28b8-a287-43c3-9bb3-118a89570562",
"name": "Extraer desde archivo",
"type": "n8n-nodes-base.extractFromFile",
"position": [
416,
-32
],
"parameters": {
"options": {},
"operation": "pdf",
"binaryPropertyName": "={{ $('Write File from Disk for Inbound Invoice Processing').item.binary['PDF-Invoice-Sample.pdf']}}"
},
"typeVersion": 1
},
{
"id": "e9a4d6af-2efc-4d6b-8f72-5b49f60181ca",
"name": "Analizador de salida estructurada",
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
"position": [
736,
160
],
"parameters": {
"autoFix": true,
"schemaType": "manual",
"inputSchema": "{\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"title\": \"Invoice\",\n \"type\": \"object\",\n \"properties\": {\n \"invoiceId\": {\n \"type\": \"string\",\n \"description\": \"Unique invoice identifier\"\n },\n \"invoiceNumber\": {\n \"type\": \"string\",\n \"description\": \"Human-readable invoice number (e.g. INV-2025-001)\"\n },\n \"invoiceDate\": {\n \"type\": \"string\",\n \"format\": \"date\",\n \"description\": \"Invoice issue date\"\n },\n \"dueDate\": {\n \"type\": \"string\",\n \"format\": \"date\",\n \"description\": \"Payment due date\"\n },\n \"company\": {\n \"type\": \"object\",\n \"properties\": {\n \"name\": { \"type\": \"string\" },\n \"address\": { \"type\": \"string\" },\n \"email\": { \"type\": \"string\" },\n \"phone\": { \"type\": \"string\" },\n \"taxId\": { \"type\": \"string\" }\n },\n \"required\": [\"name\"]\n },\n \"client\": {\n \"type\": \"object\",\n \"properties\": {\n \"name\": { \"type\": \"string\" },\n \"address\": { \"type\": \"string\" },\n \"email\": { \"type\": \"string\" },\n \"phone\": { \"type\": \"string\" }\n },\n \"required\": [\"name\"]\n },\n \"items\": {\n \"type\": \"array\",\n \"description\": \"Line items billed on the invoice\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"description\": { \"type\": \"string\" },\n \"quantity\": { \"type\": \"number\" },\n \"unitPrice\": { \"type\": \"number\" },\n \"total\": { \"type\": \"number\" },\n \"taxRate\": { \"type\": \"number\" }\n },\n \"required\": [\"description\", \"quantity\", \"unitPrice\"]\n }\n },\n \"subTotal\": {\n \"type\": \"number\",\n \"description\": \"Total before tax and discounts\"\n },\n \"taxAmount\": {\n \"type\": \"number\",\n \"description\": \"Total tax amount applied\"\n },\n \"discount\": {\n \"type\": \"number\",\n \"description\": \"Discount applied to invoice\"\n },\n \"totalAmount\": {\n \"type\": \"number\",\n \"description\": \"Final amount due\"\n },\n \"currency\": {\n \"type\": \"string\",\n \"description\": \"Currency code (e.g. USD, EUR, INR)\"\n },\n \"notes\": {\n \"type\": \"string\",\n \"description\": \"Optional notes or terms\"\n },\n \"payment\": {\n \"type\": \"object\",\n \"properties\": {\n \"method\": { \"type\": \"string\", \"description\": \"Payment method (Bank, Card, etc.)\" },\n \"status\": { \"type\": \"string\", \"description\": \"paid, pending, overdue\" },\n \"transactionId\": { \"type\": \"string\" },\n \"paymentDate\": { \"type\": \"string\", \"format\": \"date\" }\n }\n },\n \"attachments\": {\n \"type\": \"array\",\n \"description\": \"Links to attached invoice PDFs or receipts\",\n \"items\": {\n \"type\": \"string\",\n \"format\": \"uri\"\n }\n }\n }\n}\n"
},
"typeVersion": 1.3
},
{
"id": "c60bd005-d03e-4053-93a1-7137c90b8e80",
"name": "Extracción de datos estructurados",
"type": "@n8n/n8n-nodes-langchain.chainLlm",
"position": [
640,
-32
],
"parameters": {
"text": "=Parse the below invoice info into a structured data\n\n{{ $json.text }}",
"batching": {},
"promptType": "define",
"hasOutputParser": true
},
"retryOnFail": true,
"typeVersion": 1.7,
"alwaysOutputData": false
},
{
"id": "2d0f93f5-6372-4c2c-97a0-61275648fc58",
"name": "Modelo de chat OpenAI para datos estructurados",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
576,
176
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4.1-mini"
},
"options": {}
},
"credentials": {
"openAiApi": {
"id": "vPKynKbDzJ5ZU4cU",
"name": "OpenAi account"
}
},
"typeVersion": 1.2
},
{
"id": "48d81c63-ed97-4229-a63d-ad1a2a8959ae",
"name": "Modelo de chat OpenAI para analizador de salida",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
672,
368
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4.1-mini"
},
"options": {}
},
"credentials": {
"openAiApi": {
"id": "vPKynKbDzJ5ZU4cU",
"name": "OpenAi account"
}
},
"typeVersion": 1.2
},
{
"id": "a54f0c84-82ca-439e-8cd8-86dabe04f69b",
"name": "Modelo de chat OpenAI para contenido formateado de datos estructurados",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
-352,
176
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4.1-mini",
"cachedResultName": "gpt-4.1-mini"
},
"options": {}
},
"credentials": {
"openAiApi": {
"id": "vPKynKbDzJ5ZU4cU",
"name": "OpenAi account"
}
},
"typeVersion": 1.2
},
{
"id": "a21275f7-fc1b-47ab-ba6a-06bcde58875e",
"name": "Nota adhesiva",
"type": "n8n-nodes-base.stickyNote",
"position": [
-608,
-432
],
"parameters": {
"color": 7,
"width": 352,
"height": 272,
"content": "\n\nUses OpenAI gpt-4.1-mini for structured data extraction of the invoice PDF content"
},
"typeVersion": 1
},
{
"id": "569de30c-835b-4ed3-aa7c-21052f4c06c9",
"name": "Escribir archivo desde disco para procesamiento de facturas entrantes",
"type": "n8n-nodes-base.readWriteFile",
"position": [
208,
-32
],
"parameters": {
"options": {},
"fileName": "=c:\\\\PDF-Invoice-Sample.pdf",
"operation": "write",
"dataPropertyName": "={{ $json.output.invoice.attachments[0].filename }}"
},
"typeVersion": 1
},
{
"id": "9f3662ac-82cf-48fd-b04e-979d8d4d9310",
"name": "Añadir o actualizar fila en hoja",
"type": "n8n-nodes-base.googleSheets",
"position": [
1120,
144
],
"parameters": {
"columns": {
"value": {},
"schema": [
{
"id": "output",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "output",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "autoMapInputData",
"matchingColumns": [
"output"
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "appendOrUpdate",
"sheetName": {
"__rl": true,
"mode": "list",
"value": "gid=0",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1WaQUR9Q32uKLbbu77CrvWhM2I_3NXEsxT0RDMGq-Dm0/edit#gid=0",
"cachedResultName": "Sheet1"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1WaQUR9Q32uKLbbu77CrvWhM2I_3NXEsxT0RDMGq-Dm0",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1WaQUR9Q32uKLbbu77CrvWhM2I_3NXEsxT0RDMGq-Dm0/edit?usp=drivesdk",
"cachedResultName": "Jotform Invoice Extraction"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "Zjoxh2BUZ6VXGQhA",
"name": "Google Sheets account"
}
},
"typeVersion": 4.7
},
{
"id": "707dd08c-6896-4888-9b16-699557d09320",
"name": "Escribir la factura estructurada en disco",
"type": "n8n-nodes-base.readWriteFile",
"position": [
1296,
-192
],
"parameters": {
"options": {},
"fileName": "=C:\\\\{{ $json.output.invoiceId }}-{{ $json.output.invoiceDate }}.json",
"operation": "write"
},
"typeVersion": 1
},
{
"id": "12cb7d07-9233-4081-92d9-11ebbe70270d",
"name": "Crear una respuesta binaria",
"type": "n8n-nodes-base.function",
"position": [
1120,
-192
],
"parameters": {
"functionCode": "\n\nitems[0].binary = {\n data: {\n data: new Buffer(JSON.stringify(items[0].json, null, 2)).toString('base64')\n }\n};\nreturn items;"
},
"typeVersion": 1
},
{
"id": "077170e7-ca49-49be-a8d9-892b999a6724",
"name": "Nota adhesiva 1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-608,
384
],
"parameters": {
"color": 7,
"width": 512,
"height": 512,
"content": "### **Purpose:**\nAutomates extraction of structured invoice data (ID, company, client, items, totals, etc.) from uploaded **JotForm PDF invoices** and stores results in **Google Sheets** and as JSON on disk.\n\n**Flow Summary:**\n\n1. **Webhook Trigger** — receives JotForm invoice submission.\n2. **Extract Form Data** — parses raw request and fetches PDF via JotForm API.\n3. **PDF Reader + GPT-4.1-mini** — extracts key invoice fields into structured JSON using AI-powered parsing.\n4. **Structured Output Parser** — validates against custom invoice schema.\n5. **Data Storage** —\n • Saves structured JSON locally.\n • Appends structured rows to Google Sheet for reporting.\n\n**Integrations:**\n\n* OpenAI GPT-4.1-mini\n* JotForm API\n* Google Sheets\n* Local File Storage\n\n"
},
"typeVersion": 1
},
{
"id": "575ee55d-ff5f-4ec1-a9a5-e9f711f2b05c",
"name": "Nota adhesiva 2",
"type": "n8n-nodes-base.stickyNote",
"position": [
368,
-160
],
"parameters": {
"color": 5,
"width": 656,
"height": 672,
"content": "## Structured Data Extraction Using OpenAI"
},
"typeVersion": 1
},
{
"id": "47621c4a-20cc-455c-b901-d12b93447bb8",
"name": "Nota adhesiva 3",
"type": "n8n-nodes-base.stickyNote",
"position": [
1040,
-288
],
"parameters": {
"color": 3,
"width": 400,
"height": 800,
"content": "## Export Data Handling"
},
"typeVersion": 1
},
{
"id": "73c0cc88-4604-4f19-83a2-10ce1bb9ea40",
"name": "Nota adhesiva 4",
"type": "n8n-nodes-base.stickyNote",
"position": [
-608,
-128
],
"parameters": {
"color": 4,
"width": 512,
"height": 464,
"content": "## Webhook Receiver & Data Formatting"
},
"typeVersion": 1
},
{
"id": "1f92db74-0623-4785-a62b-18ff14405463",
"name": "Nota adhesiva 5",
"type": "n8n-nodes-base.stickyNote",
"position": [
-80,
-128
],
"parameters": {
"width": 432,
"height": 464,
"content": "## Invoice Download & Write to Disk "
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "2b629465-8dc5-4eba-ad21-65f5e50f6280",
"connections": {
"bcd1e88b-4435-4862-960e-86f284884681": {
"main": [
[
{
"node": "84b85e47-b3aa-4c61-85ce-c17aba383b8e",
"type": "main",
"index": 0
}
]
]
},
"f7f77bb3-eb70-4000-aace-061d022e2882": {
"main": [
[
{
"node": "569de30c-835b-4ed3-aa7c-21052f4c06c9",
"type": "main",
"index": 0
}
]
]
},
"cc1a28b8-a287-43c3-9bb3-118a89570562": {
"main": [
[
{
"node": "c60bd005-d03e-4053-93a1-7137c90b8e80",
"type": "main",
"index": 0
}
]
]
},
"c60bd005-d03e-4053-93a1-7137c90b8e80": {
"main": [
[
{
"node": "9f3662ac-82cf-48fd-b04e-979d8d4d9310",
"type": "main",
"index": 0
},
{
"node": "12cb7d07-9233-4081-92d9-11ebbe70270d",
"type": "main",
"index": 0
}
]
]
},
"12cb7d07-9233-4081-92d9-11ebbe70270d": {
"main": [
[
{
"node": "707dd08c-6896-4888-9b16-699557d09320",
"type": "main",
"index": 0
}
]
]
},
"e9a4d6af-2efc-4d6b-8f72-5b49f60181ca": {
"ai_outputParser": [
[
{
"node": "c60bd005-d03e-4053-93a1-7137c90b8e80",
"type": "ai_outputParser",
"index": 0
}
]
]
},
"84b85e47-b3aa-4c61-85ce-c17aba383b8e": {
"main": [
[
{
"node": "f7f77bb3-eb70-4000-aace-061d022e2882",
"type": "main",
"index": 0
}
]
]
},
"48d81c63-ed97-4229-a63d-ad1a2a8959ae": {
"ai_languageModel": [
[
{
"node": "e9a4d6af-2efc-4d6b-8f72-5b49f60181ca",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"2d0f93f5-6372-4c2c-97a0-61275648fc58": {
"ai_languageModel": [
[
{
"node": "c60bd005-d03e-4053-93a1-7137c90b8e80",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"569de30c-835b-4ed3-aa7c-21052f4c06c9": {
"main": [
[
{
"node": "cc1a28b8-a287-43c3-9bb3-118a89570562",
"type": "main",
"index": 0
}
]
]
},
"a54f0c84-82ca-439e-8cd8-86dabe04f69b": {
"ai_languageModel": [
[
{
"node": "84b85e47-b3aa-4c61-85ce-c17aba383b8e",
"type": "ai_languageModel",
"index": 0
}
]
]
}
}
}¿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?
Avanzado - 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.
Flujos de trabajo relacionados recomendados
Ranjan Dailata
@ranjancseA Professional based out of India specialized in handling AI-powered automations. Contact me at ranjancse@gmail.com
Compartir este flujo de trabajo