# 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="https://3835013762-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCy5rSNtQmtqYCGzJlNEB%2Fuploads%2Fgit-blob-3f15ce41c2c8e5e8836cc6a259bbf6c051eef01f%2Fconversation-analysis-overview.png?alt=media" 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="https://3835013762-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCy5rSNtQmtqYCGzJlNEB%2Fuploads%2Fgit-blob-60785e5535d984723980fb2d42f482e49291bc71%2Fconversation-analysis-add-variable.png?alt=media" 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="https://3835013762-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCy5rSNtQmtqYCGzJlNEB%2Fuploads%2Fgit-blob-d66920908ac97f356d84f7dc3e3fe181dbca73b2%2Fconversation-analysis-variable-types.png?alt=media" 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.
