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

# Leads & Tickets

> The captured records inbox for one agent. Browse every lead and ticket the agent filed, filter by type / channel / status / assignee, drill into a record to read its description and notes, export to CSV, and create new records by hand.

<Note>
  Leads & Tickets lives at `/agents/{agentId}/leads-tickets`. Three sub-tabs (collapsed by default behind a chevron toggle): **Inbox** / **Archived** / **Deleted**. Every record originates from a conversation and links back to it via the **View Linked Conversation** button on the row.
</Note>

## Type tabs

A two-tab toggle at the top of the list: **Leads** vs **Tickets** (the default shows both). Selecting one tab flips the type filter chip and recomputes counts. Each tab carries a count chip.

## Filter bar

A row above the records grid with these controls:

| Control                 | Options                                                                                     |
| ----------------------- | ------------------------------------------------------------------------------------------- |
| **Type filter**         | **Leads only**, **Tickets only**, **Both** (default)                                        |
| **Status filter**       | **Open**, **New**, **Closed**, **Cancelled** (the four supported values)                    |
| **Channel filter**      | **Web**, **WhatsApp**, **Messenger**, **Instagram**, **X**, **Telegram**, **Voice**         |
| **Search box**          | Placeholder *Search records...*. Matches name, description, custom field labels and values. |
| **+ New Record** button | Admin only. Opens the **Create Record** dialog (described below).                           |

Active filters show as pill chips after the controls. Each pill has an X to remove.

## Records grid

Below the filter bar, a grid of record cards.

### Record card

Each card shows:

* Checkbox on the corner (for bulk select)
* **Type chip** (Lead / Ticket) at the top, plus a **Channel icon** and **Status chip**
* **Created timestamp** in `dd-mm-yy HH:MM` format
* **Record ID** in monospace, e.g. `WIT-LED-A4B2X` or `WIT-TKT-3C9F`
* **Fields grid**: built-in fields (Name, Phone, Email, Company) shown only when populated, plus any custom fields the agent collected, each with its icon
* **Description block**: the agent's summary of what the customer wanted
* **Assignee row** at the bottom: avatar + name (or *Unassigned*)
* **Footer** with four icon-button actions:

| Footer button         | What it does                                                                                                              |
| --------------------- | ------------------------------------------------------------------------------------------------------------------------- |
| **Details**           | Opens the record detail sheet                                                                                             |
| **View Conversation** | Deep-links to the originating conversation in [Chat Conversations](/en/Systems/AI-Agents/Manage-Agent/Chat-Conversations) |
| **Mark**              | Dropdown to change status (Open / New / Closed / Cancelled)                                                               |
| **Assign**            | Dropdown to pick a teammate                                                                                               |

The card has `overflow-hidden` so the footer hover backgrounds don't bleed past the rounded corners.

## Bulk toolbar

Appears when one or more records are selected. Replaces the regular toolbar with these icon buttons:

| Action      | Behavior                                                         |
| ----------- | ---------------------------------------------------------------- |
| **Mark**    | Bulk status change via dropdown                                  |
| **Assign**  | Opens the **Bulk Assign** dialog                                 |
| **Archive** | Confirmation: *Archive {N} records?* Records move to Archived.   |
| **Delete**  | Red confirmation: *Delete {N} records?* Records move to Deleted. |

A select-all checkbox on the start of the bar covers everything in the current filter.

## Detail sheet

Click **Details** on any card to open a slide-in sheet from the end edge (flips for RTL).

### Contact card

Shows **Name**, **Phone**, **Email**, **Company**. The email value is a clickable mailto link, validated for format before rendering, and URL-encoded for safety.

### Custom fields card

Titled **Additional information**. Lists every custom field on the record with its icon, label, and value. Hidden when the record has no custom fields.

### Linked conversation button

A button that reads **View Linked Conversation**. Click to deep-link into the originating conversation, with the conversation pre-selected in the inbox.

### Description

The full description block, multi-line.

### Status pills row

A row of four pills (**Open**, **New**, **Closed**, **Cancelled**). The active pill is filled with the status color. Click another to change.

### Assignment block

* **Agent** combobox to pick a teammate
* Role badge next to the agent (Admin, Member, etc.)
* An optional note that gets attached to the assignment

