Prep court hearing briefs and clash alerts with Google Sheets, OpenAI, WhatsApp and Telegram
Needs changesNeeds changes. This template uses 1 thing(s) that n8n 3.0 removes: AI Agent v1 (old agent modes). 1 breaking item(s) found. Static check, last run 2026-10-19.
What to replace before upgrading
| Removed in 3.0 | Replace with |
|---|---|
| AI Agent v1 (old agent modes) AI Hearing Prep Agent (v1.7) | Latest AI Agent node (Tools Agent). For SQL Agent, use a Postgres or MySQL tool with a recent AI Agent. |
Nodes used (16)
- Schedule Trigger
n8n-nodes-base.scheduleTrigger - Code
n8n-nodes-base.code - Google Sheets
n8n-nodes-base.googleSheets - HTTP Request
n8n-nodes-base.httpRequest - Switch
n8n-nodes-base.switch - Telegram
n8n-nodes-base.telegram - Extract from File
n8n-nodes-base.extractFromFile - Merge
n8n-nodes-base.merge - Loop Over Items (Split in Batches)
n8n-nodes-base.splitInBatches - OpenAI Chat Model
@n8n/n8n-nodes-langchain.lmChatOpenAi - AI Agent
@n8n/n8n-nodes-langchain.agent - Google Sheets Tool
n8n-nodes-base.googleSheetsTool - Structured Output Parser
@n8n/n8n-nodes-langchain.outputParserStructured - WhatsApp Business Cloud
n8n-nodes-base.whatsApp - Wait
n8n-nodes-base.wait - n8n Form Trigger
n8n-nodes-base.formTrigger
What it does
Quick overview This workflow schedules daily court-hearing preparation by pulling active cases from Google Sheets, downloading court cause lists via HTTP, extracting PDF/HTML text, matching listings, detecting advocate clashes, and using OpenAI to generate hearing briefs that are sent over WhatsApp or Telegram, with outcomes logged back to Google Sheets. How it works 1. Runs every evening at 7:00 PM IST to compute the next working hearing date and load active cases and court cause-list sources from Google Sheets. 2. Builds one download job per relevant court, fetches each cause list over HTTP, and alerts an admin on Telegram if any download fails. 3. Extracts text from the downloaded PDF or HTML cause lists and matches each active case against the normalized text to determine whether it is listed and capture item number, court hall, bench, and stage. 4. Checks the existing Hearing Log in Google Sheets to skip cases already reminded, estimates call times from item numbers, and flags potential scheduling clashes for advocates appearing in multiple courts or halls. 5. Sends a consolidated “partner board” summary to a partner on Telegram with all listed matters, clashes, missing listings, and any failed cause-list fetches. 6. For each listed (and not-yet-reminded) matter, uses an OpenAI agent with Google Sheets tools to read hearing history and case notes, generates a short structured brief, logs the hearing entry, and sends the reminder to the advocate via WhatsApp or Telegram. 7. Runs again at 8:30 AM on court days to send each advocate a day board from the Hearing Log, and accepts a post-hearing form submission to update the Hearing Log and case status/next date in Google Sheets while confirming the entry on Telegram. Setup 1. Create a Google Sheets file with “Cases”, “Courts”, “Hearing Log”, and “Case Notes” tabs and ensure the columns referenced by the workflow (for example caseid, status, courtcode, causelisturl, advocate contact fields, and logkey) exist. 2. Add credentials for Google Sheets, Telegram, OpenAI, and WhatsApp Business Cloud, and set the WhatsApp Phone Number ID used to send messages. 3. Replace all REPLACEWITH values, including the Google Sheet ID, Telegram chat IDs (admin and partner), WhatsApp phoneNumberId, and your n8n base URL used to build the outcome form link. 4. Populate the “Courts” tab with each court’s cause-list URL pattern (using placeholders like {DD}, {MM}, {YYYY}, or {DATEISO}) and set the expected format (pdf/html). 5. Copy the public URL for the “hearing-outcome” form and protect it (for example with n8n authentication) so only your team can submit hearing outcomes.