THanks @VV_10743662
Understood, so you're looking for browser notifications. Be careful, because in this scenario it is mandatory that the user first accepts the Notification permission.
The change in browser visibility (to detect minimize/maximize) can be intercepted with the Visibility API (works cross-browsers).
If you want to add Teams notifications (in the sense the user gets a message in Teams) you need to use Microsoft's Graph API to send such messages.
Overall speaking, this requires you to develop a Widget at least, to detect the browser changes and more important, to trigger notifications browser side. I think, but I did not use it before, that Firebase Cloud Messaging could be used for this. They have a Javascript SDK that you can package in your widget.
Note that for sending the actual notification, you can use the same API from the widget, but I would propose to implement the sending in the ThingWorx server, so that you can trigger notifications also from the server in the future (not only from the widget).