### Notes textarea

A free-form notes field that gets saved to the record. Useful for follow-up reminders or context that didn't fit in the conversation.

### Footer actions

* **Archive** , moves record to Archived (with confirm)
* **Delete** , red, moves to Deleted (with confirm)

## CSV export

Two export buttons in the toolbar:

| Button       | What it does                                             |
| ------------ | -------------------------------------------------------- |
| **Page CSV** | Exports just the records visible on the current page.    |
| **All CSV**  | Exports every record matching the current filter window. |

The CSV file is UTF-8 with a Byte Order Mark and CRLF line endings, so Arabic and other scripts render correctly when opened in Excel. Custom fields appear as dynamic columns in the export. Cells starting with `=`, `+`, `-`, `@`, tab, or carriage return are prefixed with a single quote so spreadsheet apps can't execute them as formulas.

The download filename is sanitized from the agent ID with a max of 64 characters.

## Create Record dialog

Click **+ New Record** to open the dialog (admin only). Fields:

* **Type**: **Lead** or **Ticket** radio
* **Status**: defaults to **New**
* **Channel**: dropdown of all channels
* **Name**, **Phone**, **Email**, **Company** (built-in fields)
* **Custom fields**: every custom field defined in the wizard step
* **Description**: free-form textarea

Buttons: **Cancel** and **Create record**. The record gets a freshly minted ID prefixed with `WIT-LED-` for leads or `WIT-TKT-` for tickets.

## Sub-tabs

| Sub-tab      | What's in it                                   |
| ------------ | ---------------------------------------------- |
| **Inbox**    | Active records                                 |
| **Archived** | Records you've archived. Still searchable.     |
| **Deleted**  | Soft-deleted records. Recoverable for 30 days. |

The **+ New Record** button is hidden in Archived and Deleted views (you can't create new records in a recycling bin).

## Deep linking

The page accepts two query parameters:

* `?tab=leads` or `?tab=tickets` , seeds the type filter on first render.
* `?id={recordId}` , opens the detail sheet for that record on first render.

Both are validated against a safe character set before being applied (no special characters, max 64 chars).

## Empty states

* **No records match these filters** , the hint *Try changing the filter or search.*
* **No records yet** , when the agent hasn't filed anything in the date range. The hint suggests connecting at least one channel and turning on data collection in [Tickets & Leads](/en/Systems/AI-Agents/Wizard/Tickets-and-Leads).

## Common questions

<AccordionGroup>
  <Accordion title="A record has Email blank, but the agent definitely asked for it.">
    The customer either declined to share, or the agent wasn't able to extract a valid email from the conversation. Check the linked conversation, the agent may have flagged the missing field in the description.
  </Accordion>

  <Accordion title="My CSV export shows the email column with a leading apostrophe.">
    That's the formula-injection defense kicking in for cells that start with characters spreadsheet apps treat as formulas. Strip the apostrophe in the spreadsheet, or use the value as-is for downstream processing.
  </Accordion>

  <Accordion title="Can I edit a captured record?">
    You can change its status, assignee, and notes via the detail sheet. Built-in field values (Name, Phone, Email, Company) and custom field values are read-only , they're snapshots from the conversation.
  </Accordion>

  <Accordion title="The View Linked Conversation button does nothing.">
    The conversation may have been deleted (soft-deleted conversations stay 30 days, after that they're purged and the link target disappears). Check the **Deleted** sub-tab in [Chat Conversations](/en/Systems/AI-Agents/Manage-Agent/Chat-Conversations) before assuming it's gone for good.
  </Accordion>

  <Accordion title="How do I bulk-export only my own leads?">
    Apply the **Assignee** filter (in the filter bar) to your own name, then click **All CSV**. The export respects all active filters.
  </Accordion>
</AccordionGroup>

## Next

<CardGroup cols={2}>
  <Card title="Chat Conversations" icon="messages" href="/en/Systems/AI-Agents/Manage-Agent/Chat-Conversations">
    Where most records originate.
  </Card>

  <Card title="Tickets & Leads (wizard)" icon="ticket" href="/en/Systems/AI-Agents/Wizard/Tickets-and-Leads">
    Configure what fields the agent collects.
  </Card>
</CardGroup>
