# OmnichannelAlertsResource

Canonical page: https://docs.ovok.com/java-sdk/reference/omnichannel-alerts-resource

```java
public final class OmnichannelAlertsResource
```

Omni-channel alerts under `/v1/omnichannel-alerts`: Ovok runs the project's rule on each Signals alert event and tells the people it names by push and email. For project admins. Get it from [`Ovok.omnichannelAlerts()`](/java-sdk/reference/ovok#omnichannelalerts).

## Methods [#methods]

### rules [#rules]

```java
public OmnichannelAlertsResource.Rules rules()
```

Returns the project's alert notifications rule.

**Returns:** the rules resource

### preview [#preview]

```java
public JsonNode preview(
        Object preview,
        RequestOptions options) throws IOException, InterruptedException
```

Previews who the rule tells of a sample alert event; nothing is sent (`POST /v1/omnichannel-alerts/preview`).

**Parameters:**

- `preview`: the `patientId`, an optional `event` (`alert.triggered` when omitted), an optional sample `alert` and an optional `notifications` rule to try instead of the project's own
- `options`: per-request options, such as the timeout

**Returns:** the `notify` entries the rule answers, each with the people it reaches

**Throws:**

- `IOException`: if the request cannot be sent or the response cannot be read
- `InterruptedException`: if the thread is interrupted while waiting for the response

## OmnichannelAlertsResource.Rules [#omnichannelalertsresourcerules]

```java
public static final class Rules
```

The project's alert notifications rule (`/v1/omnichannel-alerts/rules`), JSON Logic passed through.

### Rules.retrieve [#rulesretrieve]

```java
public JsonNode retrieve(RequestOptions options) throws IOException, InterruptedException
```

Reads the rule (`GET /v1/omnichannel-alerts/rules`).

**Parameters:**

- `options`: per-request options, such as the timeout

**Returns:** the rule under `notifications`, null when the project has none

**Throws:**

- `IOException`: if the request cannot be sent or the response cannot be read
- `InterruptedException`: if the thread is interrupted while waiting for the response

### Rules.update [#rulesupdate]

```java
public JsonNode update(Object rule, RequestOptions options) throws IOException, InterruptedException
```

Sets the rule; Ovok checks the channels and recipients it names (`PUT /v1/omnichannel-alerts/rules`).

**Parameters:**

- `rule`: the rule, with its JSON Logic under `logic`
- `options`: per-request options, such as the timeout

**Returns:** the rule as Ovok now runs it

**Throws:**

- `IOException`: if the request cannot be sent or the response cannot be read
- `InterruptedException`: if the thread is interrupted while waiting for the response

### Rules.remove [#rulesremove]

```java
public void remove(RequestOptions options) throws IOException, InterruptedException
```

Removes the rule, so nobody is told of a new alert (`DELETE /v1/omnichannel-alerts/rules`).

**Parameters:**

- `options`: per-request options, such as the timeout

**Throws:**

- `IOException`: if the request cannot be sent or the response cannot be read
- `InterruptedException`: if the thread is interrupted while waiting for the response
