# Channel properties


**Permissions** — a prop is not one capability, so the key depends on which prop
is named. The path carries neither the feature (that is the channel's type) nor
the verb (that is the prop), so this is checked in the handler.

| Prop | Key |
| --- | --- |
| `token` | **`CREDENTIAL`** — it returns the provider access token |
| `wa_pin_update`, `wa_request_otp`, `wa_submit_otp`, `migrate_number`, `wa_deregister`, `whatsapp_business_encryption` | **`REGISTER`** |
| `message_analytics`, `conversation_analytics` | `ANALYTICS` |
| `test_message`, `upload_media`, `resumable_upload` | `SEND` |
| `webhook_status`, `webhook_listener_update` | `CRM.CHANNEL.WEBHOOK.READ` / `.UPDATE` |
| every other read | `READ` |
| every other write | `UPDATE` |

The first two rows are the reason the split exists. `token` behind `READ` would
let anybody who can view a channel take its credential, and the number
lifecycle — retiring a number, moving it to another account, re-keying Flows
encryption — is not a profile edit.
`crm.channels.getProp` / `crm.channels.setProp` — `/v1/channels/:id/:prop`

Everything about a channel that lives with the **provider** rather than on the
channel document: the business profile, QR codes, media uploads, number
registration, the message queue.

```ts
crm.channels.getProp<T>(id, prop, query?): Promise<ChannelPropResponse<T>>
crm.channels.setProp<T>(id, prop, options?): Promise<ChannelPropResponse<T>>
```

Both answer the same envelope:

```ts
interface ChannelPropResponse<T> {
  data: T;         // whatever the provider returned — shape follows `prop`
  prop: string;    // echo
  channel: string; // echo
}
```

`data` is deliberately untyped: each property returns whatever Meta (or the
local config) hands back. Pass a type argument when you know the shape.

## Which channels support which properties

| Category | Readable | Writable |
| --- | --- | --- |
| `whatsapp` | all | all |
| `rcs` | `fetch_channel_queue` `recharge_url` `token` | `test_message` |
| anything else | none | none |

Asking for an unsupported property is `400 unsupported_channel_prop`, with the
supported list in `details`.

## `setProp` options

```ts
interface SetPropOptions {
  body?: Record<string, unknown>;  // JSON body — ignored when `raw` is set
  query?: Record<string, unknown>; // query string parameters
  raw?: BodyInit;                  // file bytes, for the three binary properties
  contentType?: string;            // required whenever `raw` is set
}
```

**Three properties take file bytes instead of JSON**: `profile_pic`,
`resumable_upload` and `upload_media`. Pass them as `raw` with a `contentType`.

Several write properties wrap their payload in an `update` key — that is Meta's
own envelope, passed straight through. The table below says which.

---

## Readable properties

### `general`

Meta's general details for the phone number: verified name, quality rating,
display number status.

```ts
const { data } = await crm.channels.getProp(id, 'general');
```

### `business_profile`

The WhatsApp business profile: about text, address, description, email,
websites, vertical, profile picture URL.

### `business_compliance`

Compliance information registered for the business (India's customer-care
details, and similar).

### `business_commerce`

Commerce settings: whether the catalog and cart are on.

### `conversation_automation`

The configured welcome message, ice-breaker prompts and commands.

### `qr_code`

The channel's WhatsApp QR codes and their short links.

### `message_analytics`

Meta's message analytics for the number.

| Query | Required | Default | Notes |
| --- | --- | --- | --- |
| `start` | yes | — | Unix seconds. |
| `end` | yes | — | Unix seconds. |
| `breakdown` | no | `'DAY'` | Meta's breakdown granularity. |
| `number` | no | the channel's own identity | Phone number to report on. |

```ts
const { data } = await crm.channels.getProp(id, 'message_analytics', {
  start: 1767225600,
  end: 1769817600,
  breakdown: 'DAY',
});
```

A missing `start` or `end` is a `422`.

### `redirect_url`

A deep link into Meta Business Suite, prefilled for this channel.

| Query | Required | Values |
| --- | --- | --- |
| `target` | yes | `meta_catalog_manager` · `link_whatsApp_catalog` · `wa_manager` · `business` |

An unknown target is a `422` listing the valid ones. `data` is the URL string.

### `token`

The channel's inbound API token, followed by an encrypted copy: the prefix
identifies the channel, the remainder proves the platform issued it. `data` is
the concatenated string. This is how you read a token back after
[`rotateToken`](channels.md#rotatetoken).

### `channel_config`

What the agency permits on this channel. Agencies that have never saved a config
get permissive defaults.

```ts
{ about: boolean }   // may the about text be edited
```

### `fetch_channel_queue`

How many messages are waiting in the channel's outbound queue.

### `recharge_url`

The agency's hosted top-up page for the channel's currency, prefilled with the
caller's details. `404 recharge_link_unavailable` when no link is configured for
that currency.

---

## Writable properties

### Profile and compliance

| `prop` | Body | Notes |
| --- | --- | --- |
| `business_profile` | `{ update: {...} }` | Meta's business profile fields. |
| `business_compliance` | `{ update: {...} }` | Compliance details. |
| `business_commerce` | `{ update: {...} }` | Catalog and cart settings. |

`update` is required on all three; leaving it out is a `422`.

```ts
await crm.channels.setProp(id, 'business_profile', {
  body: { update: { about: 'We reply in minutes', email: 'hi@example.com' } },
});
```

### `qr_code`

`{ update: {...} }`. Pass `update.edit: true` to change an existing code;
otherwise a new one is created.

### `conversation_automation`

Reads the current automation, changes one part of it, and writes it back — so
the rest survives.

| Body key | Effect |
| --- | --- |
| `welcome_message` | Sets `enable_welcome_message`. |
| `prop: 'prompts'` + `prompts` | Replaces the ice-breaker prompts. |
| `prop: 'commands'` + `commands` | Replaces the commands. |

```ts
await crm.channels.setProp(id, 'conversation_automation', {
  body: { prop: 'prompts', prompts: [{ prompt_text: 'Track my order' }] },
});
```

### `conversation_analytics`

| Body | Required | Default |
| --- | --- | --- |
| `range` | yes | — |
| `granularity` | no | `'DAILY'` |
| `breakdown` | no | `''` |

Meta's conversation statistics for the channel's own number.

### `whatsapp_business_encryption`

`{ business_public_key }` — required. Registers the key used for encrypted flow
responses.

### Number registration and migration

| `prop` | Body | What it does |
| --- | --- | --- |
| `wa_request_otp` | `{ method?: 'SMS' \| 'VOICE' }` | Asks Meta to send a verification code. Anything but `'VOICE'` is treated as `'SMS'`. |
| `wa_submit_otp` | `{ code }` | Verifies the code. Required. |
| `wa_pin_update` | `{ pin, localization? }` | Registers the number with Meta, which is what enables messaging on it. Runs the credit-line handshake and provisions the BSP account first. Already registered? The call is a no-op returning `{ pin: 'unchanged' }`. |
| `wa_biz_update` | — | For WA Biz numbers, already registered with Meta: does the billing handshake and activates the channel. `400 not_biz_app_channel` on any other channel. |
| `wa_deregister` | — | Deregisters the number at Meta. |
| `migrate_number` | `{ cc, phone_number }` | Both required. Moves the channel to a new number and rewrites its `phone_number_id` and identity. |

`wa_pin_update` and `wa_biz_update` both clear the channel's cache: registration
changes how the number behaves, and anything cached describes the state before
it.

### File uploads — **binary body**

| `prop` | Sends | Returns |
| --- | --- | --- |
| `profile_pic` | The image bytes | Uploads to Meta, then sets it as the profile picture. |
| `resumable_upload` | The file bytes | `{ h: '<handle>' }` — Meta's upload handle, for use in a template. |
| `upload_media` | The file bytes | Meta's media id, for sending. |

```ts
await crm.channels.setProp(id, 'profile_pic', {
  raw: await file.arrayBuffer(),
  contentType: 'image/jpeg',
});

const { data } = await crm.channels.setProp<{ h: string }>(id, 'resumable_upload', {
  raw: bytes,
  contentType: 'image/png',
});
data.h; // pass this handle to a template component
```

Up to 25 MB per request. A missing `contentType` will not be inferred.

### `test_message`

Sends one message on the channel, to check it end to end.

`409 channel_inactive` if the channel is not active.

For WhatsApp the body is an outbound message. `{ type: 'flow', flow_id, to, ... }`
sends a flow instead, and the flow must belong to this channel and be sendable.
`wait_for_flow_response` waits for the reply.

RCS speaks its own content schema: the whole body is passed through as the
message, with `queue_id` read off it.

```ts
await crm.channels.setProp(id, 'test_message', {
  body: { to: '919876543210', type: 'text', text: { body: 'ping' } },
});
```

### `webhook_listener_update`

Points both Meta subscriptions — the WABA (account-level events) and the phone
number (messages) — at the platform's listener, and marks the channel as
upgraded. Both have to point there for the listener to be whole.

Returns `{ webhook: '<listener url>' }`.

### `delete_channel_queue`

Purges the channel's outbound queue. Returns `{ deleted: true }`. Anything
waiting is dropped, not sent.

### `enable_whatsapp_direct` / `disable_whatsapp_direct`

Flips `whatsapp_direct_enabled` on the channel. Takes no body; returns
`{ whatsapp_direct_enabled: boolean }`.

---

## Errors

| Status | Code | When |
| --- | --- | --- |
| 400 | `unsupported_channel_prop` | The channel's category does not support this property. `details.supported` lists what it does. |
| 400 | `provider_request_failed` | Meta rejected the call (a 4xx from them). `details` carries their reason. |
| 502 | `provider_request_failed` | Meta failed or was unreachable (a 5xx). |
| 502 | `partner_request_failed` | The BSP partner call failed. |
| 422 | — | A required body or query key was missing. |
| 404 | `not_found` | No such channel for this caller. |
