A client sends a voice message at 21:40. The manager listens to it twice, types the name, the subject, the amount and the deadline into four fields, opens the template, fixes the requisites, exports to PDF and sends it. Fifteen minutes gone, and on a bad day the INN ends up in the contract number field. The goal of this build is that the manager listens to nothing and types nothing: the voice lands in the system, the fields come out filled, a human glances at one row of a table, and a PDF contract reaches the client's inbox.
What you get at the end is not a chatbot and not a demo. It is a pipeline with one human checkpoint. You will know it works when ten real recordings from last month go through it, and on at least eight of them the human only presses approve — no retyping.
The result you are building toward
Concretely, at the end you have three things.
- An intake endpoint. A phone number or a messenger bot that accepts a voice file and stores it, plus a link back to the client (their phone, chat ID, email).
- A review table. One row per request: audio file, transcript, extracted fields, a confidence flag per field, an approve button. This is the only screen a human touches.
- A contract issuer. On approve, a PDF is generated from your template, saved, and emailed to the client, with a copy of the row archived.
The manager's job shrinks to reading one row and pressing a button. If a field is flagged low-confidence, they hear three seconds of audio around that moment — not the whole recording. That is the difference between 15 minutes and about 40 seconds.
Step 1: Decide what a "field" is before touching any AI
Owner: human. This step is boring and it decides whether the rest works.
Take your current contract template and list every variable that changes per deal: client legal name, tax ID, subject of the contract, amount, deadline, payment terms, signatory. For each one write down three things: the type (text, money, date, ID number), the validation rule (a tax ID has a fixed length and checksum under the tax code of your jurisdiction; a date cannot be in the past), and whether it is mandatory for the contract to exist at all.
Why this matters: a language model will happily invent a plausible tax ID if the audio is unclear. It cannot invent one that passes a checksum. Your validation rules are the only thing standing between a mumble and a signed document.
A common mistake here is listing fields as the template shows them, including formatting. Store the amount as a number and the date as an ISO date; formatting belongs to the PDF renderer, not to the extraction step.
Step 2: Get the audio in, and accept that one channel is worse
Owner: AI writes the integration, human gets the accounts.
You have two sources and they behave differently:
- Messenger voice messages — usually one compressed file, often Opus inside OGG or an M4A. Easy to fetch, but the audio is a phone held at arm's length in a café.
- Phone calls — you need a telephony provider that can record and expose the recording via webhook or API. Check in the provider's docs whether recordings are available on your plan and how long they are retained; retention is often measured in days, so you must download promptly, not "later".
Access you need: a bot token for the messenger platform, and a telephony account with recording enabled. Both are self-serve in most cases. Where access is impossible: consumer messengers that give no bot API, and personal phone numbers where recording requires consent from the other party — under the applicable data protection and telecommunications rules recording a call without notice is restricted, so put a spoken notice at the start of the recording or use a business line that announces it. Check the data protection rules that apply to you before you record anything.
One design decision to make now: store the audio file yourself, in your own storage bucket, and keep only a reference in the database. Transcription APIs and telephony providers delete files on their own schedule; your contract archive should not depend on that.
Step 3: Transcription — where the pipeline quietly dies
Owner: AI wires the speech-to-text call; human listens to the failures.
This is the step people underestimate. Speech-to-text is good on clean audio and mediocre on real phone calls. Names, tax IDs and amounts are exactly the tokens it gets wrong, because they carry no context. "Fourteen thousand" and "forty thousand" differ by one blurred consonant.
Practical rules that save you:
- Ask for numbers spelled out in words, then parse them yourself. Digits dictated over a phone line are the single most common corruption.
- Transcribe with timestamps per segment. Without them the reviewer cannot jump to the doubtful second and will listen to the whole file — which is the 15 minutes you were trying to remove.
- Keep the original audio forever, the transcript as a draft. The transcript is a convenience, not a legal record.
A typical situation: the client says the company name, then spells it letter by letter because nobody can pronounce it. The transcriber renders the spelling as one long nonsense word. That is fine — as long as your review table shows the audio player next to that field.
Step 4: Field extraction — the AI proposes, the code disposes
Owner: AI writes the prompt and the parser; human defines what "good enough" means.
Send the transcript (with timestamps) plus your field list to a language model and ask for structured output: for each field, a value, the timestamp of the segment it came from, and a confidence of high, medium or low. Ask it explicitly to return null rather than guess.
Then, and this is the part that is not AI at all, run every value through your validation rules from step 1:
- Money: parse to a number, reject anything that does not parse.
- Dates: parse to ISO, reject past dates for deadlines.
- Tax IDs: length and checksum. A failing checksum is an automatic
low, no matter what the model said.
If a field is null after extraction, the row goes to review with an empty cell — that is a correct outcome, not a bug. An empty cell costs the manager ten seconds. A wrong tax ID costs a reissued contract.
Step 5: The review table is the whole product
Owner: human designs it, AI builds it.
Everything the manager sees lives here. One row per request, and in each row:
- the audio player, with segment timestamps as clickable marks;
- each field with its value and a colour for confidence;
- the raw transcript, collapsed by default;
- Approve, Fix and approve, Reject.
The manager's loop is: open the row, read the green fields, click the timestamp on the two red ones, fix if needed, approve. Measured against the old process, that is the 15 minutes turning into under a minute on a clean recording.
Do not add a chat interface where the manager "talks to the AI about the contract". It sounds nice and it moves the typing back to the human.
Step 6: PDF from a template, and the send
Owner: AI builds the renderer; human owns the template and the mailbox.
Use a real template engine rather than asking a model to write the contract text. A model rewriting contract clauses is a legal risk with no upside — the clauses are supposed to be identical every time. Fill placeholders in a DOCX or HTML template, render to PDF, save to storage, email with the PDF attached and a link to the archive row.
Access you need: an email sending service (transactional email API with a verified sending domain) and, if you want the client to sign, an e-signature provider. The e-signature step is where "build it yourself" usually stops being reasonable — providers handle identity and audit trails that you do not want to reinvent. Check their API docs for whether they support embedded signing from your own page or only their hosted flow.
Step 7: What breaks, and what to do about it
These are the three failures you will actually hit.
Bad audio, and the model fills the gap with fiction
A client records in a car with the window down. The transcriber produces a fluent sentence with the wrong amount, and the model reports high confidence because the sentence reads naturally. Fix: never let a monetary or ID value pass without a validation rule, and always show the timestamped audio next to it. If the amount has no checksum, add a cheap one: flag any amount that differs from the median of that client's previous contracts by more than a set factor. It is a heuristic, and it catches the loudest errors.
Duplicates and lost requests
A client calls, then sends a voice message about the same deal. Two rows appear, two contracts go out. Fix: deduplicate on the client identifier plus a time window (say, same phone within 24 hours), and show suspected duplicates as one row with a note. Separately, webhooks get lost: if your telephony provider's webhook fails once and you have no polling fallback, the recording is simply never processed. Poll for new recordings on a schedule as a safety net, and compare counts against the provider's list. More on the topic: “Voice Call Deadline Reminder: Build a Python Service That Turns Calls into Calendar Reminders and Doesn't Lose Dates”.
Personal data in places you did not plan for
Transcripts and audio contain names, phone numbers and tax IDs — personal and often financial data. If you send audio to a third-party transcription API, check in their docs where processing happens and what their retention is; under the data protection law that applies to you, you are the controller and need a lawful basis and, for some vendors, a data processing agreement. Fix: store audio in one bucket with a defined retention, keep transcripts out of logs, and do not paste raw transcripts into debugging tools.
Step 8: How to check it before trusting it
Owner: human, by hand, with a spreadsheet.
Take ten real recordings from last month — not clean studio samples, the actual messy ones — and run them through. For each, record: did the transcript contain the company name correctly, was the amount right, was the tax ID right, did the deadline parse, and how long did the human review take.
Success signs, in order of importance:
- Zero wrong tax IDs and zero wrong amounts that reached a PDF. Not "few" — zero, because your validation rules should make it impossible.
- On at least eight of ten, the human presses approve without editing any field.
- Review time per request under two minutes, including the bad ones.
- Kill the network for a minute mid-processing: the request must end up in a retry queue, not disappear.
- Send the same webhook twice: exactly one contract email.
If check 1 fails, the problem is in step 1 and step 4, not in the model. Go back to validation rules before you go shopping for a better transcriber.
What it costs you
In time: a working pipeline with a review table, a template renderer and email is a few days of focused work for someone comfortable with APIs, and noticeably longer if the review UI has to be built from scratch. The transcription and extraction calls themselves are per-minute and per-token — the order of magnitude is cents per request, not dollars, but check current pricing on the providers' pages rather than trusting a number from an article, including this one.
What the cost depends on: whether your telephony provider exposes recordings on your plan, whether you need e-signature (this is usually the largest line item), and how much of the review UI you build versus configure.
If you would rather not spend those days on webhook retries and PDF templates, asibiont.com takes such projects on turnkey — the developer names the price for the pipeline and the client pays it by topping up the balance, with the work scoped to exactly the steps above.
Where this leaves you
The pipeline does not remove the human — it moves them from typing to checking, and it makes the checking cheap because the doubtful three seconds are one click away. The single most valuable thing you build is not the AI call. It is the field list with validation rules, written before any model saw a single recording. Everything downstream — the review table, the PDF, the deduplication — is only as good as that list.
Start with the ten recordings. If your validation rules hold on those, the rest is plumbing. If they do not, no amount of prompt tuning will save the contract that goes out with the wrong amount. When you are ready to hand the build over or scope it properly, the turnkey option is here: https://asibiont.com/en/subscription-tiers