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

# CRM Contacts and Lead Management

> LaraCopilot includes a built-in CRM for storing contacts and leads tied to your tenant, keeping customer data alongside your communications.

LaraCopilot ships with a lightweight CRM that lives inside the same platform as your calls and messages. Contacts are scoped to a tenant, so each organisation on your platform has its own isolated contact book. Because the CRM shares the same data layer as CDRs and SMS messages, you can cross-reference communication history against contact records without leaving the admin portal.

## Contact Fields

Each contact record stores the following information:

| Field       | Type    | Required | Description                                                           |
| ----------- | ------- | -------- | --------------------------------------------------------------------- |
| `tenant_id` | integer | Yes      | The tenant this contact belongs to                                    |
| `full_name` | string  | Yes      | Contact's full name, max 255 chars                                    |
| `company`   | string  | No       | Organisation or company name                                          |
| `email`     | string  | No       | Email address                                                         |
| `phone`     | string  | Yes      | Primary phone number, max 50 chars                                    |
| `status`    | string  | Yes      | Lifecycle status of the contact (e.g. `lead`, `customer`, `inactive`) |
| `notes`     | text    | No       | Free-text notes about the contact                                     |

<Note>
  `phone` is required when creating a contact because it is the primary key used to match inbound callers and outbound SMS recipients to CRM records.
</Note>

## Tenant Isolation

Every contact is associated with exactly one tenant via `tenant_id`. Contacts created under one tenant are never visible to another tenant's admin users. When you access the CRM index, the platform loads contacts along with their tenant relationship so you always have context about which organisation owns each record.

## Accessing the CRM in the Admin Portal

<Steps>
  <Step title="Open the CRM section">
    Log in to the admin panel and navigate to **CRM → Contacts**. The index page lists all contacts for the tenants you manage, with a search bar that filters by `full_name`, `company`, or `phone`.
  </Step>

  <Step title="Create a new contact">
    Click **New Contact**. Select the target `tenant_id` from the dropdown, then fill in `full_name`, `phone`, and `status`. The `company`, `email`, and `notes` fields are optional.
  </Step>

  <Step title="Edit or remove a contact">
    Click **Edit** on any contact row to update its fields. To remove a contact, click **Delete** — this action is immediate and cannot be undone.
  </Step>
</Steps>

## Practical Use Case: Identifying a Caller in Real Time

When an inbound call arrives, your IVR or agent application can look up the `caller_number` from the CDR against the `phone` field in CRM contacts for the relevant tenant. Matching a caller to a `CrmContact` lets you:

* Pre-populate agent screens with the caller's `full_name`, `company`, and `notes` before the call is answered.
* Check `status` to route known leads to a sales queue and existing customers to support.
* Append call outcome notes back to the contact's `notes` field after the call ends.

<Tip>
  Keep `status` values consistent across your tenant (for example: `lead`, `prospect`, `customer`, `churned`) so you can filter and segment contacts reliably for outbound campaigns.
</Tip>
