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

# CRM contacts

> Attach the record your app has on screen

Tell the dialer who the agent is looking at. The bundled UIs show the name and avatar, prefill the destination, and Ringee attributes the call to the right contact.

```ts theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
ringee.setContact({
  name: "Morgan Reed",
  number: "+13055550142",
  imageUrl: "https://crm.example.com/avatars/294.png",
  externalContactId: "crm-contact-294",
});
```

## Fields

| Field | Purpose |
| - | - |
| `name` | Visual label in the bundled UI |
| `number` | Prefills the destination |
| `imageUrl` | Avatar in the bundled UI |
| `contactId` | Native Ringee contact UUID |
| `externalContactId` | The contact's id in your CRM |

## `contactId` or `externalContactId`?

You need one, not both.

> [card] contactId
>
> Use it when you already know the internal Ringee UUID — for example because
> your app reads Ringee data directly.

> [card] externalContactId
>
> Use it when your [Custom Integration](https://docs.ringee.io/api/overview.md) maps a CRM id to a
> Ringee contact.

`externalContactId` is the same value you send as `data.externalId` in [`contact.upserted`](https://docs.ringee.io/api/inbound-events#contact-upserted). Sync contacts through the Public API first and Ringee resolves the link automatically.

> [!TIP]
>
> Keep `externalContactId` consistent so Ringee resolves the correct contact.
> When you process [`call.completed`](https://docs.ringee.io/api/events-reference#call-completed), do
> not rely on a contact reference alone: keep a normalized phone-number fallback
> for activity matching.

## Prefill just a number

When there is no contact record — a manual dial, an inbound lookup:

```ts theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
ringee.prefill("+13055550142");
```

## Start a call directly

Floating can skip straight to dialing:

```ts theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
ringee.startCall({
  to: "+13055550142",
  name: "Morgan Reed",
  externalContactId: "crm-contact-294",
});
```

In Headless:

```ts theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
await dialer.call({
  to: "+13055550142",
  callerIdId: selectedCallerId,
  externalContactId: "crm-contact-294",
});
```

## Phone number format

Destinations must be **E.164** — a `+`, the country code, then the number, with no extension:

```text theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
+13055550198
+34911234567
+18095550123
```

Anything else fails with `INVALID_PHONE_NUMBER`. Normalize in your CRM before passing it in; the SDK validates locally before it reaches the network.

## Keeping it in sync

Call `setContact()` whenever the selected record changes. It is cheap and idempotent:

```ts theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
function onRecordOpened(contact) {
  ringee.setContact({
    name: contact.fullName,
    number: contact.phone,
    imageUrl: contact.avatarUrl,
    externalContactId: contact.id,
  });
}
```

To detach the current record — the user closed the panel, navigated away, deselected — pass `null`:

```ts theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
ringee.setContact(null);
```

## After the call

The SDK emits `ended` with a call snapshot in the browser, but the durable record of what happened arrives through your [outbound webhooks](https://docs.ringee.io/api/outbound-webhooks.md):

| Event | Carries |
| - | - |
| `call.completed` | Direction, status, timing, duration |
| `call.outcome.updated` | The outcome the agent logged, plus the note |
| `recording.ready` | Recording URL and transcript |

Write your CRM activity from the webhooks — they are signed, retried and idempotent. Use the browser events for live UI only.

## Next steps

> [card] [Sync contacts to Ringee](https://docs.ringee.io/api/inbound-events.md)
>
> Establish the `externalId` link

> [card] [Receive call activity](https://docs.ringee.io/api/outbound-webhooks.md)
>
> Close the loop back into your CRM


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.