A client sends a 47-second voice note at 9 p.m.: "Hi, it's Marina, we spoke about the two-bedroom on the river, I need it by March, call me back at this number." Nobody listens to it until the morning. By then she has messaged three other agents. The voice note was a lead — it just never became a record.
This guide builds the loop that fixes that: a messenger webhook catches the audio, speech-to-text turns it into words, a schema pulls out name, phone, the gist and the deadline, the CRM gets a record through its API, the client gets a confirmation in chat, and a log row lands in a spreadsheet. A human checks only what the machine flagged as uncertain.
By the end you will know what appears when it works, which keys you need, where it breaks, and how to prove it on ten real voice messages before you trust it with live traffic.
What you see at the end, and how you know it works
The finished pipeline is invisible to the client and loud to you. Marina sends a voice note; within a minute she gets a short reply in the same chat: "Thanks Marina, logged: two-bedroom, deadline March, we'll call you at +1...". A card appears in the CRM with those fields filled and a link to the original audio. A new row shows up in the log sheet with a timestamp, the transcript, the extracted fields and a status flag. More on the topic: “Voice Requests Into a Signed Contract, Built With AI”.
How you know it actually works — not just "the code ran":
- The card exists before you read the chat. You should never learn about a lead from a human scrolling the messenger.
- The confirmation matches what she said. If the deadline field says "March" and her voice said "by the end of February", the extraction is off and the card is a liability.
- The log has one row, not three. Duplicates are the first sign the webhook is retrying.
- The audio is still retrievable. Messenger file links expire; if the card only stores a dead URL, you cannot re-listen when a field looks wrong.
That last point is worth stating plainly: the pipeline's job is not "transcribe". Its job is to produce a structured record a human can trust or correct in ten seconds. Everything below serves that.
Voice note vs text lead: the same lead, a different cost
People assume voice notes are rare and can be handled by hand. In practice a voice note is just a lead that arrived without structure — and structure is exactly what a CRM needs. The difference is not importance, it is the work required to turn it into a row.
| Criterion | Text lead | Voice note |
|---|---|---|
| Fields arrive | Already typed (name, number, ask) | Encoded in speech, must be extracted |
| Time to a record | Seconds, copy-paste | A minute of processing, or hours if manual |
| Failure mode | Typo in phone | Noise, accent, wrong number read aloud |
| Human effort | Almost none | Listen, retype, guess |
| Risk if ignored | Low — it sits in text | High — it drowns in the chat scroll |
Who this suits: any team where more than a handful of leads arrive as audio — sales, real estate, repair services, clinics. Who it does not suit: a team getting one voice note a week. Below that volume, a person listening is cheaper than a pipeline, and honesty about that saves you a month of build. More on the topic: “Build a Messenger Bot That Answers and Logs Leads in CRM”.
Pick the pipeline when a missed voice note costs more than the build. That is the only real criterion.
The build in steps, each with an owner
Each step names what the AI does and what a human must check or decide. A step without a check is not done.
Step 1 — Receive the audio (owner: you, the builder)
Register a bot with the messenger platform and point its webhook at your endpoint. The platform's docs define the exact update object and how to fetch a file by its ID — check them for your specific messenger, because the field names differ between Telegram, WhatsApp Business and others and I will not invent them here.
The endpoint must answer the platform immediately (a 200 within the platform's timeout, often a couple of seconds) and do the work afterwards. If your handler downloads the audio and calls the transcriber before answering, the platform times out and retries — and you get duplicate leads. That is the single most common way this breaks.
Human check: send yourself a voice note and confirm the raw update arrives in your logs with a file reference.
Step 2 — Transcribe (owner: AI, with a human spot-check)
Send the audio file to a speech-to-text API (OpenAI Whisper API, Google Speech-to-Text, AssemblyAI — all real, all with their own limits). The output is text plus, ideally, confidence per segment.
Human check: play three of your own voice notes and compare the transcript word for word. Note where names and numbers get mangled — that tells you what to guard in step 3.
Step 3 — Extract fields against a schema (owner: AI drafts, human decides)
This is where a language model earns its place: it reads free text and fills a fixed schema. You are not asking it to "understand"; you are asking it to output JSON that matches your CRM fields.
# Python 3.11+, openai>=1.40.0
from openai import OpenAI
import json
client = OpenAI()
SCHEMA = {
"name": "string or null",
"phone": "string or null, digits and leading + only",
"summary": "one sentence, max 200 chars",
"deadline": "ISO date or null",
"confidence": "0.0-1.0 for the whole extraction"
}
def extract(transcript: str) -> dict:
resp = client.chat.completions.create(
model="gpt-4o-mini",
response_format={"type": "json_object"},
messages=[
{"role": "system", "content":
"Extract lead fields. Use null when unsure. Never guess a phone number."},
{"role": "user", "content": transcript},
],
)
return json.loads(resp.choices[0].message.content)
Always validate the returned JSON against your schema before it touches the CRM. A model that returns phone: "call me" must not create a contact.
Human check: run the extractor on five transcripts and read the JSON. Fields that are wrong or null are your review queue, not a bug to hide.
Step 4 — Write to the CRM (owner: AI, with a human owning the mapping)
Push the record through the CRM's API. Every major CRM (HubSpot, Pipedrive, Salesforce, Bitrix24) has a documented REST endpoint for creating a contact or deal; the exact path, auth header and required fields are in each one's docs — read them, do not assume. Before writing, search by phone to avoid creating a second card for the same person.
Human check: create one test contact by hand through the same endpoint and confirm it appears where your team will actually look.
Step 5 — Confirm to the client and log (owner: AI, human reads the log)
Send a short confirmation back into the chat (same bot, same thread) and append a row to a spreadsheet (Google Sheets API, Airtable, or your database) with timestamp, transcript, extracted fields, status and CRM record ID.
Human check: the log row and the CRM card must reference each other. If you cannot jump from one to the other, debugging later becomes archaeology.
Access and data: what you need before line one of code
You cannot build this without four sets of credentials. Get them in this order, because each blocks the next.
- Messenger bot token and webhook URL. From the platform's bot setup (BotFather for Telegram; the WhatsApp Business API via Meta for WhatsApp; each has its own console). The webhook needs a public HTTPS endpoint — a tunnel for testing, a real host for production.
- Speech-to-text API key. From the transcription provider's console. Note the file-size and duration limits per request; long notes may need chunking.
- CRM API token with write scope. From the CRM's developer settings. Use a dedicated integration user, not your personal admin login.
- Spreadsheet or database access. A service account with write access to one specific sheet or table — not the whole drive.
Where access is impossible, say so early: some messengers do not expose an official bot API for your account type, and some CRMs gate API access behind a paid tier. If your messenger has no bot API, the realistic fallback is a human-forwarding step or a different channel — not a clever workaround that violates the platform's terms.
Where it breaks, and what to do about each
Three failures will find you. Plan for them now.
Webhook timeout and duplicates. The platform retries when your endpoint is slow, and each retry can create a new lead. Fix: acknowledge first, process in a queue, and deduplicate on the platform's message ID before writing anything. One message ID, one record — always.
Noise and wrong numbers. A voice note recorded in a car gets "five five five, one two three four" transcribed as "555 1234" or worse. Fix: never auto-create a contact from a low-confidence phone. Route it to a human review queue with the audio link attached, and let the confirmation message ask the client to confirm the number in text.
Personal data in the wrong place. Transcripts and audio are personal data. If you operate in the EU, the General Data Protection Regulation (Regulation (EU) 2016/679) applies; elsewhere the data protection law of your own jurisdiction will. Fix: keep the log sheet private, restrict who can open the audio, and set a retention period — delete raw audio after you no longer need it for verification, and say so in your client-facing notice.
If you would rather not own the queue, the retries and the retention rules yourself, asibiont.com takes such projects on turnkey — the developer names the price and the client pays it by topping up the balance, so you are not staffing a build. See the tiers at https://asibiont.com/en/subscription-tiers.
Proving it on ten real voice messages
Do not test with typing. Test with the messy reality your clients produce.
- Collect ten real voice notes — different speakers, one recorded outdoors, one with a name you know is hard to spell, one where the number is read aloud.
- Run each through the pipeline end to end and record: transcript accuracy, which fields came out null, whether a duplicate appeared, whether the confirmation matched.
- Success sign: at least eight of ten produce a CRM card with a correct phone or a correctly flagged review, and zero duplicates.
- Re-run the two failures after a fix and confirm they now land in the review queue instead of the CRM.
If fewer than eight pass, the problem is almost always step 3 (extraction) or step 1 (deduplication) — check those before touching the rest.
The honest cost
Order of magnitude, not a quote. Time: a working prototype that handles one messenger and one CRM is a few days of focused work for someone comfortable with APIs; a production version with a review queue, retention and monitoring is closer to a couple of weeks. What moves the number: how many messengers you support, whether the CRM has a clean API, and how much human review you want.
Money: transcription and extraction are paid per use, and the bill scales with volume, not with build quality. The dominant cost is usually the human review time, not the APIs — which is why the confidence flag in step 3 matters more than a fancier model.
The pipeline pays for itself the first time a 9 p.m. voice note becomes a called-back client before breakfast. Build it small, prove it on ten real recordings, and let the review queue — not luck — catch what the machine gets wrong. When you are ready to hand the build over, asibiont.com lists the turnkey option at https://asibiont.com/en/subscription-tiers.