# Set the project's omni-channel alerts rule

Canonical page: https://docs.ovok.com/api/omni-channel-alerts/set-the-project-s-omni-channel-alerts-rule

`PUT /v1/omnichannel-alerts/rules`

Sets your project's omni-channel alerts rule. With `OMNICHANNEL_ALERTS_ENABLED` on, Ovok runs it on each alert event Signals sends and tells the people it names by email and push.

**Scope:** the caller's project (from the token).

## Behaviour

- `logic` is JSON Logic answering up to 10 entries for one event: `{ "notify": { "channels": [...], "to": [...] } }`. An empty list or `null` tells nobody of that event.
- The rule reads `event` (`alert.triggered`, `alert.empty`, `alert.note`, `alert.inactive`, `alert.refired`, `alert.resolved` or `alert.acknowledged`), `alert.id`, `alert.code`, `alert.reason`, `alert.message`, `alert.value` and `patient.id`.
- `channels`: `push`, `email`.
- `to`: `practitioner` (general practitioners and practitioners the patient shares their record with), `caregiver` (active care team members), `relatedPerson` (the patient's related persons) and `sharedWith` (the people the patient shares readings with).
- A written-out entry naming a channel or recipient Ovok does not know is refused with `UNKNOWN_NOTIFY_LABELS`. A rule that fails on any event type is refused with `INVALID_NOTIFICATIONS`.

## Example

```bash
curl -X PUT 'https://api.sandbox.ovok.com/v1/omnichannel-alerts/rules' \
  -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NjcyNjg4MDAsImV4cCI6MTc2NzI3MjQwMH0.Ql3B_ztDvctlyZ2z0vp4sl3ExXRQGkzmxdmTAqxNzZk' \
  -H 'Content-Type: application/json' \
  -d '{"logic":{"if":[{"==":[{"var":"event"},"alert.triggered"]},{"notify":{"channels":["push","email"],"to":["practitioner","caregiver"]}},[]]}}'
```

**Who can call it:** a project admin. See [roles](/access-policies#who-can-call-a-route).