AutomationFlowsAI & RAG › Wf-leg-02 — Revisión Documental Ia V10v

Wf-leg-02 — Revisión Documental Ia V10v

WF-LEG-02 — Revisión Documental IA V10V. Uses moveBinaryData, httpRequest, openAi, slack. Webhook trigger; 12 nodes.

Webhook trigger★★★★☆ complexityAI-powered12 nodesMove Binary DataHTTP RequestOpenAISlack
AI & RAG Trigger: Webhook Nodes: 12 Complexity: ★★★★☆ AI nodes: yes Added:

This workflow follows the HTTP Request → OpenAI recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "name": "WF-LEG-02 \u2014 Revisi\u00f3n Documental IA V10V",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "wf-leg-02/revisar-contrato",
        "responseMode": "responseNode",
        "options": {
          "allowedOrigins": "*"
        }
      },
      "id": "1a2b3c4d-leg02-001",
      "name": "TRIGGER \u2014 Webhook PDF Upload",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        240,
        300
      ]
    },
    {
      "parameters": {
        "operation": "binaryToPropery",
        "sourceProperty": "data",
        "destinationProperty": "pdf_binary"
      },
      "id": "2a2b3c4d-leg02-002",
      "name": "EXTRACT \u2014 Parse Binary PDF",
      "type": "n8n-nodes-base.moveBinaryData",
      "typeVersion": 1,
      "position": [
        440,
        300
      ]
    },
    {
      "parameters": {
        "url": "={{ $env.V10V_API_URL }}/api/wf-leg-02/extract-clauses",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer {{ $env.V10V_API_KEY }}"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        },
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "pdf_base64",
              "value": "={{ Buffer.from($binary.pdf_binary.data, 'base64').toString('base64') }}"
            },
            {
              "name": "contract_type",
              "value": "={{ $json.contract_type || 'servicios' }}"
            },
            {
              "name": "client_id",
              "value": "={{ $json.client_id }}"
            }
          ]
        },
        "options": {
          "timeout": 60000
        }
      },
      "id": "3a2b3c4d-leg02-003",
      "name": "AI/ML \u2014 Extract Clauses (V10V API)",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4,
      "position": [
        640,
        300
      ]
    },
    {
      "parameters": {
        "url": "={{ $env.V10V_API_URL }}/api/wf-leg-02/baseline-check",
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "client_id",
              "value": "={{ $json.client_id }}"
            },
            {
              "name": "contract_type",
              "value": "={{ $json.contract_type || 'servicios' }}"
            }
          ]
        },
        "options": {}
      },
      "id": "4a2b3c4d-leg02-004",
      "name": "DATA \u2014 Baseline Check (hist\u00f3rico cliente)",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4,
      "position": [
        640,
        480
      ]
    },
    {
      "parameters": {
        "resource": "chat",
        "operation": "message",
        "model": "gpt-4o",
        "messages": {
          "values": [
            {
              "role": "system",
              "content": "Eres un abogado senior especializado en revisi\u00f3n de contratos comerciales. Tu tarea es analizar las cl\u00e1usulas extra\u00eddas de un contrato y generar un informe de riesgo detallado.\n\nPLANTILLA DE CONTRATO SEGURA (cl\u00e1usulas m\u00ednimas requeridas):\n- Objeto del contrato: claro y delimitado\n- Precio y forma de pago: especificado en \u20ac, plazos definidos\n- Duraci\u00f3n y terminaci\u00f3n: plazo inicial + preaviso m\u00ednimo 30 d\u00edas\n- Penalizaciones: proporcionales, m\u00e1ximo 20% del contrato\n- Responsabilidad limitada: cl\u00e1usula de limitaci\u00f3n a importe contratado\n- Protecci\u00f3n datos (GDPR): rol responsable/encargado definido\n- Jurisdicci\u00f3n: tribunales espa\u00f1oles, ley espa\u00f1ola\n- Confidencialidad: 2-5 a\u00f1os post-contrato\n- Propiedad intelectual: titularidad clara\n\nCLASIFICACI\u00d3N DE RIESGO:\n- BAJO: todas las cl\u00e1usulas m\u00ednimas presentes, sin desviaciones materiales\n- MEDIO: 1-3 cl\u00e1usulas ausentes o con desviaciones menores\n- ALTO: 4+ cl\u00e1usulas ausentes, cl\u00e1usulas abusivas, o exposici\u00f3n legal significativa\n- CR\u00cdTICO: cl\u00e1usulas nulas por ley, penalizaciones desproporcionadas, o ausencia de GDPR\n\nResponde SIEMPRE en JSON con este schema exacto."
            },
            {
              "role": "user",
              "content": "=CL\u00c1USULAS EXTRA\u00cdDAS DEL CONTRATO:\n{{ JSON.stringify($('AI/ML \u2014 Extract Clauses (V10V API)').item.json.clauses, null, 2) }}\n\nTIPO DE CONTRATO: {{ $('AI/ML \u2014 Extract Clauses (V10V API)').item.json.contract_type }}\n\nHIST\u00d3RICO DEL CLIENTE:\n{{ JSON.stringify($('DATA \u2014 Baseline Check (hist\u00f3rico cliente)').item.json, null, 2) }}\n\nGenera el informe de riesgo completo en JSON con el siguiente schema:\n{\n  \"risk_level\": \"BAJO|MEDIO|ALTO|CR\u00cdTICO\",\n  \"risk_score\": 0-100,\n  \"summary\": \"string (2-3 l\u00edneas)\",\n  \"clauses_found\": [{ \"name\": \"string\", \"status\": \"OK|MISSING|DEFICIENT|ABUSIVE\", \"text\": \"string\", \"comment\": \"string\" }],\n  \"missing_clauses\": [\"string\"],\n  \"red_flags\": [\"string\"],\n  \"recommended_actions\": [{ \"priority\": \"URGENT|HIGH|MEDIUM\", \"action\": \"string\", \"clause\": \"string\" }],\n  \"auto_sign_eligible\": boolean,\n  \"review_time_minutes\": 4,\n  \"baseline_comparison\": { \"previous_contracts\": number, \"average_risk\": \"string\", \"trend\": \"string\" }\n}"
            }
          ]
        },
        "options": {
          "maxTokens": 4000,
          "temperature": 0.1
        }
      },
      "id": "5a2b3c4d-leg02-005",
      "name": "AI/ML \u2014 Risk Analysis GPT-4o",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "typeVersion": 1,
      "position": [
        840,
        380
      ]
    },
    {
      "parameters": {
        "jsCode": "const raw = $input.first().json.message?.content || '{}';\nlet report;\ntry {\n  const match = raw.match(/\\{[\\s\\S]*\\}/);\n  report = JSON.parse(match ? match[0] : raw);\n} catch(e) {\n  report = { risk_level: 'ERROR', risk_score: -1, summary: 'Error parsing AI response', error: raw };\n}\n\n// Enrich with metadata\nreport.workflow_id = 'WF-LEG-02';\nreport.version = 'V10V-2026';\nreport.processed_at = new Date().toISOString();\nreport.client_id = $('TRIGGER \u2014 Webhook PDF Upload').first().json.client_id;\nreport.contract_type = $('AI/ML \u2014 Extract Clauses (V10V API)').first().json.contract_type;\nreport.pages_analyzed = $('AI/ML \u2014 Extract Clauses (V10V API)').first().json.pages || 0;\nreport.clauses_analyzed = ($('AI/ML \u2014 Extract Clauses (V10V API)').first().json.clauses || []).length;\n\n// Routing decision\nreport.route = report.risk_level === 'BAJO' && report.auto_sign_eligible ? 'AUTO_SIGN' : \n               report.risk_level === 'CR\u00cdTICO' ? 'URGENT_REVIEW' : 'STANDARD_REVIEW';\n\nreturn [{ json: report }];"
      },
      "id": "6a2b3c4d-leg02-006",
      "name": "LOGIC \u2014 Parse & Route Risk Report",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1040,
        380
      ]
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict"
          },
          "conditions": [
            {
              "id": "route-auto-sign",
              "leftValue": "={{ $json.route }}",
              "rightValue": "AUTO_SIGN",
              "operator": {
                "type": "string",
                "operation": "equals"
              }
            }
          ]
        },
        "combineConditions": "all"
      },
      "id": "7a2b3c4d-leg02-007",
      "name": "LOGIC \u2014 Route: Auto-sign?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [
        1240,
        300
      ]
    },
    {
      "parameters": {
        "url": "={{ $env.V10V_API_URL }}/api/wf-leg-02/auto-sign",
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "client_id",
              "value": "={{ $json.client_id }}"
            },
            {
              "name": "contract_type",
              "value": "={{ $json.contract_type }}"
            },
            {
              "name": "risk_score",
              "value": "={{ $json.risk_score }}"
            },
            {
              "name": "report",
              "value": "={{ JSON.stringify($json) }}"
            }
          ]
        }
      },
      "id": "8a2b3c4d-leg02-008",
      "name": "ACTION \u2014 Auto-sign via DocuSign/PandaDoc",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4,
      "position": [
        1440,
        200
      ]
    },
    {
      "parameters": {
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "slackApi",
        "resource": "message",
        "channel": "={{ $env.SLACK_LEGAL_CHANNEL }}",
        "text": "=\u26a0\ufe0f *REVISI\u00d3N DOCUMENTAL REQUERIDA* \u2014 WF-LEG-02\n\n*Cliente:* {{ $json.client_id }}\n*Tipo:* {{ $json.contract_type }}\n*Riesgo:* {{ $json.risk_level }} (Score: {{ $json.risk_score }}/100)\n*Cl\u00e1usulas analizadas:* {{ $json.clauses_analyzed }}\n*Tiempo de an\u00e1lisis:* 4 minutos\n\n*Resumen:*\n{{ $json.summary }}\n\n*Red Flags:*\n{{ ($json.red_flags || []).map(f => '\u2022 ' + f).join('\\n') }}\n\n*Acciones recomendadas:*\n{{ ($json.recommended_actions || []).filter(a => a.priority === 'URGENT' || a.priority === 'HIGH').map(a => `\ud83d\udd34 ${a.action}`).join('\\n') }}\n\n*Ver informe completo:* {{ $env.V10V_DASHBOARD_URL }}/legal/reports/{{ $json.client_id }}",
        "options": {
          "unfurl_links": false
        }
      },
      "id": "9a2b3c4d-leg02-009",
      "name": "ACTION \u2014 Slack Alert (Riesgo ALTO/CR\u00cdTICO)",
      "type": "n8n-nodes-base.slack",
      "typeVersion": 2.2,
      "position": [
        1440,
        380
      ]
    },
    {
      "parameters": {
        "url": "={{ $env.V10V_API_URL }}/api/wf-leg-02/save-report",
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "report",
              "value": "={{ JSON.stringify($json) }}"
            }
          ]
        }
      },
      "id": "10a2b3c4d-leg02-010",
      "name": "DATA \u2014 Save Report + Audit Log (GDPR)",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4,
      "position": [
        1440,
        560
      ]
    },
    {
      "parameters": {
        "url": "={{ $env.V10V_API_URL }}/api/wf-leg-02/feedback",
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "client_id",
              "value": "={{ $json.client_id }}"
            },
            {
              "name": "risk_level",
              "value": "={{ $json.risk_level }}"
            },
            {
              "name": "risk_score",
              "value": "={{ $json.risk_score }}"
            },
            {
              "name": "route",
              "value": "={{ $json.route }}"
            },
            {
              "name": "execution_time_ms",
              "value": "={{ Date.now() }}"
            },
            {
              "name": "clauses_count",
              "value": "={{ $json.clauses_analyzed }}"
            }
          ]
        }
      },
      "id": "11a2b3c4d-leg02-011",
      "name": "BASELINE \u2014 Feedback & Metrics",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4,
      "position": [
        1640,
        480
      ]
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "={{ JSON.stringify({\n  success: true,\n  risk_level: $('LOGIC \u2014 Parse & Route Risk Report').first().json.risk_level,\n  risk_score: $('LOGIC \u2014 Parse & Route Risk Report').first().json.risk_score,\n  route: $('LOGIC \u2014 Parse & Route Risk Report').first().json.route,\n  summary: $('LOGIC \u2014 Parse & Route Risk Report').first().json.summary,\n  report_url: $env.V10V_DASHBOARD_URL + '/legal/reports/' + $('TRIGGER \u2014 Webhook PDF Upload').first().json.client_id,\n  processed_at: new Date().toISOString(),\n  review_time_minutes: 4\n}) }}"
      },
      "id": "12a2b3c4d-leg02-012",
      "name": "RESPOND \u2014 Return Risk Report",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1,
      "position": [
        1840,
        300
      ]
    }
  ],
  "connections": {
    "TRIGGER \u2014 Webhook PDF Upload": {
      "main": [
        [
          {
            "node": "EXTRACT \u2014 Parse Binary PDF",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "EXTRACT \u2014 Parse Binary PDF": {
      "main": [
        [
          {
            "node": "AI/ML \u2014 Extract Clauses (V10V API)",
            "type": "main",
            "index": 0
          },
          {
            "node": "DATA \u2014 Baseline Check (hist\u00f3rico cliente)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI/ML \u2014 Extract Clauses (V10V API)": {
      "main": [
        [
          {
            "node": "AI/ML \u2014 Risk Analysis GPT-4o",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "DATA \u2014 Baseline Check (hist\u00f3rico cliente)": {
      "main": [
        [
          {
            "node": "AI/ML \u2014 Risk Analysis GPT-4o",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI/ML \u2014 Risk Analysis GPT-4o": {
      "main": [
        [
          {
            "node": "LOGIC \u2014 Parse & Route Risk Report",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "LOGIC \u2014 Parse & Route Risk Report": {
      "main": [
        [
          {
            "node": "LOGIC \u2014 Route: Auto-sign?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "LOGIC \u2014 Route: Auto-sign?": {
      "main": [
        [
          {
            "node": "ACTION \u2014 Auto-sign via DocuSign/PandaDoc",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "ACTION \u2014 Slack Alert (Riesgo ALTO/CR\u00cdTICO)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ACTION \u2014 Auto-sign via DocuSign/PandaDoc": {
      "main": [
        [
          {
            "node": "DATA \u2014 Save Report + Audit Log (GDPR)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ACTION \u2014 Slack Alert (Riesgo ALTO/CR\u00cdTICO)": {
      "main": [
        [
          {
            "node": "DATA \u2014 Save Report + Audit Log (GDPR)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "DATA \u2014 Save Report + Audit Log (GDPR)": {
      "main": [
        [
          {
            "node": "BASELINE \u2014 Feedback & Metrics",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "BASELINE \u2014 Feedback & Metrics": {
      "main": [
        [
          {
            "node": "RESPOND \u2014 Return Risk Report",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1",
    "saveManualExecutions": true,
    "callerPolicy": "workflowsFromSameOwner",
    "errorWorkflow": "wf-error-handler"
  },
  "staticData": null,
  "tags": [
    {
      "name": "v10v-certified"
    },
    {
      "name": "legal"
    },
    {
      "name": "document-review"
    },
    {
      "name": "gpt-4o"
    },
    {
      "name": "roi-documented"
    }
  ],
  "meta": {
    "description": "WF-LEG-02: Revisi\u00f3n Documental IA \u2014 PDF \u2192 extrae 15+ cl\u00e1usulas \u2192 compara contra plantilla segura \u2192 genera informe de riesgo BAJO/MEDIO/ALTO/CR\u00cdTICO en 4 minutos. ROI: 80 contratos/mes \u00d7 8h \u00d7 \u20ac25/h = \u20ac16.000 coste manual \u2192 \u20ac397/mes con V10V. Payback inmediato.",
    "roi_data": {
      "manual_cost_per_contract_hours": 8,
      "manual_hourly_rate_eur": 25,
      "contracts_per_month_typical": 80,
      "manual_monthly_cost_eur": 16000,
      "workflow_monthly_cost_eur": 397,
      "monthly_savings_eur": 15603,
      "roi_percentage": 3929,
      "review_time_minutes": 4,
      "auto_sign_eligible_percentage": 40,
      "payback_days": 1
    },
    "tech_stack": {
      "trigger": "Webhook (POST multipart/form-data)",
      "ai_extraction": "V10V API (PyMuPDF + spaCy NER)",
      "ai_analysis": "GPT-4o (structured output)",
      "signing": "DocuSign / PandaDoc API",
      "alerts": "Slack",
      "storage": "V10V API (PostgreSQL + S3)",
      "audit": "GDPR-compliant audit log"
    },
    "target_client": "Despachos 5-50 abogados, Legal Ops Managers, CFOs con +20 contratos/mes",
    "price_administered": "\u20ac397/mes (hasta 100 contratos/mes)"
  }
}
Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

WF-LEG-02 — Revisión Documental IA V10V. Uses moveBinaryData, httpRequest, openAi, slack. Webhook trigger; 12 nodes.

Source: https://github.com/cerebrov10v-eng/marketinai-workflows-public/blob/200f12ed0b8d2e6c2e3deaed73456c746b87a0eb/workflows/WF-LEG-02_Revision_Documental_IA.json — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

Venafi Presentation - Watch Video

Venafi Tls Protect Cloud, HTTP Request, OpenAI +1
AI & RAG

Automatically detects missed Zoom demos booked via Calendly and triggers AI-powered follow-up sequences.

HTTP Request, OpenAI, Email Send +3
AI & RAG

AI-Powered Fake Review Detection Workflow Using n8n & Airtable. Uses httpRequest, airtable, openAi, slack. Webhook trigger; 27 nodes.

HTTP Request, Airtable, OpenAI +1
AI & RAG

This workflow automates the end-to-end process of scheduling technical or behavioral interviews. It captures interview data via Webhook, creates a Google Calendar event with an integrated Google Meet

Google Calendar, OpenAI, Gmail +2
AI & RAG

This workflow automatically scores and categorizes new GoHighLevel contacts using AI (GPT-4), then tags and assigns them to the appropriate team member based on their score. Hot leads also trigger a S

HTTP Request, OpenAI, Slack