# Send alerts by push and email

Canonical page: https://docs.ovok.com/guides/omni-channel-alerts

<Effort complexity={2} clients="HTTP" time="30–60 minutes" />

Tell the people you choose about Signals alert events. Signals sends alert events. Omni-channel alerts in Ovok runs your rule on each one and tells the people it names, over the channels it names. See [Omni-channel alerts](/signals/with-ovok/omni-channel-alerts) for who does what.

You need a sandbox project with a Signals tenant of its own, a patient enrolled in Signals, and an email provider set up in [Email templates](/email-templates/set-up-email).

## Turn on Omni-channel alerts [Console] [#turn-on-omni-channel-alerts-console]

In the Console, open **Omni-channel alerts** and turn the switch on. Keep the default rule it offers, or edit it on **Routing**.

Or over HTTP:

```bash
curl -X PUT 'https://api.sandbox.ovok.com/v1/project/settings/OMNICHANNEL_ALERTS_ENABLED' \
  --header "Authorization: Bearer ${OVOK_TOKEN}" \
  --header 'Content-Type: application/json' \
  --data '{"enabled": true}'
```

## Save a rule [Server-side] [#save-a-rule-server-side]

```bash
curl -X PUT 'https://api.sandbox.ovok.com/v1/omnichannel-alerts/rules' \
  --header "Authorization: Bearer ${OVOK_TOKEN}" \
  --header 'Content-Type: application/json' \
  --data '{"logic":{"if":[{"==":[{"var":"event"},"alert.triggered"]},{"notify":{"channels":["push","email"],"to":["practitioner","caregiver"]}},{"==":[{"var":"event"},"alert.refired"]},{"notify":{"channels":["push","email"],"to":["relatedPerson","sharedWith"]}},[]]}}'
```

See [Routing rules](/signals/with-ovok/routing-rules) for the variables and more examples.

## Record who to tell [Server-side] [#record-who-to-tell-server-side]

Each recipient group reads the project's FHIR records:

- `practitioner`: set `Patient.generalPractitioner`, or let the patient [share their record](/invitations/share-with-practitioner).
- `caregiver`: create a `CareTeam` with `subject` set to the patient and the carers as `participant.member`.
- `relatedPerson`: create a `RelatedPerson` for the patient, with an email address in `telecom`.
- `sharedWith`: let the patient [share their readings](/invitations/share-with-a-carer).

## Map the email templates [Console] [#map-the-email-templates-console]

In **Email templates**, map `ALERT_NOTIFICATION` (for practitioners) and `PATIENT_ALERT_NOTIFICATION` (for everyone else). See the [template catalogue](/email-templates/template-catalogue) for their parameters.

## Preview it [Console] [#preview-it-console]

On **Routing**, pick a patient and a sample alert and run the preview. It lists the people the rule reaches and flags anyone without an email address. Over HTTP:

```bash
curl -X POST 'https://api.sandbox.ovok.com/v1/omnichannel-alerts/preview' \
  --header "Authorization: Bearer ${OVOK_TOKEN}" \
  --header 'Content-Type: application/json' \
  --data '{"patientId":"{{PATIENT_ID}}","event":"alert.triggered","alert":{"code":"8867-4","value":132}}'
```

## Test your integration [#test-your-integration]

1. Send the patient a reading over their heart-rate threshold.
2. Check that the practitioner and care team received an email and a push.
3. Let the alert fire again: the family and the people the patient shares with are told, as your rule says.

## See also [#see-also]

- [Omni-channel alerts](/signals/with-ovok/omni-channel-alerts)
- [Routing rules](/signals/with-ovok/routing-rules)
- [Signals alert webhooks](/signals/standalone/webhooks/alert-triggered), to deliver over your own channels
- [OMNICHANNEL_ALERTS_ENABLED](/settings-and-features/settings/omnichannel-alerts-enabled)
