← Selected work

Workflow automation · Open-source case

Law Practice Intake Bot

A Telegram intake system that turns unstructured client messages into guided flows, structured lead records and immediate admin action.

View the GitHub repository
  • Python
  • Telegram
  • SQLite
  • Google Sheets
2026

The intake, played back

Three doors in. One record out

A client writes to a law firm the way they would write to a friend — half a sentence, no dates, no documents. Each of the three routes below asks for exactly what is missing, in a fixed order, and every one of them lands on the same twelve-column record. Pick a route and watch the record fill.

Pick a route

Someone with a problem they have not managed to phrase yet.

Legal intake botonlineMenu → Quick question
  1. Which area is this about?

    • Criminal
    • Commercial
    • Civil
    • Other
  2. Describe the situation in up to 500 characters — who is involved, what happened, which deadline is pressing. You can attach up to two PDFs.

  3. Investigators came to the office this morning and took two laptops. Nothing was signed. I need to know what I can do today.

    • seizure-report.pdf
    • equipment-list.pdf
  4. How urgent is it?

    • Today
    • 1–2 days
    • Not urgent
  5. This needs a proper answer rather than a chat reply. Pick a consultation length.

    • 30 min
    • 60 min
    • Skip
  6. Your name?

  7. Andrii Kovalenko

  8. A phone in +380 format or a Telegram @username — or let Telegram share your contact.

    • Share my contact
  9. Email, if you want the answer in writing as well.

    • Skip
  10. Thank you — this is with the lawyer now. Expect a reply in private messages.

What the lawyer receives

Lead recordBeing collected012columns this route fills
Lead
Created
Status
Source
Name
Contact
Email
Category
Urgency
Format
Duration
Brief
How each value got there
  • asked for
  • already known
  • left empty

The working bot runs in Ukrainian for a Kyiv practice; the conversation is translated here. Names, numbers and filenames are stand-ins.

The other side of the send button

The lawyer knows before the client puts the phone down

Saving the lead is one write that fans out three ways: an alert the lawyer can act on from the lock screen, a row in the spreadsheet the practice already lives in, and a database that keeps the attachments. The four buttons below are the ones the bot actually sends — press them.

What lands on the lawyer’s phone

New lead #1042Legal intake botNew
Source
Quick question
Name
Andrii Kovalenko
Contact
+380 50 ••• ••27
Brief
Investigators came to the office this morning and took two laptops…

Press a button

The alert is edited in place into the full record — every field the route filled, without leaving Telegram.

Where the same lead lands

  • SQLiteThe record
    • Four tables: leads, their documents, the people who wrote in, and every message.
    • Attachments are kept as Telegram file references, so no file is stored twice.
    • Deleting a lead takes its files with it — enforced by the database, not by remembering to.
  • Google SheetsThe row
    • Twelve columns appended, headers frozen, dates formatted, widths fitted.
    • Written on a background thread, so the bot keeps answering the next client while it writes.
    • If the sheet is unreachable the lead is already saved — the failure is logged, never fatal.
  • CSV exportThe pull
    • One button in the panel hands back every lead as a file.
    • Opens clean in Excel: UTF-8 with a byte-order mark, semicolon separated, every field quoted.
    • Phone numbers are written as text, so +380 does not arrive as a number.
Where the lead stands
  1. NewNobody has looked at it yet
  2. In reviewSomeone owns it
  3. ScheduledA time is agreed
  4. ClosedAnswered, or declined

Scheduled is set from the panel. The alert carries only the two presses that matter while the client is still holding their phone.

Why it holds up in front of clients
  • Every step has a way back, and pressing a menu button escapes a half-finished flow cleanly.
  • Contacts are checked on the way in: a +380 number, an @username, or the contact Telegram shares itself.
  • The brief is capped at 500 characters, so what reaches the lawyer is a summary rather than a wall.
  • The quick route takes PDF only, two files at most, and refuses anything else with a reason.
  • The first message says plainly that what the bot answers is not a legal opinion.
  • Every incoming message is logged against its sender, so a conversation can be reconstructed later.

Behind the alert sits the full panel: leads by status, by source and by period, ten to a page, with the export at the bottom. The same menu also carries the practice’s articles and the lawyer’s own card — so the bot is somewhere to send people, not only a funnel.

What it changed

The same enquiry, in an inbox and in the system

The client sends the same first message either way. What changes is how much of it is still a question by the time it reaches the lawyer.

The same client enquiry, handled in the inbox and handled through the bot
What changesIn the inboxOne message at a time, by handThrough the botThe same twelve columns, every time
The first messageIn the inbox“Good afternoon, I need help” — and nothing else to work withThrough the botArea, urgency and a 500-character brief before anyone replies
Getting to the pointIn the inboxThree or four rounds of clarifying questions, spread across a dayThrough the botThe bot asks in a fixed order and does not move on until it has an answer
Contact detailsIn the inboxAsked at the end, sometimes forgotten, occasionally mistypedThrough the botValidated on the way in — a +380 number, an @username, or a shared contact
DocumentsIn the inboxAttached to some message, somewhere in a thread nobody wants to scrollThrough the botAttached to the lead, and back in the chat in one press
Knowing it arrivedIn the inboxWhoever opens Telegram first, if they open itThrough the botAn alert carrying the lead, with the buttons to take it on
Where the enquiries standIn the inboxIn the chat list, ordered by whoever wrote most recentlyThrough the botNew, in review, scheduled or closed — filterable by source and period
Out of hoursIn the inboxA message at 2am waits until morning to even become a questionThrough the botThe intake finishes at 2am. Only the answer waits
If your first reply to a new client is still “tell me more”, let’s talk.