Turn AI Call Transcripts Into CRM Fields With a JSON Schema (Tutorial)
A campaign of two thousand AI calls produces two thousand transcripts. Nobody reads them. What the sales or operations team needs is a table: which contacts said yes, what budget they mentioned, when they want a callback. Structured post-call analysis produces exactly that: after each call, the transcript is analysed against a schema you define, and the result is stored as fields on the call record.
This tutorial walks through defining the schema, attaching it to a campaign in Azmth CMS, and reading the results through the API. The schema format is standard JSON Schema, so the design part applies to any platform that supports structured extraction.
Step 1: Decide the fields from the prompt
Start from the questions the agent asks. Each question maps to one field, and each field should have the narrowest type that fits.
For a lead qualification call that asks about interest, budget, timeline and a callback, the fields are:
- interested: boolean
- budget_inr: integer, or null when not stated
- timeline: one of "this_month", "this_quarter", "later", "unknown"
- callback_requested: boolean
- callback_slot: string in plain words, or null
- do_not_call: boolean, true when the person asked not to be contacted again
Two rules keep extraction accurate. Use enums instead of free text wherever the answer has a small set of values; the model picks from the list rather than paraphrasing. Add a description to every field saying what counts as true and what to do when the answer was not given.
Step 2: Write the schema
The schema is a JSON Schema object. Descriptions matter: they are the instructions the analysis model follows.
{
"type": "object",
"properties": {
"interested": { "type": "boolean", "description": "True only if the person expressed interest in a solar installation. False for refusal or wrong number." },
"budget_inr": { "type": ["integer", "null"], "description": "Monthly electricity bill in INR if stated, else null." },
"timeline": { "type": "string", "enum": ["this_month", "this_quarter", "later", "unknown"], "description": "When they want to proceed. unknown if not discussed." },
"callback_requested": { "type": "boolean", "description": "True if they agreed to a consultant callback." },
"callback_slot": { "type": ["string", "null"], "description": "The day and time they asked for, in their words, else null." },
"do_not_call": { "type": "boolean", "description": "True if they asked not to be called again." }
},
"required": ["interested", "callback_requested", "do_not_call"]
}
Keep required to the fields that must always have a value. Making budget_inr required forces the model to invent a number when none was said.
Step 3: Attach it to the campaign
In the Azmth CMS dashboard, the campaign settings accept the schema as text. Through the API, pass it as the analysisSchema string when creating the campaign, or set it on an existing campaign:
curl -X PUT https://api.azmth.in/v1/campaigns/CAMPAIGN_ID/analysis -H "azmth-api-key: $AZMTH_API_KEY" -H "content-type: application/json" -d '{"analysisSchema": "<the schema JSON as a string>"}'
Passing null clears it. Calls made after the schema is set are analysed against it; the analysis runs automatically when each call completes.
Step 4: Test on five calls
Run five test calls to your own team with different scripted answers: a clear yes with a callback slot, a refusal, a wrong number, a "call me later" and a "do not call me". Open each call record and compare the extracted fields with what was actually said. Fix the descriptions for any field that came back wrong. The most common fix is tightening a description from "if interested" to "true only if they explicitly said they want to proceed".
Step 5: Read the results through the API
Each call record carries the transcript, recording URL, post-call report and the structured analysis. To pull them into a CRM, list the records for the campaign and read the analysis on each:
curl "https://api.azmth.in/v1/calls/records/list?campaignId=CAMPAIGN_ID&limit=100" -H "azmth-api-key: $AZMTH_API_KEY"
The analytics list endpoint returns the same data flattened across the account, one row per call with duration, customer and analysis fields side by side, filterable by date range and successful calls only, which is convenient for a spreadsheet or a BI tool:
curl "https://api.azmth.in/v1/analytics/list?successOnly=true&startDate=2026-09-01&endDate=2026-09-30" -H "azmth-api-key: $AZMTH_API_KEY"
Filter on the fields in your own code: interested and callback_requested go to the sales queue with the callback_slot; do_not_call goes to your suppression list before the next campaign is built.
Step 6: Use the fields inside the platform
Two features use the outcomes without any integration. Tags on call records let reviewers mark records, for example "verified" or "escalate", and the tags endpoint lists every tag in use. Pipelines let you define stages, attach a pipeline to the campaign and move contacts through New, Qualified, Callback booked and Closed based on the call results, which is enough CRM for many small teams.
Schema patterns for other workflows
The same approach works for every scripted call type:
- EMI reminder: reached_borrower (boolean), will_pay_on_time (boolean), promise_to_pay_date (string or null), dispute_raised (boolean), callback_requested (boolean).
- Appointment confirmation: outcome (enum: confirmed, reschedule, cancel, no_answer), preferred_day (string or null), needs_clinic_callback (boolean).
- COD order confirmation: order_confirmed (boolean), address_change (string or null), cancel_reason (enum: price, changed_mind, ordered_elsewhere, other, none).
- Candidate screening: location_ok (boolean), experience_years (integer or null), notice_period_days (integer or null), expected_ctc (integer or null), interested (boolean).
Start with fewer fields than you think you need. A schema with five reliable fields is more useful than one with fifteen that are right half the time.
Related
The AI calling API overview covers authentication and the other endpoints, and the prompt writing guide shows how to write the questions that the schema extracts.