---
sidebar:
  label: roboto.notifications.http_client
  order: 0
title: roboto.notifications.http_client
---
## Module Contents

### NotificationsClient

```python
class roboto.notifications.http_client.NotificationsClient(
    http_client: roboto.http.HttpClient,
)
```

`from roboto.notifications import NotificationsClient`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/notifications/http_client.py#L20-L162)

Client for the caller's notifications: list them, mark them read, record their delivery, and delete them.

Each method sends one request. Its result is Roboto's response as a JSON-compatible dictionary, not a [`NotificationRecord`](/docs/reference/python-sdk/roboto/notifications/record#roboto.notifications.record.NotificationRecord) or other model.

**Parameters**

- **http_client** (`roboto.http.HttpClient`): HTTP client to send the requests with, such as the [`http_client`](/docs/reference/python-sdk/roboto/http/roboto_client#roboto.http.roboto_client.RobotoClient.http_client) of a [`RobotoClient`](/docs/reference/python-sdk/roboto/http/roboto_client#roboto.http.roboto_client.RobotoClient).

#### NotificationsClient.batch_update_notifications()

```python
def batch_update_notifications(
    updates: list[roboto.notifications.http_resources.UpdateNotificationRequest],
) -> dict[str, Any]
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/notifications/http_client.py#L111-L143)

Update several of the caller's notifications in one request.

Roboto applies each update on its own. An update naming a notification that does not exist or is for another user fails with `RobotoNotFoundException` in its element of the response, and the other updates still apply.

**Parameters**

- **updates** (`list[roboto.notifications.http_resources.UpdateNotificationRequest]`): Updates to apply, one per notification.

**Returns**

- `dict[str, Any]`: [`BatchResponse`](/docs/reference/python-sdk/roboto/http/response#roboto.http.response.BatchResponse) of [`NotificationRecord`](/docs/reference/python-sdk/roboto/notifications/record#roboto.notifications.record.NotificationRecord), as a JSON-compatible dictionary. `responses` holds the outcome of each update, in the order of `updates`.

**Raises**

- [`RobotoInvalidRequestException`](/docs/reference/python-sdk/roboto/exceptions/domain#roboto.exceptions.domain.RobotoInvalidRequestException): `updates` is empty.

#### NotificationsClient.delete_notification()

```python
def delete_notification(notification_id: str) -> None
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/notifications/http_client.py#L145-L162)

Delete one of the caller's notifications in the organization the caller acts in.

**Parameters**

- **notification_id** (`str`): ID of the notification to delete.

**Raises**

- [`RobotoNotFoundException`](/docs/reference/python-sdk/roboto/exceptions/domain#roboto.exceptions.domain.RobotoNotFoundException): The organization has no notification with this ID.
- [`RobotoUnauthorizedException`](/docs/reference/python-sdk/roboto/exceptions/domain#roboto.exceptions.domain.RobotoUnauthorizedException): The notification is for another user.

**Returns**

- `None`

#### NotificationsClient.get_notifications()

```python
def get_notifications() -> dict[str, Any]
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/notifications/http_client.py#L37-L52)

Fetch the first page of the caller's notifications in the organization the caller acts in, newest first.

A page holds up to 100 notifications. This method sends no page token, so it cannot fetch the pages after the first.

**Returns**

- `dict[str, Any]`: [`PaginatedList`](/docs/reference/python-sdk/roboto/http/response#roboto.http.response.PaginatedList) of [`NotificationRecord`](/docs/reference/python-sdk/roboto/notifications/record#roboto.notifications.record.NotificationRecord), as a JSON-compatible dictionary. `items` holds the notifications.

#### NotificationsClient.update_notification()

```python
def update_notification(
    notification_id: str,
    org_id: Optional[str] = None,
    read_status: Optional[str] = None,
    lifecycle_status: Optional[dict[roboto.notifications.record.NotificationChannel, str]] = None,
) -> Any
```

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/notifications/http_client.py#L54-L109)

Update a notification's read status or its delivery status on some channels.

The caller may update only their own notifications, unless they are a Roboto administrator.

**Parameters**

- **notification_id** (`str`): ID of the notification to update.
- **org_id** (`Optional[str]`): Organization to act in. Required when the caller belongs to more than one organization; otherwise the caller's only organization.
- **read_status** (`Optional[str]`): Read status to set, a [`ReadStatus`](/docs/reference/python-sdk/roboto/notifications/validator#roboto.notifications.validator.ReadStatus) value such as `"read"`. `None` leaves it unchanged.
- **lifecycle_status** (`Optional[dict[roboto.notifications.record.NotificationChannel, str]]`): Delivery status to set on each channel it names, keyed by channel. Channels it does not name keep their status. `None` leaves every channel unchanged.

**Returns**

- `Any`: [`NotificationRecord`](/docs/reference/python-sdk/roboto/notifications/record#roboto.notifications.record.NotificationRecord) of the updated notification, as a JSON-compatible dictionary.

**Raises**

- [`RobotoNotFoundException`](/docs/reference/python-sdk/roboto/exceptions/domain#roboto.exceptions.domain.RobotoNotFoundException): The organization has no notification with this ID.
- [`RobotoUnauthorizedException`](/docs/reference/python-sdk/roboto/exceptions/domain#roboto.exceptions.domain.RobotoUnauthorizedException): The notification is for another user and the caller is not a Roboto administrator.
