> ## Documentation Index
> Fetch the complete documentation index at: https://docs.intellixent.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Conversation Ended Webhook

> Receive chat conversation data and extracted variables when a WhatsApp or web widget conversation ends.

Intellixent sends a POST request to your configured webhook URL when a chat conversation ends — whether via WhatsApp or your web widget. The payload includes the full transcript, extracted variables, and customer details.

## Setup

Enable this webhook using the API:

```bash theme={null}
POST https://portal.intellixent.ai/api/assistants/{assistantId}/enable-conversation-ended-webhook
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json

{
  "webhook_url": "https://your-server.com/webhook/conversation-ended"
}
```

To disable it:

```bash theme={null}
POST https://portal.intellixent.ai/api/assistants/{assistantId}/disable-conversation-ended-webhook
Authorization: Bearer YOUR_API_KEY
```

## Retry behavior

If your endpoint returns a non-2xx status, Intellixent retries automatically:

| Attempt   | Delay       |
| --------- | ----------- |
| 1st retry | 30 seconds  |
| 2nd retry | 60 seconds  |
| 3rd retry | 120 seconds |

After 3 failed attempts, the delivery is marked as failed.

## Payload fields

<ResponseField name="conversation_id" type="string">
  UUID of the conversation.
</ResponseField>

<ResponseField name="assistant_id" type="string">
  UUID of the assistant that handled the conversation.
</ResponseField>

<ResponseField name="type" type="string">
  Conversation channel: `widget` or `whatsapp`.
</ResponseField>

<ResponseField name="message_count" type="integer">
  Total number of messages exchanged.
</ResponseField>

<ResponseField name="status" type="string">
  Always `ended` for this webhook.
</ResponseField>

<ResponseField name="extracted_variables" type="object">
  Variables extracted by the AI from your post-call schema configuration.

  <Expandable title="Example fields">
    <ResponseField name="status" type="boolean">Whether the objective was achieved.</ResponseField>
    <ResponseField name="summary" type="string">Short conversation summary.</ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="input_variables" type="object">
  Variables passed to the assistant at conversation start (e.g., pre-chat form fields).
</ResponseField>

<ResponseField name="transcript" type="array">
  Array of message objects with `role` (`assistant` or `user`) and `content` fields.
</ResponseField>

<ResponseField name="formatted_transcript" type="string">
  Human-readable transcript with `AI:` and `Customer:` prefixes.
</ResponseField>

<ResponseField name="customer_phone" type="string">
  Customer phone number. Available for WhatsApp; `null` for widget.
</ResponseField>

<ResponseField name="customer_name" type="string">
  Customer name from pre-chat form data, or `null`.
</ResponseField>

<ResponseField name="sender" type="object">
  WhatsApp sender info. Only present for WhatsApp conversations; `null` for widget.

  <Expandable title="Sender fields">
    <ResponseField name="phone_number" type="string">WhatsApp sender phone number.</ResponseField>
    <ResponseField name="display_name" type="string">WhatsApp sender display name.</ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="created_at" type="string">
  ISO 8601 timestamp when the conversation started.
</ResponseField>

<ResponseField name="ended_at" type="string">
  ISO 8601 timestamp when the conversation ended.
</ResponseField>

## Example payloads

<Tabs>
  <Tab title="Web Widget">
    ```json theme={null}
    {
      "conversation_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "assistant_id": "f9e8d7c6-b5a4-3210-fedc-ba9876543210",
      "type": "widget",
      "message_count": 8,
      "status": "ended",
      "extracted_variables": {
        "status": true,
        "summary": "Customer asked about pricing and was interested in the Pro plan"
      },
      "input_variables": { "name": "John Doe", "email": "john@example.com" },
      "transcript": [
        { "role": "assistant", "content": "Hi! How can I help you today?" },
        { "role": "user", "content": "What are your pricing plans?" }
      ],
      "formatted_transcript": "AI: Hi! How can I help you today?\nCustomer: What are your pricing plans?",
      "customer_phone": null,
      "customer_name": "John Doe",
      "sender": null,
      "created_at": "2026-02-23T09:30:00+01:00",
      "ended_at": "2026-02-23T10:00:00+01:00"
    }
    ```
  </Tab>

  <Tab title="WhatsApp">
    ```json theme={null}
    {
      "conversation_id": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "assistant_id": "f9e8d7c6-b5a4-3210-fedc-ba9876543210",
      "type": "whatsapp",
      "message_count": 12,
      "status": "ended",
      "extracted_variables": {
        "status": true,
        "summary": "Customer scheduled an appointment for next week"
      },
      "input_variables": {},
      "transcript": [
        { "role": "user", "content": "Hello, I'd like to book an appointment" },
        { "role": "assistant", "content": "Happy to help! What date works for you?" }
      ],
      "formatted_transcript": "Customer: Hello, I'd like to book an appointment\nAI: Happy to help! What date works for you?",
      "customer_phone": "+1234567890",
      "customer_name": null,
      "sender": {
        "phone_number": "+19876543210",
        "display_name": "My Business"
      },
      "created_at": "2026-02-23T14:00:00+01:00",
      "ended_at": "2026-02-23T14:25:00+01:00"
    }
    ```
  </Tab>
</Tabs>
