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 repositoryThe 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.
Someone who already knows they want to talk to a person.
A file that needs a lawyer’s eyes before a deadline.
Which area is this about?
- Criminal
- Commercial
- Civil
- Other
Describe the situation in up to 500 characters — who is involved, what happened, which deadline is pressing. You can attach up to two PDFs.
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
How urgent is it?
- Today
- 1–2 days
- Not urgent
This needs a proper answer rather than a chat reply. Pick a consultation length.
- 30 min
- 60 min
- Skip
Your name?
Andrii Kovalenko
A phone in +380 format or a Telegram @username — or let Telegram share your contact.
- Share my contact
Email, if you want the answer in writing as well.
- Skip
Thank you — this is with the lawyer now. Expect a reply in private messages.
Which format suits you?
- Phone
- Telegram call
- Zoom
How long?
- 30 min
- 60 min
Your name?
Olena Marchenko
A phone in +380 format or a Telegram @username.
@olena_marchenko
Email, if you want the confirmation in writing.
Booked. We will confirm the details shortly.
What kind of document?
- Contract
- Claim
- Other
Send the file — PDF, JPG, PNG or DOCX up to 20 MB — with one or two sentences of context.
The counterparty sent this draft today. We are supposed to sign on Friday.
- supply-agreement-draft.pdf
How should we read it?
- Express review with notes
- Walk-through call
We have it. We will confirm the scope and the cost, then a manager writes to you.
What the lawyer receives
- Lead
- —
- Created
- —
- Status
- —
- Source
- —
- Name
- —
- Contact
- —
- —
- Category
- —
- Urgency
- —
- Format
- —
- Duration
- —
- Brief
- —
Saved. Everything after this happens without anyone typing.
- asked for
- already known
- left empty
Nobody is asked what the matter is about. This route exists to get a time in the diary, and the question itself belongs in the call.
This route asks for the file and the context, then stops — it is the thinnest of the three. Who is asking comes from the Telegram profile the bot stored on first contact, and the scope is agreed in the reply that follows.
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
- Source
- Quick question
- Name
- Andrii Kovalenko
- Contact
- +380 50 ••• ••27
- Brief
- Investigators came to the office this morning and took two laptops…
- Source
- Quick question
- Created
- 04 Aug, 09:12
- Name
- Andrii Kovalenko
- Contact
- +380 50 ••• ••27
- —
- Category
- Criminal
- Urgency
- Today
- Format
- —
- Duration
- 60 min
- Brief
- Investigators came to the office this morning and took two laptops. Nothing was signed.
- seizure-report.pdf
- equipment-list.pdf
Press a button
The alert is edited in place into the full record — every field the route filled, without leaving Telegram.
The files come back into the chat. They were never re-uploaded — Telegram still holds them, the record only holds the reference.
One press marks the lead as owned, so the next person to look can see it is taken.
Ends it. The lead stays searchable, with its brief, its files and its history intact.
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.
- NewNobody has looked at it yet
- In reviewSomeone owns it
- ScheduledA time is agreed
- 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.
- 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.
| What changes | In the inboxOne message at a time, by hand | Through the botThe same twelve columns, every time |
|---|---|---|
| The first message | In the inbox“Good afternoon, I need help” — and nothing else to work with | Through the botArea, urgency and a 500-character brief before anyone replies |
| Getting to the point | In the inboxThree or four rounds of clarifying questions, spread across a day | Through the botThe bot asks in a fixed order and does not move on until it has an answer |
| Contact details | In the inboxAsked at the end, sometimes forgotten, occasionally mistyped | Through the botValidated on the way in — a +380 number, an @username, or a shared contact |
| Documents | In the inboxAttached to some message, somewhere in a thread nobody wants to scroll | Through the botAttached to the lead, and back in the chat in one press |
| Knowing it arrived | In the inboxWhoever opens Telegram first, if they open it | Through the botAn alert carrying the lead, with the buttons to take it on |
| Where the enquiries stand | In the inboxIn the chat list, ordered by whoever wrote most recently | Through the botNew, in review, scheduled or closed — filterable by source and period |
| Out of hours | In the inboxA message at 2am waits until morning to even become a question | Through the botThe intake finishes at 2am. Only the answer waits |