AutomationFlowsSlack & Telegram › Manage Legal Client Intake and Consultations with Telegram, Openai and Google

Manage Legal Client Intake and Consultations with Telegram, Openai and Google

ByRahul Joshi @rahul08 on n8n.io

This workflow handles legal client intake via Telegram, uses OpenAI (gpt-4o-mini) to classify the case and send a matching document checklist, logs cases in Google Sheets, schedules a consultation in Google Calendar, sends Telegram confirmations, and posts Slack alerts for…

Event trigger★★★★★ complexityAI-powered37 nodesTelegram TriggerOpenAITelegramGoogle SheetsGoogle CalendarError TriggerSlack
Slack & Telegram Trigger: Event Nodes: 37 Complexity: ★★★★★ AI nodes: yes Added:
Manage Legal Client Intake and Consultations with Telegram, Openai and Google — n8n workflow card showing Telegram Trigger, OpenAI, Telegram integration

This workflow corresponds to n8n.io template #17679 — we link there as the canonical source.

This workflow follows the Error Trigger → Google Sheets 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
{
  "id": "spw3wcWp5GLXudB1",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "AI Legal Client Intake & Consultation Management System",
  "tags": [],
  "nodes": [
    {
      "id": "bc08d042-b0ed-42d8-ac78-fc346ee704cc",
      "name": "\ud83d\udccc Overview \u2013 How This Workflow Works",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -3024,
        -592
      ],
      "parameters": {
        "color": 2,
        "width": 928,
        "height": 684,
        "content": "## \u2696\ufe0f LegalOS \u2013 AI Legal Intake & Case Management\n\n### How it works\nA client messages the law firm's Telegram bot describing their legal issue. GPT-4o-mini classifies the case as property, family, criminal, or other, then sends the matching document checklist back to the client automatically. The case is logged to Google Sheets, a consultation is created in Google Calendar, and both the lawyer and the client receive a Telegram confirmation.\n\nTwo daily schedules run in the background: one at 10 AM reminds any client with a pending fee, and one at 3 PM sends follow-up messages to cases that haven't been contacted yet. Both loops mark their records after sending to avoid duplicate outreach.\n\n### Setup steps\n1. Connect your **Telegram Bot API** credential to all Telegram nodes.\n2. Connect your **OpenAI API** credential to the classification node.\n3. Connect **Google Sheets OAuth2** and create a spreadsheet with a `Cases` tab using the column names in the Log node mapping.\n4. Replace `YOUR_GOOGLE_SHEET_ID` in all four Google Sheets nodes.\n5. Connect **Google Calendar OAuth2** and update the calendar field in the consultation event node to your firm's calendar address.\n6. Replace the hardcoded lawyer Telegram chat ID in the Notify Lawyer, Send Fee Reminder, and Send Follow-up Message nodes with `{{ $json.chat_id }}` or your actual bot's chat routing.\n7. Connect **Slack OAuth2** and replace `YOUR_SLACK_CHANNEL_ID` in the error alert nodes.\n8. Activate the Telegram trigger and both schedule triggers."
      },
      "typeVersion": 1
    },
    {
      "id": "262051a3-a880-4d20-a229-02af99dca47e",
      "name": "Section \u2013 Intake & AI Classification",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1856,
        32
      ],
      "parameters": {
        "color": 7,
        "width": 1376,
        "height": 552,
        "content": "## \ud83d\udce5 Client Intake & AI Case Classification\nClient sends a message, GPT-4o-mini classifies it into property, family, criminal, or other, and the result is parsed and routed to the correct checklist branch. Confidence score and a one-line summary are extracted for logging."
      },
      "typeVersion": 1
    },
    {
      "id": "6a53b3f0-592d-42ee-8e64-360dd99f70d5",
      "name": "Section \u2013 Checklist Dispatch",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -384,
        -352
      ],
      "parameters": {
        "color": 7,
        "width": 500,
        "height": 1140,
        "content": "## \ud83d\udccb Checklist Dispatch\nFour pre-written document checklists \u2014 property, family, criminal, and a fallback. Each branch sets the appropriate text so the downstream Telegram node can send it without any conditional logic."
      },
      "typeVersion": 1
    },
    {
      "id": "609868a2-0c1c-4cae-afc7-e5030a9d0790",
      "name": "Section \u2013 Logging, Calendar & Notifications",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        288,
        16
      ],
      "parameters": {
        "color": 7,
        "width": 1188,
        "height": 660,
        "content": "## \ud83d\udcc5 Logging, Calendar & Notifications\nSends the checklist to the client, appends a new case row to Google Sheets, creates a consultation slot in Google Calendar, and fires two parallel Telegram messages \u2014 one to the lawyer with intake details and one to the client with their booking confirmation."
      },
      "typeVersion": 1
    },
    {
      "id": "c485202e-d335-4e7f-8cd4-22c0bd04d678",
      "name": "Section \u2013 Daily Fee Reminders",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -608,
        864
      ],
      "parameters": {
        "color": 7,
        "width": 1764,
        "height": 424,
        "content": "## \ud83d\udcb3 Daily Fee Reminders\nRuns at 10 AM. Reads all cases with fee_status = Pending, loops through each one, sends a Telegram reminder, and marks the record as followup sent so it isn't re-sent the next day."
      },
      "typeVersion": 1
    },
    {
      "id": "98094155-0153-45c7-ae95-8cb37b0a27fe",
      "name": "Section \u2013 Daily Client Follow-ups",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -576,
        1328
      ],
      "parameters": {
        "color": 7,
        "width": 1732,
        "height": 424,
        "content": "## \ud83d\udcec Daily Client Follow-ups\nRuns at 3 PM. Reads all cases with follow_up_sent = No, loops through each, sends a check-in message about next steps, then marks follow_up_sent = yes so the same client isn't messaged again."
      },
      "typeVersion": 1
    },
    {
      "id": "65328209-1f6a-4f99-9c07-24b2a5a0e0fb",
      "name": "Section \u2013 Error Handling",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1488,
        688
      ],
      "parameters": {
        "color": 7,
        "width": 684,
        "height": 632,
        "content": "## \u26a0\ufe0f Error Handling\nTwo error paths: the workflow-level error trigger catches any node failure globally; the AI node's error output catches classification failures specifically. Both route to Slack. Update the alert message to include context before going live."
      },
      "typeVersion": 1
    },
    {
      "id": "3ab33154-2556-45f2-b960-ab9c84a6879e",
      "name": "\ud83d\udd11 Credentials & Security",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1536,
        528
      ],
      "parameters": {
        "color": 3,
        "width": 476,
        "height": 438,
        "content": "## \ud83d\udd11 Credentials Required\n- **Telegram Bot API** \u2014 all Telegram nodes\n- **OpenAI API** \u2014 AI classification node\n- **Google Sheets OAuth2** \u2014 case log\n- **Google Calendar OAuth2** \u2014 consultation events\n- **Slack OAuth2** \u2014 error alerts\n\nNever hardcode chat IDs, sheet IDs, or personal credential names in shared templates."
      },
      "typeVersion": 1
    },
    {
      "id": "5e9c69d5-6b11-4378-a27f-c82283e93662",
      "name": "Client Message via Telegram",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        -1760,
        288
      ],
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "750dc149-e1a9-4c43-926c-d3ed952d1dc2",
      "name": "Extract Client Info",
      "type": "n8n-nodes-base.set",
      "position": [
        -1520,
        288
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "a1",
              "name": "chatId",
              "type": "string",
              "value": "={{ $json.message.chat.id }}"
            },
            {
              "id": "a2",
              "name": "clientName",
              "type": "string",
              "value": "={{ $json.message.chat.first_name }} {{ $json.message.chat.last_name || '' }}"
            },
            {
              "id": "a3",
              "name": "messageText",
              "type": "string",
              "value": "={{ $json.message.text }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "65392f66-e7d6-406d-9b2c-d7f80a7cffc5",
      "name": "AI \u2013 Classify Legal Case",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "onError": "continueErrorOutput",
      "position": [
        -1328,
        288
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini",
          "cachedResultName": "GPT-4O-MINI"
        },
        "options": {},
        "responses": {
          "values": [
            {
              "content": "==Client message: {{ $json.messageText }}"
            },
            {
              "role": "system",
              "content": "You are a legal intake classification assistant for a law firm. Classify the client's message into exactly one case type: property, family, or criminal. If it clearly does not fit any of those, use other. Respond with ONLY valid JSON, no markdown, no extra text, in this exact shape: {\\\"caseType\\\": \\\"property|family|criminal|other\\\", \\\"confidence\\\": 0.0-1.0, \\\"summary\\\": \\\"one line summary of the issue\\\"}"
            }
          ]
        },
        "builtInTools": {}
      },
      "typeVersion": 2.1
    },
    {
      "id": "7672e0d9-c3d7-46f0-9c43-c8f54ceba73f",
      "name": "Parse Classification Result",
      "type": "n8n-nodes-base.code",
      "position": [
        -976,
        288
      ],
      "parameters": {
        "jsCode": "const input = $input.first().json;\nconst clientInfo = $('Extract Client Info').first().json;\n\nlet raw = '';\ntry {\n  raw = input.output?.[0]?.content?.[0]?.text\n    || input.message?.content\n    || input.content\n    || input.text\n    || JSON.stringify(input);\n} catch (e) {\n  raw = JSON.stringify(input);\n}\n\n// Some models double-escape quotes (e.g. {\\\"key\\\": \\\"value\\\"}) \u2014 normalize before parsing\nif (typeof raw === 'string' && raw.includes('\\\\\"')) {\n  raw = raw.replace(/\\\\\"/g, '\"');\n}\n\nlet parsed;\ntry {\n  const jsonMatch = raw.match(/\\{[\\s\\S]*\\}/);\n  parsed = JSON.parse(jsonMatch ? jsonMatch[0] : raw);\n} catch (e) {\n  parsed = { caseType: 'other', confidence: 0, summary: 'Could not auto-classify, needs manual review' };\n}\n\nconst validTypes = ['property', 'family', 'criminal'];\nconst caseType = validTypes.includes((parsed.caseType || '').toLowerCase())\n  ? parsed.caseType.toLowerCase()\n  : 'other';\n\nreturn [{\n  json: {\n    chatId: clientInfo.chatId,\n    clientName: clientInfo.clientName,\n    messageText: clientInfo.messageText,\n    caseType,\n    confidence: parsed.confidence || 0,\n    summary: parsed.summary || clientInfo.messageText\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "64342a39-2c75-4e96-b7fd-d3c70069ed2f",
      "name": "Route by Case Type",
      "type": "n8n-nodes-base.switch",
      "position": [
        -720,
        256
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "Property",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "c1",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.caseType }}",
                    "rightValue": "property"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Family",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "c2",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.caseType }}",
                    "rightValue": "family"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Criminal",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "c3",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.caseType }}",
                    "rightValue": "criminal"
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {
          "fallbackOutput": "extra",
          "renameFallbackOutput": "Other"
        }
      },
      "typeVersion": 3.2
    },
    {
      "id": "03d42b88-ff9a-42b7-ba33-278b709d069b",
      "name": "Property Checklist",
      "type": "n8n-nodes-base.set",
      "position": [
        -240,
        -144
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "p1",
              "name": "checklist",
              "type": "string",
              "value": "=\ud83d\udccb *Property Case \u2014 Document Checklist*\n\n1. Sale deed / title deed (original + copy)\n2. Property tax receipts (last 3 years)\n3. Encumbrance certificate\n4. Government-issued ID proof\n5. Survey / layout plan (if available)\n6. Any prior legal notices related to the property\n\nPlease keep scanned copies ready before your consultation."
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "f2848b2a-1ea6-49c1-84fa-b4bd98290a06",
      "name": "Family Checklist",
      "type": "n8n-nodes-base.set",
      "position": [
        -240,
        128
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "f1",
              "name": "checklist",
              "type": "string",
              "value": "=\ud83d\udccb *Family Case \u2014 Document Checklist*\n\n1. Marriage certificate\n2. Government-issued ID proof (both parties, if applicable)\n3. Address proof\n4. Any existing court orders or notices\n5. Financial documents (income proof, joint assets, if relevant)\n6. Children's birth certificates (if custody is involved)\n\nPlease keep scanned copies ready before your consultation."
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "af5f713f-1d6e-49e1-949d-2a654c69be33",
      "name": "Criminal Checklist",
      "type": "n8n-nodes-base.set",
      "position": [
        -208,
        336
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "cr1",
              "name": "checklist",
              "type": "string",
              "value": "=\ud83d\udccb *Criminal Case \u2014 Document Checklist*\n\n1. FIR copy (if filed)\n2. Government-issued ID proof\n3. Any summons, notices, or bail orders received\n4. Witness details (if any)\n5. Prior legal correspondence related to the case\n\nPlease keep scanned copies ready before your consultation."
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "f9470bfd-d8c8-406e-8d89-82a6330854c0",
      "name": "Fallback Checklist",
      "type": "n8n-nodes-base.set",
      "position": [
        -208,
        576
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "o1",
              "name": "checklist",
              "type": "string",
              "value": "=\ud83d\udccb *Document Checklist*\n\nThanks for reaching out. Your case doesn't match a standard category yet \u2014 please share a bit more detail about your issue, and our team will send you the exact document list shortly."
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "2e130c7b-fd0f-4c47-b642-f47dd20ee86a",
      "name": "Send Document Checklist",
      "type": "n8n-nodes-base.telegram",
      "position": [
        432,
        320
      ],
      "parameters": {
        "text": "={{ $json.checklist }}",
        "chatId": "={{ $('Parse Classification Result').item.json.chatId }}",
        "additionalFields": {
          "parse_mode": "Markdown"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "3976fac2-713c-41cd-a9dd-94bf520c41ed",
      "name": "Log Case to Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        672,
        320
      ],
      "parameters": {
        "columns": {
          "value": {
            "name": "={{ $('Parse Classification Result').item.json.clientName }}",
            "status": "New",
            "chat_id": "={{ $json.result.chat.id }}",
            "summary": "={{ $('Parse Classification Result').item.json.summary }}",
            "case_type": "={{ $('Parse Classification Result').item.json.caseType }}",
            "fee_status": "Pending",
            "follow_up_sent": "No"
          },
          "schema": [
            {
              "id": "name",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "chat_id",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "chat_id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "phone",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "phone",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "case_type",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "case_type",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "summary",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "summary",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "status",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "fee_status",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "fee_status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "consultation_date",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "consultation_date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "follow_up_sent",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "follow_up_sent",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "created_at",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "created_at",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "name",
          "value": "Cases"
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "YOUR_GOOGLE_SHEET_ID"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "7e220176-c27b-4931-ab30-e69f69cc91e8",
      "name": "Create Consultation Event",
      "type": "n8n-nodes-base.googleCalendar",
      "position": [
        912,
        320
      ],
      "parameters": {
        "end": "={{ $now.plus({days: 1}).set({hour: 11, minute: 30}).toISO() }}",
        "start": "={{ $now.plus({days: 1}).set({hour: 11, minute: 0}).toISO() }}",
        "calendar": {
          "__rl": true,
          "mode": "list",
          "value": "user@example.com",
          "cachedResultName": "Firm Google Calendar"
        },
        "additionalFields": {
          "summary": "=Consultation - {{ $('Parse Classification Result').item.json.clientName }} ({{ $('Parse Classification Result').item.json.caseType }})",
          "description": "={{ $('Parse Classification Result').item.json.summary }}"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "97c75e2c-30fa-46ed-b208-5d8b4e9982a3",
      "name": "Notify Lawyer",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1152,
        176
      ],
      "parameters": {
        "text": "=\ud83d\udd14 *New Client Intake*\n\nName: {{ $('Parse Classification Result').item.json.clientName }}\nCase Type: {{ $('Parse Classification Result').item.json.caseType }}\nSummary: {{ $('Parse Classification Result').item.json.summary }}\nConsultation booked: {{ $json.start }}",
        "chatId": "={{ $('Parse Classification Result').item.json.chatId }}",
        "additionalFields": {
          "parse_mode": "Markdown"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "65ac3f8c-e085-40d7-93e6-b44cd8aad42d",
      "name": "Send Booking Confirmation",
      "type": "n8n-nodes-base.telegram",
      "position": [
        1152,
        464
      ],
      "parameters": {
        "text": "=\u2705 *Consultation Booked*\n\nHi {{ $('Parse Classification Result').item.json.clientName }}, your consultation is booked for {{ $('Create Consultation Event').item.json.start }}. Our team will confirm shortly. Please have your documents ready from the checklist sent earlier.",
        "chatId": "={{ $('Parse Classification Result').item.json.chatId }}",
        "additionalFields": {
          "parse_mode": "Markdown"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "45c8687a-0469-4681-915e-2fe411371cb6",
      "name": "Daily Fee Reminder Check",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -432,
        1072
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "triggerAtHour": 10
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "d8656875-100d-46c4-8bbd-50fd4b884eeb",
      "name": "Get Pending Fee Cases",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -192,
        1072
      ],
      "parameters": {
        "options": {},
        "filtersUI": {
          "values": [
            {
              "lookupValue": "Pending",
              "lookupColumn": "fee_status"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "name",
          "value": "Cases"
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "YOUR_GOOGLE_SHEET_ID"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "58c3c73a-5962-4891-94e4-c1c2e2b8795d",
      "name": "Has Pending Fees?",
      "type": "n8n-nodes-base.if",
      "position": [
        48,
        1072
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "loose"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "fee1",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{ $json.chat_id }}",
              "rightValue": ""
            }
          ]
        },
        "looseTypeValidation": true
      },
      "typeVersion": 2.2
    },
    {
      "id": "d56e8bf1-8fc8-4e6a-a41d-509a2d7fd1fa",
      "name": "Split Cases",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        288,
        1072
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "574b8005-24d5-400c-a04f-253e72a9c4dc",
      "name": "Send Fee Reminder",
      "type": "n8n-nodes-base.telegram",
      "position": [
        528,
        1072
      ],
      "parameters": {
        "text": "=Hi {{ $json.name }}, this is a gentle reminder that your consultation fee is still pending. Please complete the payment at your earliest convenience so we can confirm your slot. Reply here if you have any questions.",
        "chatId": "={{ $json.chat_id }}",
        "additionalFields": {}
      },
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "59da83fe-1950-4c11-97b1-7210e8f49954",
      "name": "Update Fee Status",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        768,
        1072
      ],
      "parameters": {
        "columns": {
          "value": {
            "name": "={{ $('Get Pending Fee Cases').item.json.name }}",
            "fee_status": "followup sent",
            "row_number": 0
          },
          "schema": [
            {
              "id": "name",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "chat_id",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "chat_id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "phone",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "phone",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "case_type",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "case_type",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "summary",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "summary",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "status",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "fee_status",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "fee_status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "consultation_date",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "consultation_date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "follow_up_sent",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "follow_up_sent",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "created_at",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "created_at",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "type": "number",
              "display": true,
              "removed": false,
              "readOnly": true,
              "required": false,
              "displayName": "row_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "name"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "name",
          "value": "Cases"
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "YOUR_GOOGLE_SHEET_ID"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "cb6f7c9b-6cb5-460a-b5f2-46d385ef0c6d",
      "name": "Follow-up Schedule Check",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -432,
        1520
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "triggerAtHour": 15
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "329810ef-3fcc-4f93-b129-9e17606ca558",
      "name": "Get Cases Needing Follow-up",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -192,
        1520
      ],
      "parameters": {
        "options": {},
        "filtersUI": {
          "values": [
            {
              "lookupValue": "No",
              "lookupColumn": "follow_up_sent"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "name",
          "value": "Cases"
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "YOUR_GOOGLE_SHEET_ID"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "60ec1827-2423-4525-83b8-f05eafdfc761",
      "name": "Has Follow-ups Due?",
      "type": "n8n-nodes-base.if",
      "position": [
        48,
        1520
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "loose"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "fu1",
              "operator": {
                "type": "string",
                "operation": "notEmpty"
              },
              "leftValue": "={{ $json.chat_id }}",
              "rightValue": ""
            }
          ]
        },
        "looseTypeValidation": true
      },
      "typeVersion": 2.2
    },
    {
      "id": "f3320538-2217-47bd-9517-e2ef1cd3079c",
      "name": "Split Follow-up Cases",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        288,
        1520
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "2971a735-2067-46f8-939f-08c6c0189145",
      "name": "Send Follow-up Message",
      "type": "n8n-nodes-base.telegram",
      "position": [
        528,
        1520
      ],
      "parameters": {
        "text": "=Hi {{ $json.name }}, following up on your {{ $json.case_type }} consultation \u2014 do you need any help with next steps or additional documents? We're here if you have questions.",
        "chatId": "={{ $json.chat_id }}",
        "additionalFields": {}
      },
      "typeVersion": 1.2
    },
    {
      "id": "3991062f-f479-4860-905a-0829155ccfc1",
      "name": "Mark Follow-up Sent",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        768,
        1520
      ],
      "parameters": {
        "columns": {
          "value": {
            "name": "={{ $('Get Cases Needing Follow-up').item.json.name }}",
            "follow_up_sent": "yes"
          },
          "schema": [
            {
              "id": "name",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "chat_id",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "chat_id",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "phone",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "phone",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "case_type",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "case_type",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "summary",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "summary",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "status",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "fee_status",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "fee_status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "consultation_date",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "consultation_date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "follow_up_sent",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "follow_up_sent",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "created_at",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "created_at",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "type": "number",
              "display": true,
              "removed": true,
              "readOnly": true,
              "required": false,
              "displayName": "row_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "name"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "name",
          "value": "Cases"
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "YOUR_GOOGLE_SHEET_ID"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "ecbb674f-b7a0-4de1-b616-da234f9cd5b2",
      "name": "On Workflow Error",
      "type": "n8n-nodes-base.errorTrigger",
      "position": [
        -1376,
        1104
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "352ce251-5e99-4d04-9b0a-a7b657c16784",
      "name": "Slack \u2013 Post Workflow Error Alert",
      "type": "n8n-nodes-base.slack",
      "position": [
        -1120,
        1104
      ],
      "parameters": {
        "text": "=\u26a0\ufe0f *LegalOS Workflow Error*\n\n*Workflow:* {{ $workflow.name }}\n*Failed Node:* {{ $execution.lastNodeExecuted }}\n*Time:* {{ $now.format('MMM D, YYYY \u2013 HH:mm') }}\n*Execution ID:* {{ $execution.id }}",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_SLACK_CHANNEL_ID",
          "cachedResultName": "your-alerts-channel"
        },
        "otherOptions": {},
        "authentication": "oAuth2"
      },
      "typeVersion": 2.3
    },
    {
      "id": "b5740fdd-0f86-430f-ba00-630937bdcdd8",
      "name": "Slack \u2013 Post AI Classification Error",
      "type": "n8n-nodes-base.slack",
      "position": [
        -1008,
        832
      ],
      "parameters": {
        "text": "=\u26a0\ufe0f *LegalOS AI Classification Error*\n\n*Workflow:* {{ $workflow.name }}\n*Time:* {{ $now.format('MMM D, YYYY \u2013 HH:mm') }}\n\nAI classification failed \u2014 manual review required for this intake.",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_SLACK_CHANNEL_ID",
          "cachedResultName": "your-alerts-channel"
        },
        "otherOptions": {},
        "authentication": "oAuth2"
      },
      "typeVersion": 2.3
    }
  ],
  "active": false,
  "settings": {
    "binaryMode": "separate",
    "availableInMCP": false,
    "executionOrder": "v1"
  },
  "versionId": "a4cb0e77-938c-4425-af89-b423d7a7235d",
  "nodeGroups": [],
  "connections": {
    "Split Cases": {
      "main": [
        [],
        [
          {
            "node": "Send Fee Reminder",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Family Checklist": {
      "main": [
        [
          {
            "node": "Send Document Checklist",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Has Pending Fees?": {
      "main": [
        [
          {
            "node": "Split Cases",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Log Case to Sheet": {
      "main": [
        [
          {
            "node": "Create Consultation Event",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "On Workflow Error": {
      "main": [
        [
          {
            "node": "Slack \u2013 Post Workflow Error Alert",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Fee Reminder": {
      "main": [
        [
          {
            "node": "Update Fee Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update Fee Status": {
      "main": [
        [
          {
            "node": "Split Cases",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Criminal Checklist": {
      "main": [
        [
          {
            "node": "Send Document Checklist",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fallback Checklist": {
      "main": [
        [
          {
            "node": "Send Document Checklist",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Property Checklist": {
      "main": [
        [
          {
            "node": "Send Document Checklist",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Route by Case Type": {
      "main": [
        [
          {
            "node": "Property Checklist",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Family Checklist",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Criminal Checklist",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Fallback Checklist",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Client Info": {
      "main": [
        [
          {
            "node": "AI \u2013 Classify Legal Case",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Has Follow-ups Due?": {
      "main": [
        [
          {
            "node": "Split Follow-up Cases",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Mark Follow-up Sent": {
      "main": [
        [
          {
            "node": "Split Follow-up Cases",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Pending Fee Cases": {
      "main": [
        [
          {
            "node": "Has Pending Fees?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Follow-up Cases": {
      "main": [
        [],
        [
          {
            "node": "Send Follow-up Message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Follow-up Message": {
      "main": [
        [
          {
            "node": "Mark Follow-up Sent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Document Checklist": {
      "main": [
        [
          {
            "node": "Log Case to Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Daily Fee Reminder Check": {
      "main": [
        [
          {
            "node": "Get Pending Fee Cases",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Follow-up Schedule Check": {
      "main": [
        [
          {
            "node": "Get Cases Needing Follow-up",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Consultation Event": {
      "main": [
        [
          {
            "node": "Notify Lawyer",
            "type": "main",
            "index": 0
          },
          {
            "node": "Send Booking Confirmation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI \u2013 Classify Legal Case": {
      "main": [
        [
          {
            "node": "Parse Classification Result",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Slack \u2013 Post AI Classification Error",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Client Message via Telegram": {
      "main": [
        [
          {
            "node": "Extract Client Info",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Cases Needing Follow-up": {
      "main": [
        [
          {
            "node": "Has Follow-ups Due?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse Classification Result": {
      "main": [
        [
          {
            "node": "Route by Case Type",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Slack \u2013 Post AI Classification Error": {
      "main": [
        [
          {
            "node": "Extract Client Info",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

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

About this workflow

This workflow handles legal client intake via Telegram, uses OpenAI (gpt-4o-mini) to classify the case and send a matching document checklist, logs cases in Google Sheets, schedules a consultation in Google Calendar, sends Telegram confirmations, and posts Slack alerts for…

Source: https://n8n.io/workflows/17679/ — original creator credit. Request a take-down →

More Slack & Telegram workflows → · Browse all categories →

Related workflows

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

Slack & Telegram

This workflow handles customer order complaints submitted via Telegram by looking up order details in Google Sheets, using OpenAI to classify message sentiment, and routing each case to auto-approval,

Telegram Trigger, Google Sheets, Telegram +3
Slack & Telegram

This workflow handles COD order confirmation and abandoned-cart recovery by combining webhooks, Google Sheets logging, OpenAI message generation, and Telegram messaging with inline buttons, plus Slack

Telegram Trigger, Google Sheets, Telegram +3
Slack & Telegram

This workflow runs a Telegram restaurant ordering flow that uses OpenAI to parse orders and suggest an upsell, sends a Razorpay payment link, confirms paid orders via a Razorpay webhook, logs orders a

Telegram Trigger, OpenAI, Telegram +3
Slack & Telegram

This workflow runs daily to forecast SKU demand from Google Sheets data, drafts purchase-order justifications with OpenAI, routes critical and warning items for Telegram review and Slack alerts, logs

Error Trigger, Slack, Google Sheets +4
Slack & Telegram

This workflow handles dental clinic patient conversations in Telegram, using OpenAI to answer treatment-plan and general questions, logging bookings and payment plans in Google Sheets, sending automat

Telegram Trigger, Google Sheets, Telegram +3