Skip to main content

Notifications

Your notifications, and the devices that receive them as push notifications.

Access it as client.notifications on a Strongly client, or the same path on AsyncStrongly with await. All methods exist on both with identical signatures.

Quick start​

from strongly import Strongly

client = Strongly()

# List (auto-paginates as you iterate) # filters: unread_only, sort
for notification in client.notifications.list():
print(notification.id)

Methods​

Core​

list​

list(*, unread_only: bool | None = None, sort: str | None = None, limit: int | None = None) -> SyncPaginator[Notification]

List your notifications, newest first.

Parameters

  • unread_only (bool | None, optional): True lists only unread notifications. The API's default is all.
  • sort (str | None, optional): The order, as comma-separated wire field names, each prefixed with - for descending. The API's default is "-createdAt".
  • limit (int | None, optional): The most notifications to return; None returns every one.

Returns

  • SyncPaginator[Notification]: The notifications, fetched a page at a time.

update​

update(notification_id: str, *, read: bool) -> Notification

Mark one of your notifications read or unread.

Parameters

  • notification_id (str): The notification's id.
  • read (bool): Whether it is read.

Raises

  • NotFoundError: You have no notification with this id.

delete​

delete(notification_id: str) -> None

Delete one of your notifications.

Parameters

  • notification_id (str): The notification's id.

Raises

  • NotFoundError: You have no notification with this id.

Other​

mark_all_read​

mark_all_read() -> int

Mark every one of your unread notifications read.

Returns

  • int: How many notifications were marked read.

register_device​

register_device(*, token: str, platform: str | None = None) -> None

Register a device to receive your notifications as push notifications.

Registering a token again refreshes it.

Parameters

  • token (str): The device's push token (an APNs token, hex).
  • platform (str | None, optional): The device's platform. The API's default is "ios".

Raises

  • ValidationError: token is blank.

unread_count​

unread_count() -> int

Return how many of your notifications are unread.

Returns

  • int: The number of unread notifications.