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

> Webhook events sent when a PailFlow session completes. Configure the webhook by passing `webhook_callback_url` when you create or start a bot.

# Webhooks

## Event: session\_complete

Sent after the call ends and the transcript, summary, and insights are processed.

### Payload

```json theme={null}
{
  "event": "session_complete",
  "transcript_id": "string | null",
  "room_id": "string | null",
  "room_name": "string",
  "duration_seconds": 1234,
  "transcript_text": "Full transcript text",
  "summary": "Summary text",
  "exit_reason": "participant_left | stop_phrase | force_leave | idle_timeout",
  "insights": {
    "summary": "...",
    "overall_score": 8,
    "strengths": ["..."],
    "weaknesses": ["..."]
  },
  "insights_error": "string | null"
}
```

### Exit Reasons

| Exit Reason        | Description                                                                |
| ------------------ | -------------------------------------------------------------------------- |
| `participant_left` | The user left the room, and the bot was the only remaining participant     |
| `stop_phrase`      | The bot detected the configured stop phrase in the conversation and exited |
| `force_leave`      | The bot was forcefully stopped via API (`POST /v1/bot/{bot_id}/stop`)      |
| `idle_timeout`     | The bot exited due to inactivity (no audio activity for 5 minutes)         |

Notes:

* `transcript_text` is used in webhook payloads (the REST status endpoint returns the transcript as `transcript`).
* `insights` is omitted if insight generation is disabled or fails.
* `insights_error` is included only when insight processing fails.
* `exit_reason` is included when available (always present for normal completions).

## Event: bot\_join\_failed

Sent when a bot fails to join a Daily.co room (e.g., room not found, authentication error).

### Payload

```json theme={null}
{
  "event_type": "bot_join_failed",
  "workflow_thread_id": "string",
  "room_url": "https://lunchpaillabs.daily.co/room-name",
  "error_type": "room_not_found | auth_error | unknown",
  "error_message": "Detailed error message from Daily.co",
  "timestamp": "2026-01-12T17:21:30.092034+00:00",
  "duration_seconds": 2
}
```

### Error Types

| Error Type       | Description                                        |
| ---------------- | -------------------------------------------------- |
| `room_not_found` | The Daily.co room doesn't exist (404 error)        |
| `auth_error`     | Authentication failed when joining the room        |
| `unknown`        | Other errors (network issues, rate limiting, etc.) |

Notes:

* `duration_seconds` is how long the bot attempted to join before failing.
* Configure webhooks by passing `webhook_callback_url` when creating or starting a bot.
