# Channel preferences

TypeScript inputs, results, permissions and executable examples for channel preferences.

Use this reference with the [complete developer tour](https://beepgrid.com/docs/sdks/typescript/tour.md) and [TypeScript types](https://beepgrid.com/docs/sdks/typescript/types.md). The example at the end runs after the tour setup.

## deliveryPreferences

Read a Person's versioned delivery defaults and Agent/Agent-role overrides.

```text
deliveryPreferences(personId: string): Promise<DeliveryPreferences>
```

| Parameter | Type and default | Usage |
| --- | --- | --- |
| `personId` | `string` (required) | Stable recipient Person identity ID. |

**Returns:** DeliveryPreferences with person_id, version, default and ordered overrides.

**Permissions, lifecycle and errors:** Person self, administrator or authorized identity manager only. Reload after a stale-version conflict; preferences grant no contact authority.

Declared return type: `Promise<DeliveryPreferences>`.

[Working TypeScript example](https://beepgrid.com/docs/sdks/typescript/channels/#example). Input/output fields are in the [types reference](https://beepgrid.com/docs/sdks/typescript/types.md).

## saveDeliveryPreferences

Save a Person's channel policy using its observed version.

```text
saveDeliveryPreferences(personId: string, preferences: DeliveryPreferences): Promise<DeliveryPreferences>
```

| Parameter | Type and default | Usage |
| --- | --- | --- |
| `personId` | `string` (required) | Stable recipient Person identity ID. |
| `preferences` | `DeliveryPreferences` (required) | The recipient delivery preferences to save, including the observed version, default policy and ordered overrides. |

**Returns:** DeliveryPreferences with the incremented version; pending external sends from the previous configuration stop.

**Permissions, lifecycle and errors:** Person self, administrator or authorized identity manager only. Reload after a stale-version conflict; preferences grant no contact authority.

Declared return type: `Promise<DeliveryPreferences>`.

[Working TypeScript example](https://beepgrid.com/docs/sdks/typescript/channels/#example). Input/output fields are in the [types reference](https://beepgrid.com/docs/sdks/typescript/types.md).

## Example

Run this region after [the shared setup](https://beepgrid.com/docs/sdks/typescript/tour.md). Assertions check the returned data; the full tour is a runnable program.



```typescript
const preferences = await owner.deliveryPreferences(personId);
const savedPreferences = await owner.saveDeliveryPreferences(personId, {person_id: personId, version: preferences.version,
  default: {mode: 'preferred', destinations: [], followup_seconds: 0}, overrides: []});
assert.ok(savedPreferences.version > preferences.version);
```
