# Add channel to contact

> Add a new communication channel to an existing contact.

`POST https://api.zavu.dev/v1/contacts/{contactId}/channels`

Add a new communication channel to an existing contact.

## Parameters

- `contactId` (path, string, required)

## Body

- `channel` (string, required): Channel type. One of: `sms`, `whatsapp`, `email`, `telegram`, `instagram`, `messenger`, `voice`.
- `identifier` (string, required): Channel identifier (phone number in E.164 format or email address).
- `countryCode` (string): ISO country code for phone numbers.
- `label` (string): Optional label for the channel.
- `isPrimary` (boolean): Whether this should be the primary channel for its type.

## Responses

### 201

Channel added.

- `channel` (object, required): A communication channel for a contact.
  - `id` (string, required)
  - `channel` (string, required): Channel type. One of: `sms`, `whatsapp`, `email`, `telegram`, `instagram`, `messenger`, `voice`.
  - `identifier` (string, required): Channel identifier (phone number or email address).
  - `countryCode` (string): ISO country code for phone numbers.
  - `label` (string): Optional label for the channel.
  - `isPrimary` (boolean, required): Whether this is the primary channel for its type.
  - `verified` (boolean, required): Whether this channel has been verified.
  - `metrics` (object): Delivery metrics for this channel.
    - `successCount` (integer)
    - `failureCount` (integer)
    - `totalAttempts` (integer)
    - `avgDeliveryTimeMs` (number)
    - `lastSuccessAt` (string<date-time>)
  - `lastInboundAt` (string<date-time>): Last time a message was received on this channel.
  - `metadata` (object)
    - `{key}` (string)
  - `createdAt` (string<date-time>, required)
  - `updatedAt` (string<date-time>)

### 400

Invalid request or duplicate identifier.

- `code` (string, required)
- `message` (string, required)
- `details` (object)

### 401

Unauthorized.

- `code` (string, required)
- `message` (string, required)
- `details` (object)

### 404

Contact not found.

- `code` (string, required)
- `message` (string, required)
- `details` (object)

## Example

```bash
curl -X POST "https://api.zavu.dev/v1/contacts/contact_abc123/channels" \
  -H "Authorization: Bearer $ZAVUDEV_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "channel": "email",
  "identifier": "john.work@company.com",
  "label": "work"
}'
```

```typescript
import Zavudev from "@zavudev/sdk";

const zavu = new Zavudev({ apiKey: process.env.ZAVUDEV_API_KEY });

const result = await zavu.contacts.channels.add("contact_abc123", {
  channel: "email",
  identifier: "john.work@company.com",
  label: "work",
});

console.log(result);
```
