Unread Messages - Realtime Notification

Hi,
I need the number of unread messages of a user in a Python script. Preferably as a real-time push notification.

What I have achieved so far:

  1. Query the number of messages via the API. (Pull Request)
  2. Notification of new messages via outgoing webhook integration.

However, I do not receive a push notification when a message is read. How can I achieve this?

The entire message is also transmitted. The number of messages would be enough for me. Or that something has changed and I can execute the pull request.