Reembolso de JotForm (plantilla)
Este es unautomatización que contiene 25 nodos.Utiliza principalmente nodos como If, Code, Gmail, Notion, HttpRequest. Procesamiento automatizado de recibos de reembolso con JotForm, Gemini 2.5 y Notion
- •Cuenta de Google y credenciales de API de Gmail
- •Clave de API de Notion
- •Pueden requerirse credenciales de autenticación para la API de destino
- •Clave de API de Google Gemini
Nodos utilizados (25)
Categoría
{
"id": "PtWwGGJYMVyJGgoI",
"meta": {
"instanceId": "7f1a0694161455be3a7e71f1e0dea04908b0376a1a81e3a0c1e5ac879d48f83a"
},
"name": "JotForm Cashback (Template)",
"tags": [],
"nodes": [
{
"id": "fafc18fe-9ffe-42d1-aa6e-16d2c44b0bab",
"name": "Activador de JotForm",
"type": "n8n-nodes-base.jotFormTrigger",
"position": [
-2896,
480
],
"webhookId": "YOUR_JOTFORM_WEBHOOK_ID",
"parameters": {
"form": "YOUR_FORM_ID"
},
"typeVersion": 1
},
{
"id": "53c0d83e-9711-4b81-b738-70919a4c764e",
"name": "Modelo de Chat Google Gemini",
"type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
"position": [
-1760,
768
],
"parameters": {
"options": {},
"modelName": "models/gemini-2.5-flash-lite"
},
"typeVersion": 1
},
{
"id": "6a8cba61-0195-44d7-a8e6-c6ab918918ab",
"name": "OCR.Space",
"type": "n8n-nodes-base.httpRequest",
"position": [
-1856,
480
],
"parameters": {
"url": "https://api.ocr.space/parse/image",
"method": "POST",
"options": {},
"sendBody": true,
"contentType": "multipart-form-data",
"sendHeaders": true,
"bodyParameters": {
"parameters": [
{
"name": "base64Image",
"value": "=data:image/jpeg;base64,{{$json.imageBase64}}"
},
{
"name": "language",
"value": "ara"
},
{
"name": "OCREngine",
"value": "1"
},
{
"name": "filetype",
"value": "jpg"
}
]
},
"headerParameters": {
"parameters": [
{
"name": "apikey",
"value": "YOUR_OCR_SPACE_API_KEY"
}
]
}
},
"typeVersion": 4.2
},
{
"id": "3794d88d-02db-4183-94f2-05d9cbcf8358",
"name": "Obtener Todos los Recibos",
"type": "n8n-nodes-base.httpRequest",
"position": [
-2688,
480
],
"parameters": {
"url": "https://api.jotform.com/form/YOUR_FORM_ID/files",
"options": {},
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "apiKey",
"value": "YOUR_JOTFORM_API_KEY_FOR_FILES"
}
]
}
},
"typeVersion": 4.2
},
{
"id": "6cc27de0-4bcf-4fc6-8bfc-27044cfa482d",
"name": "Obtener Archivo de Recibo",
"type": "n8n-nodes-base.httpRequest",
"position": [
-2272,
480
],
"parameters": {
"url": "={{ $json.lastFile.url.replace('http://','https://') }}",
"options": {
"response": {
"response": {
"responseFormat": "file"
}
}
}
},
"typeVersion": 4.2
},
{
"id": "a3580172-cbe7-41e3-9c8c-cf965050f75e",
"name": "Obtener Último Recibo",
"type": "n8n-nodes-base.code",
"position": [
-2480,
480
],
"parameters": {
"jsCode": "// Access the array that contains all files\n// Adjust the path if necessary (e.g., $json.content or $json.files)\nconst files = $json.files || $json.content || [];\n\n// If it's a dictionary of answers, flatten all URLs\nlet allUrls = [];\nif (!Array.isArray(files)) {\n // if it’s a Jotform structure like answers -> each -> answer:[urls]\n const answers = files.answers || files.data?.answers || {};\n for (const key of Object.keys(answers)) {\n const a = answers[key]?.answer;\n if (Array.isArray(a)) allUrls.push(...a);\n }\n} else {\n allUrls = files;\n}\n\n// Take the last file\nconst lastFile = allUrls[allUrls.length - 1] || null;\n\n// Return it as a single field\nreturn [{ json: { lastFile } }];\n"
},
"typeVersion": 2
},
{
"id": "12f9b49f-e973-4e2e-afa0-63b2488becc0",
"name": "Analizador de Salida Estructurada",
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
"position": [
-1424,
752
],
"parameters": {
"jsonSchemaExample": "{\n \"store_name\": \"\",\n \"purchase_date\": \"\",\n \"products\": [\n {\n \"product_name\": \"\",\n \"quantity\": 0,\n \"unit_price\": 0,\n \"total_price\": 0,\n \"cashback_amount\": 0\n }\n ],\n \"total_cashback\": 0\n}\n"
},
"typeVersion": 1.3
},
{
"id": "1aee2b39-2516-48ec-8b24-2565eb6974ce",
"name": "Agente de IA",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
-1616,
480
],
"parameters": {
"text": "=You are an intelligent assistant for XQ Pharma.\n\nYou receive OCR text extracted from a customer's purchase receipt.\nThe text may include both Arabic and English, with missing spaces, symbols, or repeated lines.\n\n### STEP 1 — Clean and Organize\nClean and rewrite the OCR text in a clear, structured way:\n- Combine broken lines that belong to the same sentence or product.\n- Remove repeating symbols, dots, commas, or words.\n- Normalize Arabic (اكس كيو) and English (XQ) text forms.\n- Try to create a simple, readable “receipt” view with one product per line.\n\n### STEP 2 — Identify XQ Pharma Products\n- Find all products that belong to XQ Pharma (look for \"XQ\", \"اكس كيو\", or variants like \"اكس ك\").\n- Rebuild product lines if necessary (for example, join “كريم اكس” + “كيو مرطب” = “كريم اكس كيو مرطب”).\n- For each product line, detect nearby numbers that look like prices.\n\n### STEP 3 — Extract Data\nExtract:\n- store_name\n- purchase_date\n- products → a list of all identified XQ Pharma items, each with:\n - product_name \n - quantity (default 1 if missing)\n - unit_price (try to find numbers following the product name)\n - total_price (quantity × unit_price if not listed)\n - cashback_amount (10% of total_price)\n- total_cashback = sum of cashback_amount values\n\nIf any value is missing, infer it logically (for example, assume total_price = unit_price if only one quantity).\n\n### STEP 4 — Output\nReturn **only** a valid JSON in this exact structure (no text or notes before or after):\n\n{\n \"store_name\": \"\",\n \"purchase_date\": \"\",\n \"products\": [\n {\n \"product_name\": \"\",\n \"quantity\": ,\n \"unit_price\": ,\n \"total_price\": ,\n \"cashback_amount\": \n }\n ],\n \"total_cashback\": \n}\n\n### OCR Text Input:\n{{ $json.ParsedResults[0].ParsedText }}\n",
"options": {},
"promptType": "define",
"hasOutputParser": true
},
"typeVersion": 2.2
},
{
"id": "29d1089d-f09b-4380-a9fd-20c79bb16b4e",
"name": "Correo al Cliente",
"type": "n8n-nodes-base.gmail",
"position": [
-656,
224
],
"webhookId": "YOUR_GMAIL_WEBHOOK_ID",
"parameters": {
"sendTo": "={{ $('JotForm Trigger').item.json['E-mail'] }}",
"message": "=🎉 Congratulations! You’ve earned a cashback reward 🎁\n\n🗓️ Purchase Date: {{ $('AI Agent').item.json.output.purchase_date }}\n🏬 Store: {{ $('AI Agent').item.json.output.store_name }}\n\n🧴 Products Purchased:\n{{ $node['AI Agent'].json[\"output\"][\"products\"].map(p => `• ${p.product_name} — Cashback: ${p.cashback_amount} EGP`).join('\\n') }}\n\n💰 Total Cashback Earned: {{ $('AI Agent').item.json.output.total_cashback }} EGP 🎉\n\nYour cashback will be added to your wallet within 24 hours.\nThank you for your purchase 💙\n",
"options": {},
"subject": "Cashback",
"emailType": "text"
},
"typeVersion": 2.1
},
{
"id": "f4e533e6-db38-48aa-acb6-544b16a6a915",
"name": "Correo de Marketing",
"type": "n8n-nodes-base.gmail",
"position": [
-656,
496
],
"webhookId": "YOUR_GMAIL_WEBHOOK_ID",
"parameters": {
"sendTo": "=Marketing@yourcompany.com",
"message": "=📢 Cashback Notification – New Reward Granted 🎉\n\n🗓️ Purchase Date: {{ $('AI Agent').item.json.output.purchase_date }}\n🏬 Store: {{ $('AI Agent').item.json.output.store_name }}\n\n🧾 Products Purchased:\n{{ $node['AI Agent'].json[\"output\"][\"products\"].map(p => `• ${p.product_name} — Cashback: ${p.cashback_amount} EGP`).join('\\n') }}\n\nCustomer name : {{ $('JotForm Trigger').item.json['Full Name'].first }} {{ $('JotForm Trigger').item.json['Full Name'].last }}\nCustomer Email: {{ $('JotForm Trigger').item.json['E-mail'] }}\nCustomer Phone Number: {{ $('JotForm Trigger').item.json['Contact Number'].full }}\n\n\n💰 Total Cashback Issued: {{ $('AI Agent').item.json.output.total_cashback }} EGP\n\n✅ Status: Cashback confirmation message sent to customer.\nPlease ensure this transaction is logged in the campaign tracking sheet.\n",
"options": {},
"subject": "Cashback Notification - New Reward",
"emailType": "text"
},
"typeVersion": 2.1
},
{
"id": "e4f93b36-e5df-4e62-a7c1-2565459d49f8",
"name": "Agregar Información a Base de Datos",
"type": "n8n-nodes-base.notion",
"position": [
-944,
384
],
"parameters": {
"options": {},
"resource": "databasePage",
"databaseId": {
"__rl": true,
"mode": "list",
"value": "YOUR_NOTION_DATABASE_ID",
"cachedResultUrl": "https://www.notion.so/YOUR_NOTION_DATABASE_ID",
"cachedResultName": "Cashback"
},
"propertiesUi": {
"propertyValues": [
{
"key": "Customer name|title",
"title": "={{ $('JotForm Trigger').item.json['Full Name'].first }} {{ $('JotForm Trigger').item.json['Full Name'].last }}"
},
{
"key": "Customer Email|email",
"emailValue": "={{ $('JotForm Trigger').item.json['E-mail'] }}"
},
{
"key": "Store Type|rich_text",
"textContent": "={{ $('JotForm Trigger').item.json['Purchase Channel'] }}"
},
{
"key": "Store Name|rich_text",
"textContent": "={{ $('JotForm Trigger').item.json['Store Name'] }}"
},
{
"key": "Cashback Amount|number",
"numberValue": "={{ $json.output.total_cashback }}"
}
]
}
},
"typeVersion": 2.2
},
{
"id": "e20517ed-2f08-4b8b-bf81-41cd7fb23eea",
"name": "¿Hay Reembolso?",
"type": "n8n-nodes-base.if",
"position": [
-1216,
480
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "329c2481-24e8-4871-8035-813bc48f82f2",
"operator": {
"type": "number",
"operation": "gt"
},
"leftValue": "={{ $json.output.total_cashback }}",
"rightValue": 0
}
]
}
},
"typeVersion": 2.2
},
{
"id": "36c305f5-efa7-4849-9f1e-1c384f8c4833",
"name": "Convertir Imagen a base64",
"type": "n8n-nodes-base.extractFromFile",
"position": [
-2064,
480
],
"parameters": {
"options": {},
"operation": "binaryToPropery",
"destinationKey": "imageBase64"
},
"typeVersion": 1
},
{
"id": "7199729e-da73-4c70-a0a2-6a67815a890b",
"name": "Nota Adhesiva",
"type": "n8n-nodes-base.stickyNote",
"position": [
-3008,
400
],
"parameters": {
"color": 3,
"width": 272,
"content": "Starts the workflow upon form submission; provides customer and initial purchase data."
},
"typeVersion": 1
},
{
"id": "b8601130-a266-4e72-af38-bd759db0457f",
"name": "Nota Adhesiva1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-2720,
400
],
"parameters": {
"color": 4,
"width": 176,
"content": "Requests the list of all uploaded receipt files from the JotForm API."
},
"typeVersion": 1
},
{
"id": "2db6bf7f-be22-4476-bb72-2d5ad7ae16bc",
"name": "Nota Adhesiva2",
"type": "n8n-nodes-base.stickyNote",
"position": [
-2528,
400
],
"parameters": {
"color": 5,
"width": 192,
"height": 176,
"content": "Extracts the URL for the most recently uploaded receipt from the file list.\n"
},
"typeVersion": 1
},
{
"id": "7c1b00ae-e1c9-495e-81ed-1adfd2f68317",
"name": "Nota Adhesiva3",
"type": "n8n-nodes-base.stickyNote",
"position": [
-2320,
400
],
"parameters": {
"color": 4,
"width": 176,
"height": 176,
"content": "Downloads the actual receipt image file using the extracted URL.\n"
},
"typeVersion": 1
},
{
"id": "2b3df853-ea8b-4d31-9299-776f78841213",
"name": "Nota Adhesiva4",
"type": "n8n-nodes-base.stickyNote",
"position": [
-2128,
400
],
"parameters": {
"color": 5,
"width": 208,
"height": 176,
"content": "Encodes the downloaded image into a base64 string, preparing it for OCR.\n"
},
"typeVersion": 1
},
{
"id": "c0e1412d-ad4d-4946-b831-521736cb267a",
"name": "Nota Adhesiva5",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1904,
400
],
"parameters": {
"color": 4,
"width": 192,
"height": 176,
"content": "Converts the receipt image into plain, readable text.\n"
},
"typeVersion": 1
},
{
"id": "85a4879c-6f96-4f97-be8f-80c14382a5e9",
"name": "Nota Adhesiva6",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1696,
400
],
"parameters": {
"color": 6,
"width": 368,
"content": "Uses Gemini to clean the raw OCR text, identify XQ products, and extract structured data like prices and cashback."
},
"typeVersion": 1
},
{
"id": "b6e73eed-0bba-47e4-9935-ab0bfb029f2f",
"name": "Nota Adhesiva7",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1280,
400
],
"parameters": {
"color": 5,
"width": 272,
"content": "A conditional check; it only allows the workflow to proceed if the calculated cashback is greater than zero.\n"
},
"typeVersion": 1
},
{
"id": "384f6f49-6402-4ebf-865f-1bd2bfdbfb84",
"name": "Nota Adhesiva8",
"type": "n8n-nodes-base.stickyNote",
"position": [
-992,
320
],
"parameters": {
"color": 4,
"width": 224,
"content": "Logs the customer details and the calculated cashback amount to a Notion database.\n"
},
"typeVersion": 1
},
{
"id": "00d037bc-7d84-4e71-b696-894de6e0a4f4",
"name": "Nota Adhesiva9",
"type": "n8n-nodes-base.stickyNote",
"position": [
-720,
160
],
"parameters": {
"color": 5,
"content": "Sends a confirmation email to the customer detailing their earned cashback reward.\n"
},
"typeVersion": 1
},
{
"id": "99b4585d-9f9a-4f88-93f2-8163fa3d7522",
"name": "Nota Adhesiva10",
"type": "n8n-nodes-base.stickyNote",
"position": [
-720,
416
],
"parameters": {
"color": 5,
"content": "Sends an internal email notification with all transaction details to the marketing team for tracking."
},
"typeVersion": 1
},
{
"id": "af05870d-bd52-4b37-9a54-f1e49ef16963",
"name": "Nota Adhesiva12",
"type": "n8n-nodes-base.stickyNote",
"position": [
-2992,
-368
],
"parameters": {
"width": 1024,
"height": 736,
"content": "# JotForm Setup Guide\n\n\n## ⚡ Step 1: Link with the Webhook\n\n\n* **1. Log in to your JotForm account, select your Cashback Form, and navigate to Settings.**\n\n* **2. Go to Integrations and search for Webhooks.**\n\n* **3. Paste the JotForm Trigger Webhook URL provided by your n8n workflow into the field.**\n\n* **4. Save and activate! Your form is now live!**\n\n## 🔑 Step 2: Unlock File Access (API Key)\n\n* **1.Generate a JotForm API Key in your JotForm account settings.**\n\n* **2.CRITICAL: Set the key permission level to \"Full Access\" (required for file downloads).**\n\n* **3.Go to your n8n workflow and insert this key into:**\n * **I.The JotForm Trigger node's credential.**\n * **II.The Fetch All Receipts node's query parameters.**\n\n## ⚙️ Step 3: Configure Your n8n Nodes\n\n* **In the JotForm Trigger node and the Fetch All Receipts node, replace the placeholder with your actual JotForm ID.**\n\n* **In the Notion node, update the Database ID so every cashback transaction is logged seamlessly.**"
},
"typeVersion": 1
}
],
"active": false,
"pinData": {
"AI Agent": [
{
"json": {
"output": {
"products": [
{
"quantity": 1,
"unit_price": 0,
"total_price": 0,
"product_name": "Placeholder Product 1",
"cashback_amount": 0
}
],
"store_name": "Placeholder Store Name",
"purchase_date": "YYYY-MM-DD",
"total_cashback": 0
}
}
}
],
"OCR.Space": [
{
"json": {
"OCRExitCode": 1,
"ParsedResults": [
{
"ParsedText": "OCR_TEXT_FROM_RECEIPT_GOES_HERE"
}
],
"IsErroredOnProcessing": false,
"ProcessingTimeInMilliseconds": "1000"
}
}
],
"JotForm Trigger": [
{
"json": {
"E-mail": "placeholder@example.com",
"Full Name": {
"last": "Placeholder Last Name",
"first": "Placeholder First Name"
},
"Store Name": "xq pharma",
"Purchase Date": {
"day": "09",
"year": "2025",
"month": "10"
},
"Contact Number": {
"full": "(000) 000-0000"
},
"Purchase Channel": "Online Store"
}
}
],
"Add info to Database": [
{
"json": {
"id": "PLACEHOLDER_NOTION_PAGE_ID",
"url": "https://www.notion.so/PLACEHOLDER_NOTION_PAGE_ID",
"name": "Placeholder Customer Name",
"property_store_name": "Placeholder Store Name",
"property_store_type": "Online Store",
"property_customer_name": "Placeholder Customer Name",
"property_customer_email": "placeholder@example.com",
"property_cashback_amount": 0
}
}
]
},
"settings": {
"executionOrder": "v1"
},
"versionId": "e1e2b6a4-b113-4c0b-9ac7-02c978c36323",
"connections": {
"1aee2b39-2516-48ec-8b24-2565eb6974ce": {
"main": [
[
{
"node": "e20517ed-2f08-4b8b-bf81-41cd7fb23eea",
"type": "main",
"index": 0
}
]
]
},
"6a8cba61-0195-44d7-a8e6-c6ab918918ab": {
"main": [
[
{
"node": "1aee2b39-2516-48ec-8b24-2565eb6974ce",
"type": "main",
"index": 0
}
]
]
},
"fafc18fe-9ffe-42d1-aa6e-16d2c44b0bab": {
"main": [
[
{
"node": "3794d88d-02db-4183-94f2-05d9cbcf8358",
"type": "main",
"index": 0
}
]
]
},
"a3580172-cbe7-41e3-9c8c-cf965050f75e": {
"main": [
[
{
"node": "6cc27de0-4bcf-4fc6-8bfc-27044cfa482d",
"type": "main",
"index": 0
}
]
]
},
"3794d88d-02db-4183-94f2-05d9cbcf8358": {
"main": [
[
{
"node": "a3580172-cbe7-41e3-9c8c-cf965050f75e",
"type": "main",
"index": 0
}
]
]
},
"6cc27de0-4bcf-4fc6-8bfc-27044cfa482d": {
"main": [
[
{
"node": "36c305f5-efa7-4849-9f1e-1c384f8c4833",
"type": "main",
"index": 0
}
]
]
},
"e20517ed-2f08-4b8b-bf81-41cd7fb23eea": {
"main": [
[
{
"node": "e4f93b36-e5df-4e62-a7c1-2565459d49f8",
"type": "main",
"index": 0
}
]
]
},
"e4f93b36-e5df-4e62-a7c1-2565459d49f8": {
"main": [
[
{
"node": "29d1089d-f09b-4380-a9fd-20c79bb16b4e",
"type": "main",
"index": 0
},
{
"node": "f4e533e6-db38-48aa-acb6-544b16a6a915",
"type": "main",
"index": 0
}
]
]
},
"36c305f5-efa7-4849-9f1e-1c384f8c4833": {
"main": [
[
{
"node": "6a8cba61-0195-44d7-a8e6-c6ab918918ab",
"type": "main",
"index": 0
}
]
]
},
"53c0d83e-9711-4b81-b738-70919a4c764e": {
"ai_languageModel": [
[
{
"node": "1aee2b39-2516-48ec-8b24-2565eb6974ce",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"12f9b49f-e973-4e2e-afa0-63b2488becc0": {
"ai_outputParser": [
[
{
"node": "1aee2b39-2516-48ec-8b24-2565eb6974ce",
"type": "ai_outputParser",
"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
¿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
Abdullah Alshiekh
@abdullah01🚀 Automation pro building AI-powered workflows with n8n. 💼 Special focus on real use cases 🔧 Love clean, flexible, and business-ready automations.
Compartir este flujo de trabajo