Post-call analysis

What Dialgem extracts after every call, how to add your own fields, choose the model, read the result and re-run it on older calls.

When a call ends, Dialgem reads the transcript once and writes a structured analysis onto the call record. You get three built-in fields on every analyzed call, plus any custom fields you define on the agent.

What you get

FieldMeaning
call_summaryA factual summary in one to three sentences: why the caller called, what was done and how it ended.
user_sentimentPositive, Neutral or Negative.
call_successfultrue if the call achieved its purpose, otherwise false.
in_voicemailWhether the call reached a machine.
variablesYour custom fields, keyed by name.
model, extracted_atThe model that read the call, and when.
errornull on success. If analysis failed, a short message, and variables may be empty.

A value is null when the transcript does not contain it.

Define custom fields

Set post_call_analysis_data on the agent: a list of fields to pull out of every call. Each one has:

FieldMeaning
nameKey in analysis.variables. Must be unique on the agent, and cannot be call_summary, call_successful or user_sentiment.
typestring, number, boolean or enum.
descriptionWhat to look for. Specific descriptions give better results.
choicesThe allowed values. Required for enum. An enum answers with one of its choices or null.
examplesUp to 10 sample values that show the expected format.
requiredIf true, the model gives its best inference instead of null when the call does not say outright.
curl -X PATCH https://api.dialgem.com/v1/agents/AGENT_ID \
  -H "X-API-Key: $DIALGEM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "post_call_analysis_data": [
      {
        "name": "appointment_booked",
        "type": "boolean",
        "description": "Whether the caller booked an appointment."
      },
      {
        "name": "reason",
        "type": "enum",
        "choices": ["cleaning", "pain", "other"],
        "description": "Main reason for the visit."
      }
    ]
  }'

Tune the built-in fields

post_call_builtin_fields adjusts the three built-ins. For each one you can set enabled to false (it is not asked for and is stored as null) or give your own description of up to 1000 characters. For user_sentiment you can also replace choices with up to 20 values of your own.

Choose the model

post_call_analysis_model sets which model reads the call. List the options and their estimated cost with List extraction models:

bash
curl https://api.dialgem.com/v1/models/extraction \
  -H "X-API-Key: $DIALGEM_API_KEY"

Each model has an id (use it as post_call_analysis_model), a provider of anthropic or openai, a label and est_cost_per_session, an estimate in US dollars for one typical analysis. The response also names the default, used when you set nothing. Saving an id that is not on the list is rejected. In the SDKs this is dialgem.extractionModels.list() (TypeScript) and dialgem.extraction_models.list() (Python).

Analysis is a read-and-summarize task, so a small model is often enough. Use the cost estimate to compare.

Timing

Analysis runs after the call, never during it, so it adds no delay to the conversation.

  1. The call_ended webhook is sent first. analysis is still null.
  2. The model reads the transcript and the analysis is saved on the call.
  3. The call_analyzed webhook is sent, with analysis filled in.

Do not expect the analysis the instant the call hangs up. Wait for call_analyzed, or poll the call record until analysis is not null. The first analysis uses the agent settings the call ran with, even if you have edited the agent since.

Read the result

Fetch the call and read analysis. See Calls for the full record.

curl https://api.dialgem.com/v1/calls/CALL_ID \
  -H "X-API-Key: $DIALGEM_API_KEY"

The same object arrives in the call_analyzed webhook. See Webhook events. Aggregate numbers are in Analytics.

Re-run the analysis

Changed a field or the model and want an older call read the new way? POST /v1/calls/CALL_ID/rerun-analysis analyzes it again with the agent's current settings, replaces analysis on the record and returns the updated call.

curl -X POST https://api.dialgem.com/v1/calls/CALL_ID/rerun-analysis \
  -H "X-API-Key: $DIALGEM_API_KEY"

A re-run does not charge the call again and does not send call_analyzed again, so a receiver that already acted on the first one does not act twice. Read the result from the response or from the call record.

It fails with 409 in these cases:

Error codeCause
call_in_progressThe call has not ended yet.
no_transcriptThere is no transcript to analyze.
agent_deletedThe agent no longer exists, so there are no settings to apply.

What turns it off

Analysis needs a transcript. A call with no stored transcript gets no analysis: analysis stays null and no call_analyzed webhook is sent. That happens when:

  • opt_out_transcript_storage is true on the agent.
  • data_storage_setting is basic_attributes_only, which implies the same opt-out.
  • The transcript is later purged by data retention, which also clears analysis on the record.

To skip a single built-in field rather than the whole analysis, set its enabled to false as shown above. Models and their settings are covered under LLMs, and the agent itself under Prompt agents.