# Post-Conversation Analysis

{% embed url="<https://youtu.be/P0V6_mLofNU?si=_fo-a0UpdfiM3sbn>" %}

The **Conversation analysis** tab lets you define what information to extract from conversations after they close, and optionally forward those results to an external webhook.

<figure><img src="/files/SPS4JprKHiG1sWAZMMcr" alt="Conversation analysis tab showing Post-Conversation Analysis and Conversation Analysis Flow cards"><figcaption></figcaption></figure>

The page has two sections:

* **Post-Conversation Analysis** — define the variables the AI will extract from each conversation
* **Conversation Analysis Flow** — configure a webhook URL to receive results automatically

***

## How it works

The analysis runs automatically in two situations:

* When the agent calls the **Close Conversation** action to end the interaction
* When a conversation times out after 24 hours of inactivity

Once triggered, the AI reviews the conversation and extracts the values of any variables you have defined, then saves the results. If a webhook URL is configured, it sends the full payload to your endpoint immediately after.

No manual action is required.

***

## Post-Conversation Analysis

### Adding a variable

Click **+ Add Variable** to open the variable configuration modal.

<figure><img src="/files/TuuIS0PqalvSTJQSh21R" alt="Add Variable modal showing Type, Name, Instruction, Scope and Required fields"><figcaption></figcaption></figure>

Fill in the following fields:

| Field           | Description                                                                                        |
| --------------- | -------------------------------------------------------------------------------------------------- |
| **Type**        | The data type for this variable (see types below)                                                  |
| **Name**        | A unique identifier used in the analysis output (e.g. `customer_email`)                            |
| **Instruction** | A prompt telling the AI how to extract this value from the conversation                            |
| **Scope**       | **Persistent** — carries across multiple sessions. **Session** — extracted fresh each conversation |
| **Required**    | Whether this variable must be present in the analysis                                              |

Click **Confirm** to save the variable.

***

### Variable types

<figure><img src="/files/eT34Ic6quNNHIZ6F5qKv" alt="Type dropdown showing all available variable types"><figcaption></figcaption></figure>

| Type         | Use for                                    |
| ------------ | ------------------------------------------ |
| **Text**     | Names, descriptions, open-ended answers    |
| **Selector** | A value chosen from a fixed set of options |
| **Boolean**  | Yes/No or true/false values                |
| **Number**   | Quantities, scores, or numeric values      |
| **Date**     | Calendar dates                             |
| **DateTime** | Date and time combined                     |
| **Email**    | Email addresses                            |
| **Phone**    | Phone numbers                              |
| **URL**      | Web addresses                              |
| **JSON**     | Structured data objects                    |

***

### Writing good instructions

The **Instruction** field is a prompt that tells the AI exactly what to look for. Be specific:

> *"Extract the email address the user provided during the conversation. If none was given, return null."*

> *"Identify the product or service the user expressed interest in. Return only the product name."*

> *"Determine if the user confirmed an appointment. Return true if confirmed, false otherwise."*

***

### Editing and deleting variables

Click any variable in the list to open the editor modal and modify its settings. To remove it, open the variable and click **Delete**.

***

## Conversation Analysis Flow

Enter an HTTPS webhook URL in the **Webhook URL** field to have analysis results sent automatically when each conversation closes.

The URL must begin with `https://`. If left empty, results are saved but not forwarded anywhere.

The webhook sends a `POST` request with a 10-second timeout. If the request fails, the analysis is still saved — the failure does not affect conversation data.

***

### Webhook payload

```json
{
  "id": "analysis-uuid",
  "conversation_id": "conversation-uuid",
  "session_index": 1,
  "success": true,
  "success_score": 87.5,
  "success_reason": "The user confirmed the appointment and provided contact details.",
  "variable_snapshots": {
    "customer_email": "user@example.com",
    "product_interested": "Premium Plan",
    "appointment_confirmed": true
  },
  "created_at": "2026-02-25T10:30:00Z"
}
```

| Field                | Description                                                     |
| -------------------- | --------------------------------------------------------------- |
| `id`                 | Unique identifier for this analysis record                      |
| `conversation_id`    | The conversation this analysis belongs to                       |
| `session_index`      | Session number, incremented automatically per conversation      |
| `success`            | Whether the conversation met its goal (evaluated automatically) |
| `success_score`      | Confidence score from 0 to 100                                  |
| `success_reason`     | Explanation of the evaluation                                   |
| `variable_snapshots` | Key-value map of variable names to their extracted values       |
| `created_at`         | Timestamp of when the analysis was created                      |

***

## Saving your configuration

Click **Save Agent** (top right) after making any changes to variables or webhook URL. Changes take effect on the next conversation that closes after saving.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.dapta.ai/ai-text-agents/setting-up-your-text-agent/post-conversation-analysis.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
