Legal document review is time-consuming, expensive, and requires specialized expertise. Small businesses and individuals often sign contracts without proper analysis due to high legal fees, exposing themselves to hidden risks, unfavorable clauses, and compliance violations.
The Challenge: Build a system that democratizes legal document analysis — allowing anyone to upload a contract and receive a professional-grade risk assessment instantly, without needing a law degree or expensive consultants.
Goal: Create an automated workflow that accepts PDFs via Telegram or Web, extracts and chunks text for large documents, analyzes content with GPT-4o, and returns a structured JSON risk report with actionable compliance recommendations.
The system uses n8n as the orchestration layer. PDFs are received via Telegram Bot API or Web interface, processed through text extraction, intelligently chunked for large documents, and analyzed by GPT-4o with a specialized legal prompt. Results are returned as structured JSON.
{
"document_type": "Service Agreement",
"overall_risk": "Medium",
"executive_summary": "Standard service contract with
several concerning liability clauses...",
"detected_risks": [
{
"clause": "Indemnification",
"severity": "High",
"location": "Section 8.2",
"issue": "Unlimited liability exposure",
"recommendation": "Cap liability at 12 months fees"
},
{
"clause": "Termination",
"severity": "Medium",
"location": "Section 12.1",
"issue": "Short notice period (15 days)",
"recommendation": "Negotiate minimum 30 days"
}
],
"compliance_flags": ["GDPR mention missing"],
"recommendation": "Review with legal counsel before signing"
}