Automatyzacja n8n · Analiza dokumentow
Rozpoznaje tekst ze skanu przez OCR, a następnie pozwala zadawać pytania o treść dokumentu. Przydatne do szybkiej analizy dokumentów papierowych.
Przebieg
Te same kroki co w edytorze n8n, opisane po polsku. Kroki w jednym rzędzie działają równolegle.
Kliknij krok, żeby zobaczyć, co robi.
Workflow rusza, gdy inny system (formularz, CRM, skrypt) wyśle żądanie na adres webhooka.
Węzeł w n8n: Webhook
Uruchomienie
Potrzebujesz instancji n8n (w chmurze albo na własnym serwerze) i konta Gaius-Lex.
curl -X POST "https://<twoja-instancja-n8n>/webhook/ocr-qa" \
-F "data=@dokument.pdf" \
-F "question=…"Zastąp adres swoją instancją n8n, a wielokropki danymi ze sprawy.
n8n-nodes-gaius.{
"nodes": [
{
"parameters": {
"httpMethod": "POST",
"path": "ocr-qa",
"responseMode": "responseNode",
"options": {}
},
"id": "g9a",
"name": "Webhook",
"type": "n8n-nodes-base.webhook",
"typeVersion": 2,
"position": [
-800,
200
]
},
{
"parameters": {
"keepOnlySet": true,
"values": {
"string": [
{
"name": "question",
"value": "={{$json.body.question || 'Podsumuj tresc dokumentu'}}"
}
]
},
"options": {}
},
"id": "g9b",
"name": "Extract",
"type": "n8n-nodes-base.set",
"typeVersion": 2,
"position": [
-560,
200
]
},
{
"parameters": {
"operation": "ocrPollCreate",
"binaryFile": "data"
},
"id": "g9c",
"name": "OCR",
"type": "n8n-nodes-gaius.gaiusLex",
"typeVersion": 1,
"position": [
-320,
200
],
"credentials": {
"gaiusLexApi": {
"name": "Gaius-Lex account"
}
}
},
{
"parameters": {
"amount": 8,
"unit": "seconds"
},
"id": "g9d",
"name": "Wait OCR",
"type": "n8n-nodes-base.wait",
"typeVersion": 1.1,
"position": [
-80,
200
]
},
{
"parameters": {
"operation": "ocrPollGet",
"requestId": "={{$('OCR').item.json.request_id}}"
},
"id": "g9e",
"name": "Get OCR",
"type": "n8n-nodes-gaius.gaiusLex",
"typeVersion": 1,
"position": [
160,
200
],
"credentials": {
"gaiusLexApi": {
"name": "Gaius-Lex account"
}
}
},
{
"parameters": {
"conditions": {
"conditions": [
{
"leftValue": "={{$json.message}}",
"rightValue": "",
"operator": {
"type": "string",
"operation": "equals"
}
}
],
"combinator": "and"
}
},
"id": "g9f",
"name": "OCR Ready?",
"type": "n8n-nodes-base.if",
"typeVersion": 2,
"position": [
400,
200
]
},
{
"parameters": {
"operation": "answerPollCreate",
"question": "={{ 'Na podstawie tekstu: ' + $json.text + '\\n\\nPytanie: ' + $('Extract').item.json.question }}",
"simplify": false
},
"id": "g9g",
"name": "Ask Question",
"type": "n8n-nodes-gaius.gaiusLex",
"typeVersion": 1,
"position": [
640,
80
],
"credentials": {
"gaiusLexApi": {
"name": "Gaius-Lex account"
}
}
},
{
"parameters": {
"amount": 8,
"unit": "seconds"
},
"id": "g9h",
"name": "Wait Answer",
"type": "n8n-nodes-base.wait",
"typeVersion": 1.1,
"position": [
880,
80
]
},
{
"parameters": {
"operation": "answerPollGet",
"requestId": "={{$('Ask Question').item.json.request_id}}"
},
"id": "g9i",
"name": "Get Answer",
"type": "n8n-nodes-gaius.gaiusLex",
"typeVersion": 1,
"position": [
1120,
80
],
"credentials": {
"gaiusLexApi": {
"name": "Gaius-Lex account"
}
}
},
{
"parameters": {
"respondWith": "json",
"responseBody": "={{ JSON.stringify({ answer: $json.answer || $json.message }) }}",
"options": {}
},
"id": "g9j",
"name": "Respond",
"type": "n8n-nodes-base.respondToWebhook",
"typeVersion": 1,
"position": [
1360,
80
]
},
{
"parameters": {
"amount": 5,
"unit": "seconds"
},
"id": "g9k",
"name": "Wait Retry",
"type": "n8n-nodes-base.wait",
"typeVersion": 1.1,
"position": [
640,
320
]
}
],
"connections": {
"Webhook": {
"main": [
[
{
"node": "Extract",
"type": "main",
"index": 0
}
]
]
},
"Extract": {
"main": [
[
{
"node": "OCR",
"type": "main",
"index": 0
}
]
]
},
"OCR": {
"main": [
[
{
"node": "Wait OCR",
"type": "main",
"index": 0
}
]
]
},
"Wait OCR": {
"main": [
[
{
"node": "Get OCR",
"type": "main",
"index": 0
}
]
]
},
"Get OCR": {
"main": [
[
{
"node": "OCR Ready?",
"type": "main",
"index": 0
}
]
]
},
"OCR Ready?": {
"main": [
[
{
"node": "Ask Question",
"type": "main",
"index": 0
}
],
[
{
"node": "Wait Retry",
"type": "main",
"index": 0
}
]
]
},
"Ask Question": {
"main": [
[
{
"node": "Wait Answer",
"type": "main",
"index": 0
}
]
]
},
"Wait Answer": {
"main": [
[
{
"node": "Get Answer",
"type": "main",
"index": 0
}
]
]
},
"Get Answer": {
"main": [
[
{
"node": "Respond",
"type": "main",
"index": 0
}
]
]
},
"Wait Retry": {
"main": [
[
{
"node": "Get OCR",
"type": "main",
"index": 0
}
]
]
}
},
"meta": {
"templateCredsSetupCompleted": true
}
}Plik nie zawiera identyfikatorów poświadczeń; po imporcie n8n poprosi o podłączenie własnych kont.
Od autora
Janusz Marszałek · aktualizacja 10 maja 2026
Wyslij skan lub zdjecie dokumentu przez webhook razem z pytaniem. System najpierw rozpoznaje tekst przez OCR (polling az do wyniku), a następnie pyta Gaius-Lex Answer o treść na podstawie rozpoznanego tekstu.
Mozesz dodać wektoryzacje dokumentu po OCR dla trwalego Q&A, lub zmienić pytanie na automatyczna ekstrakcje klauzul.
Analiza dokumentow
Rozpoznaje tekst ze skanu przez OCR i wysyła wynik na Gmail. Wersja dla użytkowników Google Workspace.
Masowe OCR wielu dokumentów. Dzieli pliki na partie i przetwarza równolegle z opcjonalnym limitem prob.
OCR i Q&A ze Skanu
Załóż konto Gaius-Lex, podłącz je w n8n i sprawdź wynik na prawdziwej sprawie. Wdrożenie automatyzacji w zespole omówimy na rozmowie.